Working on removing obsolete code, updated dependencies.

This commit is contained in:
Robin 2018-06-05 10:08:33 +02:00
commit bf0c23f812
57 changed files with 761 additions and 1776 deletions

View file

@ -32,6 +32,7 @@ using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autofac.Features.OwnedInstances;
using Dapplo.Addons;
using Dapplo.HttpExtensions;
using Dapplo.HttpExtensions.OAuth;
@ -56,6 +57,7 @@ namespace Greenshot.Addon.Box
private static readonly LogSource Log = new LogSource();
private readonly IBoxConfiguration _boxConfiguration;
private readonly IBoxLanguage _boxLanguage;
private readonly Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
private readonly INetworkConfiguration _networkConfiguration;
private readonly IResourceProvider _resourceProvider;
private readonly OAuth2Settings _oauth2Settings;
@ -67,11 +69,13 @@ namespace Greenshot.Addon.Box
IGreenshotLanguage greenshotLanguage,
IBoxConfiguration boxConfiguration,
IBoxLanguage boxLanguage,
Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> pleaseWaitFormFactory,
INetworkConfiguration networkConfiguration,
IResourceProvider resourceProvider) : base(coreConfiguration, greenshotLanguage)
{
_boxConfiguration = boxConfiguration;
_boxLanguage = boxLanguage;
_pleaseWaitFormFactory = pleaseWaitFormFactory;
_networkConfiguration = networkConfiguration;
_resourceProvider = resourceProvider;
@ -131,16 +135,16 @@ namespace Greenshot.Addon.Box
try
{
string url;
using (var pleaseWaitForm = new PleaseWaitForm("Box", _boxLanguage.CommunicationWait))
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory("Box", _boxLanguage.CommunicationWait, default))
{
pleaseWaitForm.Show();
ownedPleaseWaitForm.Value.Show();
try
{
url = await UploadToBoxAsync(surfaceToUpload).ConfigureAwait(true);
}
finally
{
pleaseWaitForm.Close();
ownedPleaseWaitForm.Value.Close();
}
}

View file

@ -94,32 +94,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />

View file

@ -22,15 +22,15 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -29,6 +29,7 @@ using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows;
using Autofac.Features.OwnedInstances;
using Dapplo.Confluence;
using Dapplo.Confluence.Entities;
using Dapplo.Log;
@ -54,6 +55,7 @@ namespace Greenshot.Addon.Confluence
private static readonly Bitmap ConfluenceIcon;
private readonly IConfluenceConfiguration _confluenceConfiguration;
private readonly IConfluenceLanguage _confluenceLanguage;
private readonly Func<Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
private IConfluenceClient _confluenceClient;
private readonly Content _page;
@ -80,18 +82,22 @@ namespace Greenshot.Addon.Confluence
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage,
IConfluenceConfiguration confluenceConfiguration,
IConfluenceLanguage confluenceLanguage) : base(coreConfiguration, greenshotLanguage)
IConfluenceLanguage confluenceLanguage,
Func<Owned<PleaseWaitForm>> pleaseWaitFormFactory
) : base(coreConfiguration, greenshotLanguage)
{
_confluenceConfiguration = confluenceConfiguration;
_confluenceLanguage = confluenceLanguage;
_pleaseWaitFormFactory = pleaseWaitFormFactory;
}
protected ConfluenceDestination(
private ConfluenceDestination(
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage,
IConfluenceConfiguration confluenceConfiguration,
IConfluenceLanguage confluenceLanguage,
Content page) : this(coreConfiguration, greenshotLanguage, confluenceConfiguration, confluenceLanguage)
Func<Owned<PleaseWaitForm>> pleaseWaitFormFactory,
Content page) : this(coreConfiguration, greenshotLanguage, confluenceConfiguration, confluenceLanguage, pleaseWaitFormFactory)
{
_page = page;
}
@ -125,7 +131,7 @@ namespace Greenshot.Addon.Confluence
}
foreach (var currentPage in currentPages)
{
yield return new ConfluenceDestination(CoreConfiguration, GreenshotLanguage, _confluenceConfiguration, _confluenceLanguage, currentPage);
yield return new ConfluenceDestination(CoreConfiguration, GreenshotLanguage, _confluenceConfiguration, _confluenceLanguage, _pleaseWaitFormFactory, currentPage);
}
}
@ -180,10 +186,13 @@ namespace Greenshot.Addon.Confluence
errorMessage = null;
try
{
// TODO: Create content
new PleaseWaitForm().ShowAndWait(Description, _confluenceLanguage.CommunicationWait,
() => _confluenceClient.Attachment.AttachAsync(page.Id, surfaceToUpload, filename, null, "image/" + _confluenceConfiguration.UploadFormat.ToString().ToLower())
);
// TODO: Create content
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory())
{
ownedPleaseWaitForm.Value.ShowAndWait(Description, _confluenceLanguage.CommunicationWait,
() => _confluenceClient.Attachment.AttachAsync(page.Id, surfaceToUpload, filename, null,
"image/" + _confluenceConfiguration.UploadFormat.ToString().ToLower()));
}
Log.Debug().WriteLine("Uploaded to Confluence.");
if (!_confluenceConfiguration.CopyWikiMarkupForImageToClipboard)
{

View file

@ -116,32 +116,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />

View file

@ -24,15 +24,15 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="Fody" version="3.0.3" targetFramework="net46" developmentDependency="true" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -32,6 +32,7 @@ using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autofac.Features.OwnedInstances;
using Dapplo.Addons;
using Dapplo.HttpExtensions;
using Dapplo.HttpExtensions.OAuth;
@ -61,6 +62,7 @@ namespace Greenshot.Addon.Dropbox
private readonly IDropboxConfiguration _dropboxPluginConfiguration;
private readonly IDropboxLanguage _dropboxLanguage;
private readonly IResourceProvider _resourceProvider;
private readonly Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
private OAuth2Settings _oAuth2Settings;
private IHttpBehaviour _oAuthHttpBehaviour;
@ -70,14 +72,16 @@ namespace Greenshot.Addon.Dropbox
INetworkConfiguration networkConfiguration,
IResourceProvider resourceProvider,
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage
) : base(coreConfiguration, greenshotLanguage)
IGreenshotLanguage greenshotLanguage,
Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> pleaseWaitFormFactory
) : base(coreConfiguration, greenshotLanguage)
{
_dropboxPluginConfiguration = dropboxPluginConfiguration;
_dropboxLanguage = dropboxLanguage;
_resourceProvider = resourceProvider;
_pleaseWaitFormFactory = pleaseWaitFormFactory;
_oAuth2Settings = new OAuth2Settings
_oAuth2Settings = new OAuth2Settings
{
AuthorizationUri = DropboxApiUri.
AppendSegments("1", "oauth2", "authorize").
@ -143,9 +147,9 @@ namespace Greenshot.Addon.Dropbox
try
{
var cancellationTokenSource = new CancellationTokenSource();
using (var pleaseWaitForm = new PleaseWaitForm("Dropbox", _dropboxLanguage.CommunicationWait, cancellationTokenSource))
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory("Dropbox", _dropboxLanguage.CommunicationWait, cancellationTokenSource))
{
pleaseWaitForm.Show();
ownedPleaseWaitForm.Value.Show();
try
{
var filename = surfaceToUpload.GenerateFilename(CoreConfiguration, _dropboxPluginConfiguration);
@ -162,7 +166,7 @@ namespace Greenshot.Addon.Dropbox
}
finally
{
pleaseWaitForm.Close();
ownedPleaseWaitForm.Value.Close();
}
}
}

View file

@ -106,32 +106,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />

View file

@ -22,15 +22,15 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -100,32 +100,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />

View file

@ -20,14 +20,14 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -34,6 +34,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using Autofac.Features.OwnedInstances;
using Dapplo.Addons;
using Dapplo.HttpExtensions;
using Dapplo.HttpExtensions.Extensions;
@ -52,6 +53,9 @@ using Greenshot.Gfx;
namespace Greenshot.Addon.Flickr
{
/// <summary>
/// This defines the flickr destination
/// </summary>
[Destination("Flickr")]
public class FlickrDestination : AbstractDestination
{
@ -60,6 +64,7 @@ namespace Greenshot.Addon.Flickr
private readonly IFlickrConfiguration _flickrConfiguration;
private readonly IFlickrLanguage _flickrLanguage;
private readonly IResourceProvider _resourceProvider;
private readonly Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
private readonly OAuth1Settings _oAuthSettings;
private readonly OAuth1HttpBehaviour _oAuthHttpBehaviour;
private const string FlickrFarmUrl = "https://farm{0}.staticflickr.com/{1}/{2}_{3}.jpg";
@ -80,14 +85,16 @@ namespace Greenshot.Addon.Flickr
INetworkConfiguration networkConfiguration,
IResourceProvider resourceProvider,
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage
) : base(coreConfiguration, greenshotLanguage)
IGreenshotLanguage greenshotLanguage,
Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> pleaseWaitFormFactory
) : base(coreConfiguration, greenshotLanguage)
{
_flickrConfiguration = flickrConfiguration;
_flickrLanguage = flickrLanguage;
_resourceProvider = resourceProvider;
_pleaseWaitFormFactory = pleaseWaitFormFactory;
_oAuthSettings = new OAuth1Settings
_oAuthSettings = new OAuth1Settings
{
Token = flickrConfiguration,
ClientId = flickrConfiguration.ClientId,
@ -151,16 +158,16 @@ namespace Greenshot.Addon.Flickr
{
var cancellationTokenSource = new CancellationTokenSource();
using (var pleaseWaitForm = new PleaseWaitForm("Flickr", _flickrLanguage.CommunicationWait, cancellationTokenSource))
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory("Flickr", _flickrLanguage.CommunicationWait, cancellationTokenSource))
{
pleaseWaitForm.Show();
ownedPleaseWaitForm.Value.Show();
try
{
uploadUrl = await UploadToFlickrAsync(surface, captureDetails.Title);
uploadUrl = await UploadToFlickrAsync(surface, captureDetails.Title, cancellationTokenSource.Token);
}
finally
{
pleaseWaitForm.Close();
ownedPleaseWaitForm.Value.Close();
}
}

View file

@ -103,32 +103,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />

View file

@ -21,14 +21,14 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -32,6 +32,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using Autofac.Features.OwnedInstances;
using Dapplo.Addons;
using Dapplo.HttpExtensions;
using Dapplo.HttpExtensions.OAuth;
@ -57,6 +58,7 @@ namespace Greenshot.Addon.GooglePhotos
private readonly IGooglePhotosLanguage _googlePhotosLanguage;
private readonly INetworkConfiguration _networkConfiguration;
private readonly IResourceProvider _resourceProvider;
private readonly Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
private readonly OAuth2Settings _oAuth2Settings;
public GooglePhotosDestination(
@ -65,15 +67,17 @@ namespace Greenshot.Addon.GooglePhotos
INetworkConfiguration networkConfiguration,
IResourceProvider resourceProvider,
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage
IGreenshotLanguage greenshotLanguage,
Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> pleaseWaitFormFactory
) : base(coreConfiguration, greenshotLanguage)
{
_googlePhotosConfiguration = googlePhotosConfiguration;
_googlePhotosLanguage = googlePhotosLanguage;
_networkConfiguration = networkConfiguration;
_resourceProvider = resourceProvider;
_pleaseWaitFormFactory = pleaseWaitFormFactory;
_oAuth2Settings = new OAuth2Settings
_oAuth2Settings = new OAuth2Settings
{
AuthorizationUri = new Uri("https://accounts.google.com").AppendSegments("o", "oauth2", "auth").
ExtendQuery(new Dictionary<string, string>
@ -121,21 +125,21 @@ namespace Greenshot.Addon.GooglePhotos
return exportInformation;
}
public async Task<string> Upload(ICaptureDetails captureDetails, ISurface surfaceToUpload)
private async Task<string> Upload(ICaptureDetails captureDetails, ISurface surfaceToUpload)
{
try
{
string url;
using (var pleaseWaitForm = new PleaseWaitForm("GooglePhotos", _googlePhotosLanguage.CommunicationWait))
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory("GooglePhotos", _googlePhotosLanguage.CommunicationWait, default))
{
pleaseWaitForm.Show();
ownedPleaseWaitForm.Value.Show();
try
{
url = await UploadToPicasa(surfaceToUpload).ConfigureAwait(true);
}
finally
{
pleaseWaitForm.Close();
ownedPleaseWaitForm.Value.Close();
}
}
@ -160,7 +164,7 @@ namespace Greenshot.Addon.GooglePhotos
/// <param name="progress"></param>
/// <param name="token"></param>
/// <returns></returns>
public async Task<string> UploadToPicasa(ISurface surface, IProgress<int> progress = null, CancellationToken token = default)
private async Task<string> UploadToPicasa(ISurface surface, IProgress<int> progress = null, CancellationToken token = default)
{
string filename = surface.GenerateFilename(CoreConfiguration, _googlePhotosConfiguration);

View file

@ -89,32 +89,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />

View file

@ -21,14 +21,14 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -111,32 +111,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.6.4\lib\net46\MahApps.Metro.dll</HintPath>

View file

@ -28,6 +28,7 @@ using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autofac.Features.OwnedInstances;
using Dapplo.Addons;
using Dapplo.Log;
using Dapplo.Windows.Extensions;
@ -55,6 +56,7 @@ namespace Greenshot.Addon.Imgur
private readonly IImgurLanguage _imgurLanguage;
private readonly ImgurApi _imgurApi;
private readonly ImgurHistoryViewModel _imgurHistoryViewModel;
private readonly Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
private readonly IResourceProvider _resourceProvider;
public ImgurDestination(
@ -64,12 +66,14 @@ namespace Greenshot.Addon.Imgur
IImgurLanguage imgurLanguage,
ImgurApi imgurApi,
ImgurHistoryViewModel imgurHistoryViewModel,
IResourceProvider resourceProvider) : base(coreConfiguration, greenshotLanguage)
Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> pleaseWaitFormFactory,
IResourceProvider resourceProvider) : base(coreConfiguration, greenshotLanguage)
{
_imgurConfiguration = imgurConfiguration;
_imgurLanguage = imgurLanguage;
_imgurApi = imgurApi;
_imgurHistoryViewModel = imgurHistoryViewModel;
_pleaseWaitFormFactory = pleaseWaitFormFactory;
_resourceProvider = resourceProvider;
}
@ -114,9 +118,9 @@ namespace Greenshot.Addon.Imgur
var cancellationTokenSource = new CancellationTokenSource();
// TODO: Replace the form
using (var pleaseWaitForm = new PleaseWaitForm("Imgur", _imgurLanguage.CommunicationWait, cancellationTokenSource))
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory("Imgur", _imgurLanguage.CommunicationWait, cancellationTokenSource))
{
pleaseWaitForm.Show();
ownedPleaseWaitForm.Value.Show();
try
{
imgurImage = await _imgurApi.UploadToImgurAsync(surfaceToUpload, captureDetails.Title, null, cancellationTokenSource.Token).ConfigureAwait(true);
@ -141,7 +145,7 @@ namespace Greenshot.Addon.Imgur
}
finally
{
pleaseWaitForm.Close();
ownedPleaseWaitForm.Value.Close();
}
}

View file

@ -23,15 +23,15 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="MahApps.Metro" version="1.6.4" targetFramework="net46" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />

View file

@ -114,32 +114,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />

View file

@ -57,6 +57,7 @@ namespace Greenshot.Addon.Jira
private readonly JiraConnector _jiraConnector;
private readonly IWindowManager _windowManager;
private readonly Func<Owned<JiraViewModel>> _jiraViewModelFactory;
private readonly Func<Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
private readonly IResourceProvider _resourceProvider;
private readonly IJiraConfiguration _jiraConfiguration;
private readonly IJiraLanguage _jiraLanguage;
@ -66,7 +67,8 @@ namespace Greenshot.Addon.Jira
IJiraLanguage jiraLanguage,
JiraConnector jiraConnector,
Func<Owned<JiraViewModel>> jiraViewModelFactory,
IWindowManager windowManager,
Func<Owned<PleaseWaitForm>> pleaseWaitFormFactory,
IWindowManager windowManager,
IResourceProvider resourceProvider,
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage
@ -77,19 +79,21 @@ namespace Greenshot.Addon.Jira
_jiraConnector = jiraConnector;
_windowManager = windowManager;
_jiraViewModelFactory = jiraViewModelFactory;
_pleaseWaitFormFactory = pleaseWaitFormFactory;
_resourceProvider = resourceProvider;
}
protected JiraDestination(IJiraConfiguration jiraConfiguration,
private JiraDestination(IJiraConfiguration jiraConfiguration,
IJiraLanguage jiraLanguage,
JiraConnector jiraConnector,
Func<Owned<JiraViewModel>> jiraViewModelFactory,
IWindowManager windowManager,
Func<Owned<PleaseWaitForm>> pleaseWaitFormFactory,
IWindowManager windowManager,
IResourceProvider resourceProvider,
Issue jiraIssue,
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage
) : this(jiraConfiguration, jiraLanguage, jiraConnector, jiraViewModelFactory, windowManager, resourceProvider, coreConfiguration, greenshotLanguage)
) : this(jiraConfiguration, jiraLanguage, jiraConnector, jiraViewModelFactory, pleaseWaitFormFactory, windowManager, resourceProvider, coreConfiguration, greenshotLanguage)
{
_jiraIssue = jiraIssue;
}
@ -159,7 +163,7 @@ namespace Greenshot.Addon.Jira
foreach (var jiraDetails in _jiraConnector.RecentJiras)
{
yield return new JiraDestination(
_jiraConfiguration, _jiraLanguage, _jiraConnector, _jiraViewModelFactory,
_jiraConfiguration, _jiraLanguage, _jiraConnector, _jiraViewModelFactory, _pleaseWaitFormFactory,
_windowManager, _resourceProvider, jiraDetails.JiraIssue, CoreConfiguration, GreenshotLanguage);
}
}
@ -169,21 +173,24 @@ namespace Greenshot.Addon.Jira
var exportInformation = new ExportInformation(Designation, Description);
if (_jiraIssue != null)
{
try
{
// Run upload in the background
new PleaseWaitForm().ShowAndWait(Description, _jiraLanguage.CommunicationWait,
async () =>
{
await _jiraConnector.AttachAsync(_jiraIssue.Key, surface).ConfigureAwait(true);
surface.UploadUrl = _jiraConnector.JiraBaseUri.AppendSegments("browse", _jiraIssue.Key).AbsoluteUri;
}
);
Log.Debug().WriteLine("Uploaded to Jira {0}", _jiraIssue.Key);
exportInformation.ExportMade = true;
exportInformation.Uri = surface.UploadUrl;
}
catch (Exception e)
try
{
// Run upload in the background
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory())
{
ownedPleaseWaitForm.Value.ShowAndWait(Description, _jiraLanguage.CommunicationWait,
async () =>
{
await _jiraConnector.AttachAsync(_jiraIssue.Key, surface).ConfigureAwait(true);
surface.UploadUrl = _jiraConnector.JiraBaseUri.AppendSegments("browse", _jiraIssue.Key)
.AbsoluteUri;
});
}
Log.Debug().WriteLine("Uploaded to Jira {0}", _jiraIssue.Key);
exportInformation.ExportMade = true;
exportInformation.Uri = surface.UploadUrl;
}
catch (Exception e)
{
MessageBox.Show(_jiraLanguage.UploadFailure + " " + e.Message);
}
@ -200,17 +207,23 @@ namespace Greenshot.Addon.Jira
{
surface.UploadUrl = _jiraConnector.JiraBaseUri.AppendSegments("browse", jiraViewModel.Value.JiraIssue.Key).AbsoluteUri;
// Run upload in the background
new PleaseWaitForm().ShowAndWait(Description, _jiraLanguage.CommunicationWait,
async () =>
{
await _jiraConnector.AttachAsync(jiraViewModel.Value.JiraIssue.Key, surface, jiraViewModel.Value.Filename).ConfigureAwait(true);
if (!string.IsNullOrEmpty(jiraViewModel.Value.Comment))
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory())
{
ownedPleaseWaitForm.Value.ShowAndWait(Description, _jiraLanguage.CommunicationWait,
async () =>
{
await _jiraConnector.AddCommentAsync(jiraViewModel.Value.JiraIssue.Key, jiraViewModel.Value.Comment).ConfigureAwait(true);
await _jiraConnector.AttachAsync(jiraViewModel.Value.JiraIssue.Key, surface,
jiraViewModel.Value.Filename).ConfigureAwait(true);
if (!string.IsNullOrEmpty(jiraViewModel.Value.Comment))
{
await _jiraConnector.AddCommentAsync(jiraViewModel.Value.JiraIssue.Key,
jiraViewModel.Value.Comment).ConfigureAwait(true);
}
}
}
);
);
}
Log.Debug().WriteLine("Uploaded to Jira {0}", jiraViewModel.Value.JiraIssue.Key);
exportInformation.ExportMade = true;
exportInformation.Uri = surface.UploadUrl;

View file

@ -24,15 +24,15 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="Fody" version="3.0.3" targetFramework="net46" developmentDependency="true" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net46" />
<package id="Svg" version="2.3.0" targetFramework="net46" />

View file

@ -32,6 +32,7 @@ using System.Drawing.Imaging;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows.Forms;
using Dapplo.HttpExtensions;
using Dapplo.Ini;
using Dapplo.Log;
using Dapplo.Windows.Common.Extensions;
@ -1999,12 +2000,34 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
if (e.Data.GetDataPresent("Text"))
{
var possibleUrl = ClipboardHelper.GetText(e.Data);
try
{
if (possibleUrl != null && possibleUrl.StartsWith("http"))
{
var uri = new Uri(possibleUrl);
using (var image = uri.GetAsAsync<Bitmap>().Result)
{
if (image != null)
{
AddImageContainer(image, mouse.X, mouse.Y);
return;
}
}
}
}
catch (Exception ex)
{
Log.Error().WriteLine(ex, "Couldn't download url {0}", possibleUrl);
}
// Test if it's an url and try to download the image so we have it in the original form
if (possibleUrl != null && possibleUrl.StartsWith("http"))
{
using (var image = NetworkHelper.DownloadBitmap(possibleUrl))
{
if (image != null)
var uri = new Uri(possibleUrl);
using (var image = uri.GetAsAsync<Bitmap>().Result)
{
if (image != null)
{
AddImageContainer(image, mouse.X, mouse.Y);
return;

View file

@ -61,6 +61,9 @@
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.46.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.46\lib\net46\Dapplo.CaliburnMicro.Translations.dll</HintPath>
</Reference>
<Reference Include="Dapplo.HttpExtensions, Version=0.8.35.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.35\lib\net46\Dapplo.HttpExtensions.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
</Reference>
@ -76,35 +79,35 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Clipboard, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Clipboard.0.5.60\lib\net46\Dapplo.Windows.Clipboard.dll</HintPath>
<Reference Include="Dapplo.Windows.Clipboard, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Clipboard.0.5.61\lib\net46\Dapplo.Windows.Clipboard.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="PresentationCore" />
@ -114,11 +117,13 @@
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Reactive, Version=4.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reactive.4.0.0\lib\net46\System.Reactive.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Caching" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

View file

@ -14,20 +14,21 @@
<package id="Dapplo.CaliburnMicro.Menu" version="1.0.46" targetFramework="net46" />
<package id="Dapplo.CaliburnMicro.Security" version="1.0.46" targetFramework="net46" />
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.46" targetFramework="net46" />
<package id="Dapplo.HttpExtensions" version="0.8.35" targetFramework="net46" />
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net46" />
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Clipboard" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Clipboard" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -106,32 +106,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.6.4\lib\net46\MahApps.Metro.dll</HintPath>

View file

@ -24,6 +24,7 @@ using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autofac.Features.OwnedInstances;
using Dapplo.Addons;
using Dapplo.Log;
using Greenshot.Addon.Lutim.Entities;
@ -46,19 +47,22 @@ namespace Greenshot.Addon.Lutim {
private readonly ILutimLanguage _lutimLanguage;
private readonly LutimApi _lutimApi;
private readonly IResourceProvider _resourceProvider;
private readonly Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
public LutimDestination(ILutimConfiguration lutimConfiguration,
ILutimLanguage lutimLanguage,
LutimApi lutimApi,
IResourceProvider resourceProvider,
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage
IGreenshotLanguage greenshotLanguage,
Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> pleaseWaitFormFactory
) : base(coreConfiguration, greenshotLanguage)
{
_lutimConfiguration = lutimConfiguration;
_lutimLanguage = lutimLanguage;
_lutimApi = lutimApi;
_resourceProvider = resourceProvider;
_pleaseWaitFormFactory = pleaseWaitFormFactory;
}
public override string Description => _lutimLanguage.UploadMenuItem;
@ -90,9 +94,7 @@ namespace Greenshot.Addon.Lutim {
/// <summary>
/// Upload the capture to lutim
/// </summary>
/// <param name="captureDetails">ICaptureDetails</param>
/// <param name="surfaceToUpload">ISurface</param>
/// <param name="uploadUrl">out string for the url</param>
/// <returns>true if the upload succeeded</returns>
private async Task<string> Upload(ISurface surfaceToUpload)
{
@ -102,9 +104,9 @@ namespace Greenshot.Addon.Lutim {
LutimInfo lutimInfo;
var cancellationTokenSource = new CancellationTokenSource();
using (var pleaseWaitForm = new PleaseWaitForm("Lutim", _lutimLanguage.CommunicationWait, cancellationTokenSource))
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory("Lutim", _lutimLanguage.CommunicationWait, cancellationTokenSource))
{
pleaseWaitForm.Show();
ownedPleaseWaitForm.Value.Show();
try
{
lutimInfo = await _lutimApi.UploadToLutim(surfaceToUpload).ConfigureAwait(true);
@ -121,7 +123,7 @@ namespace Greenshot.Addon.Lutim {
}
finally
{
pleaseWaitForm.Close();
ownedPleaseWaitForm.Value.Close();
}
}

View file

@ -22,15 +22,15 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="MahApps.Metro" version="1.6.4" targetFramework="net46" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />

View file

@ -97,32 +97,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />

View file

@ -19,14 +19,14 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -84,35 +84,35 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Com, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Com.0.5.60\lib\net46\Dapplo.Windows.Com.dll</HintPath>
<Reference Include="Dapplo.Windows.Com, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Com.0.5.61\lib\net46\Dapplo.Windows.Com.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View file

@ -20,16 +20,16 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Com" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Com" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="Fody" version="3.0.3" targetFramework="net46" developmentDependency="true" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -31,6 +31,7 @@ using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autofac.Features.OwnedInstances;
using Dapplo.Addons;
using Dapplo.HttpExtensions;
using Dapplo.HttpExtensions.JsonNet;
@ -60,6 +61,7 @@ namespace Greenshot.Addon.OneDrive
private readonly IOneDriveConfiguration _oneDriveConfiguration;
private readonly IOneDriveLanguage _oneDriveLanguage;
private readonly IResourceProvider _resourceProvider;
private readonly Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
private readonly OAuth2Settings _oauth2Settings;
private static readonly Uri GraphUri = new Uri("https://graph.microsoft.com");
private static readonly Uri OneDriveUri = GraphUri.AppendSegments("v1.0", "me", "drive");
@ -72,6 +74,7 @@ namespace Greenshot.Addon.OneDrive
IOneDriveLanguage oneDriveLanguage,
INetworkConfiguration networkConfiguration,
IResourceProvider resourceProvider,
Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> pleaseWaitFormFactory,
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage
) : base(coreConfiguration, greenshotLanguage)
@ -79,6 +82,7 @@ namespace Greenshot.Addon.OneDrive
_oneDriveConfiguration = oneDriveConfiguration;
_oneDriveLanguage = oneDriveLanguage;
_resourceProvider = resourceProvider;
_pleaseWaitFormFactory = pleaseWaitFormFactory;
// Configure the OAuth2 settings for OneDrive communication
_oauth2Settings = new OAuth2Settings
{
@ -147,10 +151,9 @@ namespace Greenshot.Addon.OneDrive
Uri response;
var cancellationTokenSource = new CancellationTokenSource();
using (var pleaseWaitForm = new PleaseWaitForm("OneDrive plug-in", _oneDriveLanguage.CommunicationWait,
cancellationTokenSource))
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory("OneDrive", _oneDriveLanguage.CommunicationWait, cancellationTokenSource))
{
pleaseWaitForm.Show();
ownedPleaseWaitForm.Value.Show();
try
{
var oneDriveResponse = await UploadToOneDriveAsync(_oauth2Settings, surfaceToUpload, null, cancellationTokenSource.Token);
@ -168,7 +171,7 @@ namespace Greenshot.Addon.OneDrive
}
finally
{
pleaseWaitForm.Close();
ownedPleaseWaitForm.Value.Close();
}
}

View file

@ -103,32 +103,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />

View file

@ -21,14 +21,14 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -29,6 +29,7 @@ using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autofac.Features.OwnedInstances;
using Dapplo.Addons;
using Dapplo.Log;
using Greenshot.Addon.Tfs.Entities;
@ -53,6 +54,7 @@ namespace Greenshot.Addon.Tfs
private readonly ITfsConfiguration _tfsConfiguration;
private readonly ITfsLanguage _tfsLanguage;
private readonly TfsClient _tfsClient;
private readonly Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
private readonly IResourceProvider _resourceProvider;
private readonly WorkItem _workItem;
@ -62,11 +64,13 @@ namespace Greenshot.Addon.Tfs
ITfsConfiguration tfsConfiguration,
ITfsLanguage tfsLanguage,
TfsClient tfsClient,
Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> pleaseWaitFormFactory,
IResourceProvider resourceProvider) : base(coreConfiguration, greenshotLanguage)
{
_tfsConfiguration = tfsConfiguration;
_tfsLanguage = tfsLanguage;
_tfsClient = tfsClient;
_pleaseWaitFormFactory = pleaseWaitFormFactory;
_resourceProvider = resourceProvider;
}
@ -76,8 +80,9 @@ namespace Greenshot.Addon.Tfs
ITfsConfiguration tfsConfiguration,
ITfsLanguage tfsLanguage,
TfsClient tfsClient,
Func<string, string, CancellationTokenSource, Owned<PleaseWaitForm>> pleaseWaitFormFactory,
IResourceProvider resourceProvider,
WorkItem workItem) :this(coreConfiguration, greenshotLanguage, tfsConfiguration, tfsLanguage, tfsClient, resourceProvider)
WorkItem workItem) :this(coreConfiguration, greenshotLanguage, tfsConfiguration, tfsLanguage, tfsClient, pleaseWaitFormFactory, resourceProvider)
{
_workItem = workItem;
}
@ -108,7 +113,7 @@ namespace Greenshot.Addon.Tfs
}
foreach (var workitem in workitems)
{
yield return new TfsDestination(CoreConfiguration, GreenshotLanguage, _tfsConfiguration, _tfsLanguage, _tfsClient, _resourceProvider, workitem);
yield return new TfsDestination(CoreConfiguration, GreenshotLanguage, _tfsConfiguration, _tfsLanguage, _tfsClient, _pleaseWaitFormFactory, _resourceProvider, workitem);
}
}
@ -171,10 +176,9 @@ namespace Greenshot.Addon.Tfs
Uri response;
var cancellationTokenSource = new CancellationTokenSource();
using (var pleaseWaitForm = new PleaseWaitForm("TFS plug-in", _tfsLanguage.CommunicationWait,
cancellationTokenSource))
using (var ownedPleaseWaitForm = _pleaseWaitFormFactory("TFS plug-in", _tfsLanguage.CommunicationWait, cancellationTokenSource))
{
pleaseWaitForm.Show();
ownedPleaseWaitForm.Value.Show();
try
{
var result = await _tfsClient.CreateAttachment(surfaceToUpload);
@ -183,7 +187,7 @@ namespace Greenshot.Addon.Tfs
}
finally
{
pleaseWaitForm.Close();
ownedPleaseWaitForm.Value.Close();
}
}

View file

@ -81,32 +81,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="PresentationCore" />

View file

@ -15,14 +15,14 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
</packages>

View file

@ -24,6 +24,7 @@
using Autofac;
using Dapplo.Addons;
using Greenshot.Addons.Components;
using Greenshot.Addons.Controls;
using Greenshot.Addons.ViewModels;
namespace Greenshot.Addons
@ -39,6 +40,10 @@ namespace Greenshot.Addons
builder
.RegisterType<DestinationHolder>()
.AsSelf();
builder
.RegisterType<PleaseWaitForm>()
.AsSelf();
base.Load(builder);
}

View file

@ -1,92 +0,0 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Greenshot.Addons.Controls {
partial class OAuthLoginForm {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this._addressTextBox = new System.Windows.Forms.TextBox();
this._browser = new ExtendedWebBrowser();
this.SuspendLayout();
//
// _addressTextBox
//
this._addressTextBox.Cursor = System.Windows.Forms.Cursors.Arrow;
this._addressTextBox.Dock = System.Windows.Forms.DockStyle.Top;
this._addressTextBox.Enabled = false;
this._addressTextBox.Location = new System.Drawing.Point(0, 0);
this._addressTextBox.Name = "addressTextBox";
this._addressTextBox.Size = new System.Drawing.Size(595, 20);
this._addressTextBox.TabIndex = 3;
this._addressTextBox.TabStop = false;
//
// _browser
//
this._browser.Dock = System.Windows.Forms.DockStyle.Fill;
this._browser.Location = new System.Drawing.Point(0, 20);
this._browser.MinimumSize = new System.Drawing.Size(100, 100);
this._browser.Name = "browser";
this._browser.Size = new System.Drawing.Size(595, 295);
this._browser.TabIndex = 4;
//
// OAuthLoginForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(595, 315);
this.Controls.Add(this._browser);
this.Controls.Add(this._addressTextBox);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "OAuthLoginForm";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox _addressTextBox;
private ExtendedWebBrowser _browser;
}
}

View file

@ -1,105 +0,0 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Dapplo.Log;
using Dapplo.Windows.Desktop;
using Greenshot.Addons.Core;
namespace Greenshot.Addons.Controls {
/// <summary>
/// The OAuthLoginForm is used to allow the user to authorize Greenshot with an "Oauth" application
/// </summary>
public sealed partial class OAuthLoginForm : Form {
private static readonly LogSource Log = new LogSource();
private readonly string _callbackUrl;
private IDictionary<string, string> _callbackParameters;
public IDictionary<string, string> CallbackParameters => _callbackParameters;
public bool IsOk => DialogResult == DialogResult.OK;
public OAuthLoginForm(string browserTitle, Size size, string authorizationLink, string callbackUrl) {
// Make sure Greenshot uses the correct browser version
IEHelper.FixBrowserVersion(false);
_callbackUrl = callbackUrl;
// Fix for BUG-2071
if (callbackUrl.EndsWith("/"))
{
_callbackUrl = callbackUrl.Substring(0, callbackUrl.Length - 1);
}
InitializeComponent();
ClientSize = size;
Icon = GreenshotResources.GetGreenshotIcon();
Text = browserTitle;
_addressTextBox.Text = authorizationLink;
// The script errors are suppressed by using the ExtendedWebBrowser
_browser.ScriptErrorsSuppressed = false;
_browser.DocumentCompleted += Browser_DocumentCompleted;
_browser.Navigated += Browser_Navigated;
_browser.Navigating += Browser_Navigating;
_browser.Navigate(new Uri(authorizationLink));
}
/// <summary>
/// Make sure the form is visible
/// </summary>
/// <param name="e">EventArgs</param>
protected override async void OnShown(EventArgs e) {
base.OnShown(e);
await InteropWindowFactory.CreateFor(Handle).ToForegroundAsync();
}
private void Browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) {
Log.Debug().WriteLine("document completed with url: {0}", _browser.Url);
CheckUrl();
}
private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) {
Log.Debug().WriteLine("Navigating to url: {0}", _browser.Url);
_addressTextBox.Text = e.Url.ToString();
}
private void Browser_Navigated(object sender, WebBrowserNavigatedEventArgs e) {
Log.Debug().WriteLine("Navigated to url: {0}", _browser.Url);
CheckUrl();
}
private void CheckUrl() {
if (_browser.Url.ToString().StartsWith(_callbackUrl)) {
var correctedUri = new Uri(_browser.Url.AbsoluteUri.Replace("#", "&"));
string queryParams = correctedUri.Query;
if (queryParams.Length > 0) {
queryParams = NetworkHelper.UrlDecode(queryParams);
//Store the Token and Token Secret
_callbackParameters = NetworkHelper.ParseQueryString(queryParams);
}
DialogResult = DialogResult.OK;
}
}
}
}

View file

@ -39,7 +39,9 @@ namespace Greenshot.Addons.Controls
/// </summary>
public sealed partial class PleaseWaitForm : Form
{
/// <summary>
private readonly IGreenshotLanguage _greenshotLanguage;
/// <summary>
/// Prevent the close-window button showing
/// </summary>
private const int CP_NOCLOSE_BUTTON = 0x200;
@ -49,16 +51,20 @@ namespace Greenshot.Addons.Controls
private readonly CancellationTokenSource _cancellationTokenSource;
private Thread _waitFor;
public PleaseWaitForm()
public PleaseWaitForm(IGreenshotLanguage greenshotLanguage)
{
//
_greenshotLanguage = greenshotLanguage;
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
Icon = GreenshotResources.GetGreenshotIcon();
}
public PleaseWaitForm(string title, string text, CancellationTokenSource cancellationTokenSource = default) : this()
public PleaseWaitForm(IGreenshotLanguage greenshotLanguage,
string title,
string text,
CancellationTokenSource cancellationTokenSource = default) : this(greenshotLanguage)
{
_title = title;
_cancellationTokenSource = cancellationTokenSource;
@ -88,7 +94,7 @@ namespace Greenshot.Addons.Controls
_title = title;
Text = title;
label_pleasewait.Text = text;
cancelButton.Text = Language.GetString("CANCEL");
cancelButton.Text = _greenshotLanguage.Cancel;
Show();
await executeTask;
@ -107,10 +113,10 @@ namespace Greenshot.Addons.Controls
_title = title;
Text = title;
label_pleasewait.Text = text;
cancelButton.Text = Language.GetString("CANCEL");
cancelButton.Text = _greenshotLanguage.Cancel;
// Make sure the form is shown.
Show();
// Make sure the form is shown.
Show();
// Variable to store the exception, if one is generated, from inside the thread.
Exception threadException = null;
@ -140,6 +146,7 @@ namespace Greenshot.Addons.Controls
// Wait until finished
while (!_waitFor.Join(TimeSpan.FromMilliseconds(100)))
{
// TODO: Remove this please!!!!
Application.DoEvents();
}
Log.Debug().WriteLine("Finished {0}", title);

View file

@ -1,913 +0,0 @@
#region Greenshot GNU General Public License
// Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
//
// For more information see: http://getgreenshot.org/
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#endregion
#region Usings
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using Dapplo.Ini;
using Dapplo.Log;
using Greenshot.Addons.Interfaces;
using Greenshot.Addons.Interfaces.Plugin;
using Greenshot.Gfx;
#endregion
namespace Greenshot.Addons.Core
{
/// <summary>
/// HTTP Method to make sure we have the correct method
/// </summary>
public enum HTTPMethod
{
GET,
POST,
PUT,
DELETE,
HEAD
}
/// <summary>
/// Description of NetworkHelper.
/// </summary>
public static class NetworkHelper
{
private static readonly LogSource Log = new LogSource();
private static readonly ICoreConfiguration Config = IniConfig.Current.Get<ICoreConfiguration>();
static NetworkHelper()
{
try
{
// Disable certificate checking
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;
}
catch (Exception ex)
{
Log.Warn().WriteLine(ex, "An error has occured while allowing self-signed certificates:");
}
}
/// <summary>
/// Download a uri response as string
/// </summary>
/// <param name="uri">An Uri to specify the download location</param>
/// <returns>string with the file content</returns>
public static string GetAsString(Uri uri)
{
return GetResponseAsString(CreateWebRequest(uri));
}
/// <summary>
/// Download the FavIcon as a Bitmap
/// </summary>
/// <param name="baseUri"></param>
/// <returns>Bitmap with the FavIcon</returns>
public static Bitmap DownloadFavIcon(Uri baseUri)
{
var url = new Uri(baseUri, new Uri("favicon.ico"));
try
{
var request = CreateWebRequest(url);
using (var response = (HttpWebResponse) request.GetResponse())
{
if (request.HaveResponse)
{
using (var responseStream = response.GetResponseStream())
{
if (responseStream != null)
{
using (var image = BitmapHelper.FromStream(responseStream))
{
return image.Height > 16 && image.Width > 16 ? new Bitmap(image, 16, 16) : new Bitmap(image);
}
}
}
}
}
}
catch (Exception e)
{
Log.Error().WriteLine(e, "Problem downloading the FavIcon from: " + baseUri);
}
return null;
}
/// <summary>
/// Download the uri into a memorystream, without catching exceptions
/// </summary>
/// <param name="url">Of an image</param>
/// <returns>MemoryStream which is already seeked to 0</returns>
public static MemoryStream GetAsMemoryStream(string url)
{
var request = CreateWebRequest(url);
using (var response = (HttpWebResponse) request.GetResponse())
{
var memoryStream = new MemoryStream();
using (var responseStream = response.GetResponseStream())
{
responseStream?.CopyTo(memoryStream);
// Make sure it can be used directly
memoryStream.Seek(0, SeekOrigin.Begin);
}
return memoryStream;
}
}
/// <summary>
/// Download the uri to Bitmap
/// </summary>
/// <param name="url">Of an image</param>
/// <returns>Bitmap</returns>
public static Bitmap DownloadBitmap(string url)
{
var extensions = new StringBuilder();
foreach (var extension in BitmapHelper.StreamConverters.Keys)
{
if (string.IsNullOrEmpty(extension))
{
continue;
}
extensions.AppendFormat(@"\.{0}|", extension);
}
extensions.Length--;
var imageUrlRegex = new Regex($@"(http|https)://.*(?<extension>{extensions})");
var match = imageUrlRegex.Match(url);
try
{
using (var memoryStream = GetAsMemoryStream(url))
{
try
{
return BitmapHelper.FromStream(memoryStream, match.Success ? match.Groups["extension"]?.Value : null);
}
catch (Exception)
{
// If we arrive here, the image loading didn't work, try to see if the response has a http(s) URL to an image and just take this instead.
string content;
using (var streamReader = new StreamReader(memoryStream, Encoding.UTF8, true))
{
content = streamReader.ReadLine();
}
if (string.IsNullOrEmpty(content))
{
throw;
}
match = imageUrlRegex.Match(content);
if (!match.Success)
{
throw;
}
using (var memoryStream2 = GetAsMemoryStream(match.Value))
{
return BitmapHelper.FromStream(memoryStream2, match.Groups["extension"]?.Value);
}
}
}
}
catch (Exception e)
{
Log.Error().WriteLine(e, "Problem downloading the image from: " + url);
}
return null;
}
/// <summary>
/// Helper method to create a web request with a lot of default settings
/// </summary>
/// <param name="uri">string with uri to connect to</param>
/// <returns>WebRequest</returns>
public static HttpWebRequest CreateWebRequest(string uri)
{
return CreateWebRequest(new Uri(uri));
}
/// <summary>
/// Helper method to create a web request with a lot of default settings
/// </summary>
/// <param name="uri">string with uri to connect to</param>
/// ///
/// <param name="method">Method to use</param>
/// <returns>WebRequest</returns>
public static HttpWebRequest CreateWebRequest(string uri, HTTPMethod method)
{
return CreateWebRequest(new Uri(uri), method);
}
/// <summary>
/// Helper method to create a web request with a lot of default settings
/// </summary>
/// <param name="uri">Uri with uri to connect to</param>
/// <param name="method">Method to use</param>
/// <returns>WebRequest</returns>
public static HttpWebRequest CreateWebRequest(Uri uri, HTTPMethod method)
{
var webRequest = CreateWebRequest(uri);
webRequest.Method = method.ToString();
return webRequest;
}
/// <summary>
/// Helper method to create a web request, eventually with proxy
/// </summary>
/// <param name="uri">Uri with uri to connect to</param>
/// <returns>WebRequest</returns>
public static HttpWebRequest CreateWebRequest(Uri uri)
{
var webRequest = (HttpWebRequest) WebRequest.Create(uri);
webRequest.Proxy = Config.UseProxy ? CreateProxy(uri) : null;
// Make sure the default credentials are available
webRequest.Credentials = CredentialCache.DefaultCredentials;
// Allow redirect, this is usually needed so that we don't get a problem when a service moves
webRequest.AllowAutoRedirect = true;
// Set default timeouts
webRequest.Timeout = Config.WebRequestTimeout * 1000;
webRequest.ReadWriteTimeout = Config.WebRequestReadWriteTimeout * 1000;
return webRequest;
}
/// <summary>
/// Create a IWebProxy Object which can be used to access the Internet
/// This method will check the configuration if the proxy is allowed to be used.
/// Usages can be found in the DownloadFavIcon or Jira and Confluence plugins
/// </summary>
/// <param name="uri"></param>
/// <returns>IWebProxy filled with all the proxy details or null if none is set/wanted</returns>
public static IWebProxy CreateProxy(Uri uri)
{
if (!Config.UseProxy)
{
return null;
}
IWebProxy proxyToUse = WebRequest.DefaultWebProxy;
if (proxyToUse != null)
{
proxyToUse.Credentials = CredentialCache.DefaultCredentials;
if (!Log.IsDebugEnabled())
{
return proxyToUse;
}
// check the proxy for the Uri
if (!proxyToUse.IsBypassed(uri))
{
var proxyUri = proxyToUse.GetProxy(uri);
if (proxyUri != null)
{
Log.Debug().WriteLine("Using proxy: " + proxyUri + " for " + uri);
}
else
{
Log.Debug().WriteLine("No proxy found!");
}
}
else
{
Log.Debug().WriteLine("Proxy bypass for: " + uri);
}
}
else
{
Log.Debug().WriteLine("No proxy found!");
}
return proxyToUse;
}
/// <summary>
/// UrlEncodes a string without the requirement for System.Web
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
// [Obsolete("Use System.Uri.EscapeDataString instead")]
public static string UrlEncode(string text)
{
if (string.IsNullOrEmpty(text))
{
return null;
}
// Sytem.Uri provides reliable parsing, but doesn't encode spaces.
return Uri.EscapeDataString(text).Replace("%20", "+");
}
/// <summary>
/// A wrapper around the EscapeDataString, as the limit is 32766 characters
/// See: http://msdn.microsoft.com/en-us/library/system.uri.escapedatastring%28v=vs.110%29.aspx
/// </summary>
/// <param name="text"></param>
/// <returns>escaped data string</returns>
public static string EscapeDataString(string text)
{
if (string.IsNullOrEmpty(text))
{
return null;
}
var result = new StringBuilder();
var currentLocation = 0;
while (currentLocation < text.Length)
{
var process = text.Substring(currentLocation, Math.Min(16384, text.Length - currentLocation));
result.Append(Uri.EscapeDataString(process));
currentLocation = currentLocation + 16384;
}
return result.ToString();
}
/// <summary>
/// UrlDecodes a string without requiring System.Web
/// </summary>
/// <param name="text">String to decode.</param>
/// <returns>decoded string</returns>
public static string UrlDecode(string text)
{
// pre-process for + sign space formatting since System.Uri doesn't handle it
// plus literals are encoded as %2b normally so this should be safe
text = text.Replace("+", " ");
return Uri.UnescapeDataString(text);
}
/// <summary>
/// ParseQueryString without the requirement for System.Web
/// </summary>
/// <param name="queryString"></param>
/// <returns>IDictionary string, string</returns>
public static IDictionary<string, string> ParseQueryString(string queryString)
{
IDictionary<string, string> parameters = new SortedDictionary<string, string>();
// remove anything other than query string from uri
if (queryString.Contains("?"))
{
queryString = queryString.Substring(queryString.IndexOf('?') + 1);
}
foreach (var vp in Regex.Split(queryString, "&"))
{
if (string.IsNullOrEmpty(vp))
{
continue;
}
var singlePair = Regex.Split(vp, "=");
if (parameters.ContainsKey(singlePair[0]))
{
parameters.Remove(singlePair[0]);
}
parameters.Add(singlePair[0], singlePair.Length == 2 ? singlePair[1] : string.Empty);
}
return parameters;
}
/// <summary>
/// Generate the query paramters
/// </summary>
/// <param name="queryParameters">the list of query parameters</param>
/// <returns>a string with the query parameters</returns>
public static string GenerateQueryParameters(IDictionary<string, object> queryParameters)
{
if (queryParameters == null || queryParameters.Count == 0)
{
return string.Empty;
}
queryParameters = new SortedDictionary<string, object>(queryParameters);
var sb = new StringBuilder();
foreach (var key in queryParameters.Keys)
{
sb.AppendFormat(CultureInfo.InvariantCulture, "{0}={1}&", key, UrlEncode($"{queryParameters[key]}"));
}
sb.Remove(sb.Length - 1, 1);
return sb.ToString();
}
/// <summary>
/// Write Multipart Form Data directly to the HttpWebRequest
/// </summary>
/// <param name="webRequest">HttpWebRequest to write the multipart form data to</param>
/// <param name="postParameters">Parameters to include in the multipart form data</param>
public static void WriteMultipartFormData(HttpWebRequest webRequest, IDictionary<string, object> postParameters)
{
string boundary = $"----------{Guid.NewGuid():N}";
webRequest.ContentType = "multipart/form-data; boundary=" + boundary;
using (var formDataStream = webRequest.GetRequestStream())
{
WriteMultipartFormData(formDataStream, boundary, postParameters);
}
}
/// <summary>
/// Write Multipart Form Data to the HttpListenerResponse
/// </summary>
/// <param name="response">HttpListenerResponse</param>
/// <param name="postParameters">Parameters to include in the multipart form data</param>
public static void WriteMultipartFormData(HttpListenerResponse response, IDictionary<string, object> postParameters)
{
string boundary = $"----------{Guid.NewGuid():N}";
response.ContentType = "multipart/form-data; boundary=" + boundary;
WriteMultipartFormData(response.OutputStream, boundary, postParameters);
}
/// <summary>
/// Write Multipart Form Data to a Stream, content-type should be set before this!
/// </summary>
/// <param name="formDataStream">Stream to write the multipart form data to</param>
/// <param name="boundary">String boundary for the multipart/form-data</param>
/// <param name="postParameters">Parameters to include in the multipart form data</param>
public static void WriteMultipartFormData(Stream formDataStream, string boundary, IDictionary<string, object> postParameters)
{
var needsClrf = false;
foreach (var param in postParameters)
{
// Add a CRLF to allow multiple parameters to be added.
// Skip it on the first parameter, add it to subsequent parameters.
if (needsClrf)
{
formDataStream.Write(Encoding.UTF8.GetBytes("\r\n"), 0, Encoding.UTF8.GetByteCount("\r\n"));
}
needsClrf = true;
var binaryContainer = param.Value as IBinaryContainer;
if (binaryContainer != null)
{
binaryContainer.WriteFormDataToStream(boundary, param.Key, formDataStream);
}
else
{
string postData = $"--{boundary}\r\nContent-Disposition: form-data; name=\"{param.Key}\"\r\n\r\n{param.Value}";
formDataStream.Write(Encoding.UTF8.GetBytes(postData), 0, Encoding.UTF8.GetByteCount(postData));
}
}
// Add the end of the request. Start with a newline
var footer = "\r\n--" + boundary + "--\r\n";
formDataStream.Write(Encoding.UTF8.GetBytes(footer), 0, Encoding.UTF8.GetByteCount(footer));
}
/// <summary>
/// Post the parameters "x-www-form-urlencoded"
/// </summary>
/// <param name="webRequest"></param>
/// <param name="parameters"></param>
public static void UploadFormUrlEncoded(HttpWebRequest webRequest, IDictionary<string, object> parameters)
{
webRequest.ContentType = "application/x-www-form-urlencoded";
var urlEncoded = GenerateQueryParameters(parameters);
var data = Encoding.UTF8.GetBytes(urlEncoded);
using (var requestStream = webRequest.GetRequestStream())
{
requestStream.Write(data, 0, data.Length);
}
}
/// <summary>
/// Log the headers of the WebResponse, if IsDebugEnabled
/// </summary>
/// <param name="response">WebResponse</param>
private static void DebugHeaders(WebResponse response)
{
if (!Log.IsDebugEnabled())
{
return;
}
Log.Debug().WriteLine("Debug information on the response from {0} :", response.ResponseUri);
foreach (var key in response.Headers.AllKeys)
{
Log.Debug().WriteLine("Reponse-header: {0}={1}", key, response.Headers[key]);
}
}
/// <summary>
/// Process the web response.
/// </summary>
/// <param name="webRequest">The request object.</param>
/// <returns>The response data.</returns>
/// TODO: This method should handle the StatusCode better!
public static string GetResponseAsString(HttpWebRequest webRequest)
{
return GetResponseAsString(webRequest, false);
}
/// <summary>
/// Read the response as string
/// </summary>
/// <param name="response"></param>
/// <returns>string or null</returns>
private static string GetResponseAsString(HttpWebResponse response)
{
if (response == null)
{
return null;
}
using (response)
{
var responseStream = response.GetResponseStream();
if (responseStream == null)
{
return null;
}
using (var reader = new StreamReader(responseStream, true))
{
return reader.ReadToEnd();
}
}
}
/// <summary>
/// </summary>
/// <param name="webRequest"></param>
/// <param name="alsoReturnContentOnError"></param>
/// <returns></returns>
public static string GetResponseAsString(HttpWebRequest webRequest, bool alsoReturnContentOnError)
{
string responseData = null;
HttpWebResponse response = null;
var isHttpError = false;
try
{
response = (HttpWebResponse) webRequest.GetResponse();
Log.Info().WriteLine("Response status: {0}", response.StatusCode);
isHttpError = (int) response.StatusCode >= 300;
if (isHttpError)
{
Log.Error().WriteLine("HTTP error {0}", response.StatusCode);
}
DebugHeaders(response);
responseData = GetResponseAsString(response);
if (isHttpError)
{
Log.Error().WriteLine("HTTP response {0}", responseData);
}
}
catch (WebException e)
{
response = (HttpWebResponse) e.Response;
var statusCode = HttpStatusCode.Unused;
if (response != null)
{
statusCode = response.StatusCode;
Log.Error().WriteLine("HTTP error {0}", statusCode);
var errorContent = GetResponseAsString(response);
if (alsoReturnContentOnError)
{
return errorContent;
}
Log.Error().WriteLine("Content: {0}", errorContent);
}
Log.Error().WriteLine(e, "WebException: ");
if (statusCode == HttpStatusCode.Unauthorized)
{
throw new UnauthorizedAccessException(e.Message);
}
throw;
}
finally
{
if (response != null)
{
if (isHttpError)
{
Log.Error().WriteLine("HTTP error {0} with content: {1}", response.StatusCode, responseData);
}
response.Close();
}
}
return responseData;
}
/// <summary>
/// Get LastModified for a URI
/// </summary>
/// <param name="uri">Uri</param>
/// <returns>DateTime</returns>
public static DateTime GetLastModified(Uri uri)
{
try
{
var webRequest = CreateWebRequest(uri);
webRequest.Method = HTTPMethod.HEAD.ToString();
using (var webResponse = (HttpWebResponse) webRequest.GetResponse())
{
Log.Debug().WriteLine("RSS feed was updated at {0}", webResponse.LastModified);
return webResponse.LastModified;
}
}
catch (Exception wE)
{
Log.Warn().WriteLine("Problem requesting HTTP - HEAD on uri {0}", uri);
Log.Warn().WriteLine(wE.Message);
// Pretend it is old
return DateTime.MinValue;
}
}
}
/// <summary>
/// This interface can be used to pass binary information around, like byte[] or Image
/// </summary>
public interface IBinaryContainer
{
string ContentType { get; }
string Filename { get; set; }
void WriteFormDataToStream(string boundary, string name, Stream formDataStream);
void WriteToStream(Stream formDataStream);
string ToBase64String(Base64FormattingOptions formattingOptions);
byte[] ToByteArray();
void Upload(HttpWebRequest webRequest);
}
/// <summary>
/// A container to supply files to a Multi-part form data upload
/// </summary>
public class ByteContainer : IBinaryContainer
{
private readonly byte[] _file;
private readonly int _fileSize;
public ByteContainer(byte[] file) : this(file, null)
{
}
public ByteContainer(byte[] file, string filename) : this(file, filename, null)
{
}
public ByteContainer(byte[] file, string filename, string contenttype) : this(file, filename, contenttype, 0)
{
}
public ByteContainer(byte[] file, string filename, string contenttype, int filesize)
{
_file = file;
Filename = filename;
ContentType = contenttype;
_fileSize = filesize == 0 ? file.Length : filesize;
}
/// <summary>
/// Create a Base64String from the byte[]
/// </summary>
/// <returns>string</returns>
public string ToBase64String(Base64FormattingOptions formattingOptions)
{
return Convert.ToBase64String(_file, 0, _fileSize, formattingOptions);
}
/// <summary>
/// Returns the initial byte-array which was supplied when creating the FileParameter
/// </summary>
/// <returns>byte[]</returns>
public byte[] ToByteArray()
{
return _file;
}
/// <summary>
/// Write Multipart Form Data directly to the HttpWebRequest response stream
/// </summary>
/// <param name="boundary">Separator</param>
/// <param name="name">name</param>
/// <param name="formDataStream">Stream to write to</param>
public void WriteFormDataToStream(string boundary, string name, Stream formDataStream)
{
// Add just the first part of this param, since we will write the file data directly to the Stream
string header =
$"--{boundary}\r\nContent-Disposition: form-data; name=\"{name}\"; filename=\"{Filename ?? name}\";\r\nContent-Type: {ContentType ?? "application/octet-stream"}\r\n\r\n";
formDataStream.Write(Encoding.UTF8.GetBytes(header), 0, Encoding.UTF8.GetByteCount(header));
// Write the file data directly to the Stream, rather than serializing it to a string.
formDataStream.Write(_file, 0, _fileSize);
}
/// <summary>
/// A plain "write data to stream"
/// </summary>
/// <param name="dataStream">Stream to write to</param>
public void WriteToStream(Stream dataStream)
{
// Write the file data directly to the Stream, rather than serializing it to a string.
dataStream.Write(_file, 0, _fileSize);
}
/// <summary>
/// Upload the file to the webrequest
/// </summary>
/// <param name="webRequest"></param>
public void Upload(HttpWebRequest webRequest)
{
webRequest.ContentType = ContentType;
webRequest.ContentLength = _fileSize;
using (var requestStream = webRequest.GetRequestStream())
{
WriteToStream(requestStream);
}
}
public string ContentType { get; }
public string Filename { get; set; }
}
/// <summary>
/// A container to supply images to a Multi-part form data upload
/// </summary>
public class BitmapContainer : IBinaryContainer
{
private readonly Bitmap _bitmap;
private readonly SurfaceOutputSettings _outputSettings;
public BitmapContainer(Bitmap bitmap, SurfaceOutputSettings outputSettings, string filename)
{
_bitmap = bitmap;
_outputSettings = outputSettings;
Filename = filename;
}
/// <summary>
/// Create a Base64String from the image by saving it to a memory stream and converting it.
/// Should be avoided if possible, as this uses a lot of memory.
/// </summary>
/// <returns>string</returns>
public string ToBase64String(Base64FormattingOptions formattingOptions)
{
using (var stream = new MemoryStream())
{
ImageOutput.SaveToStream(_bitmap, null, stream, _outputSettings);
return Convert.ToBase64String(stream.GetBuffer(), 0, (int) stream.Length, formattingOptions);
}
}
/// <summary>
/// Create a byte[] from the image by saving it to a memory stream.
/// Should be avoided if possible, as this uses a lot of memory.
/// </summary>
/// <returns>byte[]</returns>
public byte[] ToByteArray()
{
using (var stream = new MemoryStream())
{
ImageOutput.SaveToStream(_bitmap, null, stream, _outputSettings);
return stream.ToArray();
}
}
/// <summary>
/// Write Multipart Form Data directly to the HttpWebRequest response stream
/// </summary>
/// <param name="boundary">Separator</param>
/// <param name="name">Name of the thing/file</param>
/// <param name="formDataStream">Stream to write to</param>
public void WriteFormDataToStream(string boundary, string name, Stream formDataStream)
{
// Add just the first part of this param, since we will write the file data directly to the Stream
string header = $"--{boundary}\r\nContent-Disposition: form-data; name=\"{name}\"; filename=\"{Filename ?? name}\";\r\nContent-Type: {ContentType}\r\n\r\n";
formDataStream.Write(Encoding.UTF8.GetBytes(header), 0, Encoding.UTF8.GetByteCount(header));
ImageOutput.SaveToStream(_bitmap, null, formDataStream, _outputSettings);
}
/// <summary>
/// A plain "write data to stream"
/// </summary>
/// <param name="dataStream"></param>
public void WriteToStream(Stream dataStream)
{
// Write the file data directly to the Stream, rather than serializing it to a string.
ImageOutput.SaveToStream(_bitmap, null, dataStream, _outputSettings);
}
/// <summary>
/// Upload the image to the webrequest
/// </summary>
/// <param name="webRequest"></param>
public void Upload(HttpWebRequest webRequest)
{
webRequest.ContentType = "image/" + _outputSettings.Format;
using (var requestStream = webRequest.GetRequestStream())
{
WriteToStream(requestStream);
}
}
public string ContentType => "image/" + _outputSettings.Format;
public string Filename { get; set; }
}
/// <summary>
/// A container to supply surfaces to a Multi-part form data upload
/// </summary>
public class SurfaceContainer : IBinaryContainer
{
private readonly SurfaceOutputSettings _outputSettings;
private readonly ISurface _surface;
public SurfaceContainer(ISurface surface, SurfaceOutputSettings outputSettings, string filename)
{
_surface = surface;
_outputSettings = outputSettings;
Filename = filename;
}
/// <summary>
/// Create a Base64String from the Surface by saving it to a memory stream and converting it.
/// Should be avoided if possible, as this uses a lot of memory.
/// </summary>
/// <returns>string</returns>
public string ToBase64String(Base64FormattingOptions formattingOptions)
{
using (var stream = new MemoryStream())
{
ImageOutput.SaveToStream(_surface, stream, _outputSettings);
return Convert.ToBase64String(stream.GetBuffer(), 0, (int) stream.Length, formattingOptions);
}
}
/// <summary>
/// Create a byte[] from the image by saving it to a memory stream.
/// Should be avoided if possible, as this uses a lot of memory.
/// </summary>
/// <returns>byte[]</returns>
public byte[] ToByteArray()
{
using (var stream = new MemoryStream())
{
ImageOutput.SaveToStream(_surface, stream, _outputSettings);
return stream.ToArray();
}
}
/// <summary>
/// Write Multipart Form Data directly to the HttpWebRequest response stream
/// </summary>
/// <param name="boundary">Multipart separator</param>
/// <param name="name">Name of the thing</param>
/// <param name="formDataStream">Stream to write to</param>
public void WriteFormDataToStream(string boundary, string name, Stream formDataStream)
{
// Add just the first part of this param, since we will write the file data directly to the Stream
string header = $"--{boundary}\r\nContent-Disposition: form-data; name=\"{name}\"; filename=\"{Filename ?? name}\";\r\nContent-Type: {ContentType}\r\n\r\n";
formDataStream.Write(Encoding.UTF8.GetBytes(header), 0, Encoding.UTF8.GetByteCount(header));
ImageOutput.SaveToStream(_surface, formDataStream, _outputSettings);
}
/// <summary>
/// A plain "write data to stream"
/// </summary>
/// <param name="dataStream"></param>
public void WriteToStream(Stream dataStream)
{
// Write the file data directly to the Stream, rather than serializing it to a string.
ImageOutput.SaveToStream(_surface, dataStream, _outputSettings);
}
/// <summary>
/// Upload the Surface as image to the webrequest
/// </summary>
/// <param name="webRequest"></param>
public void Upload(HttpWebRequest webRequest)
{
webRequest.ContentType = ContentType;
using (var requestStream = webRequest.GetRequestStream())
{
WriteToStream(requestStream);
}
}
public string ContentType => "image/" + _outputSettings.Format;
public string Filename { get; set; }
}
}

View file

@ -89,38 +89,38 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Clipboard, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Clipboard.0.5.60\lib\net46\Dapplo.Windows.Clipboard.dll</HintPath>
<Reference Include="Dapplo.Windows.Clipboard, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Clipboard.0.5.61\lib\net46\Dapplo.Windows.Clipboard.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Icons, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Icons.0.5.60\lib\net46\Dapplo.Windows.Icons.dll</HintPath>
<Reference Include="Dapplo.Windows.Icons, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Icons.0.5.61\lib\net46\Dapplo.Windows.Icons.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
@ -307,12 +307,6 @@
<Compile Include="Controls\GreenshotToolDropDownButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\OAuthLoginForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Controls\OAuthLoginForm.Designer.cs">
<DependentUpon>OAuthLoginForm.cs</DependentUpon>
</Compile>
<Compile Include="Controls\PleaseWaitForm.cs">
<SubType>Form</SubType>
</Compile>
@ -348,7 +342,6 @@
<Compile Include="Core\GreenshotResources.cs" />
<Compile Include="Core\IEHelper.cs" />
<Compile Include="Core\Language.cs" />
<Compile Include="Core\NetworkHelper.cs" />
<Compile Include="Core\ObjectExtensions.cs" />
<Compile Include="Core\PluginUtils.cs" />
<Compile Include="Core\WindowCapture.cs" />

View file

@ -22,17 +22,17 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Clipboard" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Icons" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Clipboard" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Icons" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net46" />
<package id="Svg" version="2.3.0" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />

View file

@ -64,32 +64,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="PresentationCore" />

View file

@ -15,15 +15,15 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="Svg" version="2.3.0" targetFramework="net46" />
<package id="System.Reactive" version="4.0.0" targetFramework="net46" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net46" />

View file

@ -69,32 +69,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="JeremyAnsel.ColorQuant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a5c614433db515df, processorArchitecture=MSIL">
<HintPath>..\packages\JeremyAnsel.ColorQuant.1.0.55\lib\net40\JeremyAnsel.ColorQuant.dll</HintPath>

View file

@ -18,15 +18,15 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="JeremyAnsel.ColorQuant" version="1.0.55" targetFramework="net46" />
<package id="Microsoft.CodeAnalysis.Analyzers" version="2.6.0" targetFramework="net46" developmentDependency="true" />
<package id="Microsoft.CodeAnalysis.Common" version="2.8.2" targetFramework="net46" />

View file

@ -101,32 +101,32 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.2.8.2\lib\netstandard1.3\Microsoft.CodeAnalysis.dll</HintPath>

View file

@ -20,15 +20,15 @@
<package id="Dapplo.Language" version="0.5.28" targetFramework="net46" />
<package id="Dapplo.Log" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="Microsoft.CodeAnalysis.Analyzers" version="2.6.0" targetFramework="net46" developmentDependency="true" />
<package id="Microsoft.CodeAnalysis.Common" version="2.8.2" targetFramework="net46" />
<package id="Microsoft.CodeAnalysis.CSharp" version="2.8.2" targetFramework="net46" />

View file

@ -30,11 +30,11 @@ using Dapplo.Addons;
using Dapplo.CaliburnMicro;
using Dapplo.Log;
using Dapplo.Windows.Common;
using Greenshot.Addons;
using Greenshot.Addons.Components;
using Greenshot.Addons.Controls;
using Greenshot.Addons.Core;
using Greenshot.Addons.Interfaces.Plugin;
using Greenshot.Configuration;
using Greenshot.Forms;
using Greenshot.Helpers;
@ -48,13 +48,18 @@ namespace Greenshot.Components
{
private static readonly LogSource Log = new LogSource();
private readonly ICoreConfiguration _coreConfiguration;
private readonly IGreenshotLanguage _greenshotLanguage;
private readonly WindowHandle _windowHandle;
private static HotkeyHandler _instance;
public HotkeyHandler(ICoreConfiguration coreConfiguration, WindowHandle windowHandle)
public HotkeyHandler(
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage,
WindowHandle windowHandle)
{
_instance = this;
_coreConfiguration = coreConfiguration;
_greenshotLanguage = greenshotLanguage;
_windowHandle = windowHandle;
}
@ -263,20 +268,21 @@ namespace Greenshot.Components
private bool HandleFailedHotkeyRegistration(string failedKeys)
{
var success = false;
var warningTitle = Language.GetString(LangKey.warning);
var message = string.Format(Language.GetString(LangKey.warning_hotkeys), failedKeys, IsOneDriveBlockingHotkey() ? " (OneDrive)" : "");
var dr = MessageBox.Show(MainForm.Instance, message, warningTitle, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation);
if (dr == DialogResult.Retry)
var warningTitle = _greenshotLanguage.Warning;
var message = string.Format(_greenshotLanguage.WarningHotkeys, failedKeys, IsOneDriveBlockingHotkey() ? " (OneDrive)" : "");
var dialogResult = MessageBox.Show(MainForm.Instance, message, warningTitle, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation);
switch (dialogResult)
{
Log.Debug().WriteLine("Re-trying to register hotkeys");
HotkeyControl.UnregisterHotkeys();
success = RegisterHotkeys(false);
}
else if (dr == DialogResult.Ignore)
{
Log.Debug().WriteLine("Ignoring failed hotkey registration");
HotkeyControl.UnregisterHotkeys();
success = RegisterHotkeys(true);
case DialogResult.Retry:
Log.Debug().WriteLine("Re-trying to register hotkeys");
HotkeyControl.UnregisterHotkeys();
success = RegisterHotkeys(false);
break;
case DialogResult.Ignore:
Log.Debug().WriteLine("Ignoring failed hotkey registration");
HotkeyControl.UnregisterHotkeys();
success = RegisterHotkeys(true);
break;
}
return success;
}

View file

@ -74,6 +74,7 @@ namespace Greenshot.Forms
private static readonly LogSource Log = new LogSource();
private readonly ICoreConfiguration _coreConfiguration;
private readonly IWindowManager _windowManager;
private readonly IGreenshotLanguage _greenshotLanguage;
private readonly Func<Owned<ConfigViewModel>> _configViewModelFactory;
private readonly Func<Owned<AboutForm>> _aboutFormFactory;
@ -95,6 +96,7 @@ namespace Greenshot.Forms
{
_coreConfiguration = coreConfiguration;
_windowManager = windowManager;
_greenshotLanguage = greenshotLanguage;
_configViewModelFactory = configViewModelFactory;
_aboutFormFactory = aboutFormFactory;
_destinationHolder = destinationHolder;
@ -148,8 +150,7 @@ namespace Greenshot.Forms
{
notifyIcon.BalloonTipClicked += BalloonTipClicked;
notifyIcon.BalloonTipClosed += BalloonTipClosed;
notifyIcon.ShowBalloonTip(2000, "Greenshot",
Language.GetFormattedString(LangKey.tooltip_firststart, HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.RegionHotkey)), ToolTipIcon.Info);
notifyIcon.ShowBalloonTip(2000, "Greenshot", string.Format(_greenshotLanguage.TooltipFirststart, HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.RegionHotkey)), ToolTipIcon.Info);
}
catch (Exception ex)
{
@ -602,7 +603,7 @@ namespace Greenshot.Forms
}
var allScreensBounds = WindowCapture.GetScreenBounds();
var captureScreenItem = new ToolStripMenuItem(Language.GetString(LangKey.contextmenu_capturefullscreen_all));
var captureScreenItem = new ToolStripMenuItem(_greenshotLanguage.ContextmenuCapturefullscreenAll);
captureScreenItem.Click += (o, args) => BeginInvoke((MethodInvoker) (() => CaptureHelper.CaptureFullscreen(false, ScreenCaptureMode.FullScreen)));
captureScreenMenuItem.DropDownItems.Add(captureScreenItem);
foreach (var screen in Screen.AllScreens)
@ -611,19 +612,19 @@ namespace Greenshot.Forms
var deviceAlignment = "";
if (screen.Bounds.Top == allScreensBounds.Top && screen.Bounds.Bottom != allScreensBounds.Bottom)
{
deviceAlignment += " " + Language.GetString(LangKey.contextmenu_capturefullscreen_top);
deviceAlignment += " " + _greenshotLanguage.ContextmenuCapturefullscreenTop;
}
else if (screen.Bounds.Top != allScreensBounds.Top && screen.Bounds.Bottom == allScreensBounds.Bottom)
{
deviceAlignment += " " + Language.GetString(LangKey.contextmenu_capturefullscreen_bottom);
deviceAlignment += " " + _greenshotLanguage.ContextmenuCapturefullscreenBottom;
}
if (screen.Bounds.Left == allScreensBounds.Left && screen.Bounds.Right != allScreensBounds.Right)
{
deviceAlignment += " " + Language.GetString(LangKey.contextmenu_capturefullscreen_left);
deviceAlignment += " " + _greenshotLanguage.ContextmenuCapturefullscreenLeft;
}
else if (screen.Bounds.Left != allScreensBounds.Left && screen.Bounds.Right == allScreensBounds.Right)
{
deviceAlignment += " " + Language.GetString(LangKey.contextmenu_capturefullscreen_right);
deviceAlignment += " " + _greenshotLanguage.ContextmenuCapturefullscreenRight;
}
captureScreenItem = new ToolStripMenuItem(deviceAlignment);
captureScreenItem.Click += (o, args) => BeginInvoke((MethodInvoker) (() => CaptureHelper.CaptureRegion(false, screenToCapture.Bounds)));
@ -903,7 +904,7 @@ namespace Greenshot.Forms
// For the capture mousecursor option
var captureMouseItem = new ToolStripMenuSelectListItem
{
Text = Language.GetString("settings_capture_mousepointer"),
Text = _greenshotLanguage.SettingsCaptureMousepointer,
Checked = _coreConfiguration.CaptureMousepointer,
CheckOnClick = true
};
@ -917,7 +918,7 @@ namespace Greenshot.Forms
// screenshot destination
selectList = new ToolStripMenuSelectList("destinations", true)
{
Text = Language.GetString(LangKey.settings_destination)
Text = _greenshotLanguage.SettingsDestination
};
// Working with IDestination:
foreach (var destination in _destinationHolder.SortedActiveDestinations)
@ -933,7 +934,7 @@ namespace Greenshot.Forms
// Capture Modes
selectList = new ToolStripMenuSelectList("capturemodes", false)
{
Text = Language.GetString(LangKey.settings_window_capture_mode)
Text = _greenshotLanguage.SettingsWindowCaptureMode
};
var enumTypeName = typeof(WindowCaptureModes).Name;
foreach (WindowCaptureModes captureMode in Enum.GetValues(typeof(WindowCaptureModes)))
@ -947,7 +948,7 @@ namespace Greenshot.Forms
// print options
selectList = new ToolStripMenuSelectList("printoptions", true)
{
Text = Language.GetString(LangKey.settings_printoptions)
Text = _greenshotLanguage.SettingsPrintoptions
};
foreach (var outputPrintIniValue in _coreConfiguration.GetIniValues().Values.Where(value => value.PropertyName.StartsWith("OutputPrint") && value.ValueType == typeof(bool) && !_coreConfiguration.IsWriteProtected(value.PropertyName)))
@ -967,7 +968,7 @@ namespace Greenshot.Forms
// effects
selectList = new ToolStripMenuSelectList("effects", true)
{
Text = Language.GetString(LangKey.settings_visualization)
Text = _greenshotLanguage.SettingsVisualization
};
var iniValue = _coreConfiguration["PlayCameraSound"];

View file

@ -118,41 +118,41 @@
<Reference Include="Dapplo.Utils, Version=1.0.158.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Utils.1.0.158\lib\net45\Dapplo.Utils.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.60\lib\net46\Dapplo.Windows.dll</HintPath>
<Reference Include="Dapplo.Windows, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.0.5.61\lib\net46\Dapplo.Windows.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Clipboard, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Clipboard.0.5.60\lib\net46\Dapplo.Windows.Clipboard.dll</HintPath>
<Reference Include="Dapplo.Windows.Clipboard, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Clipboard.0.5.61\lib\net46\Dapplo.Windows.Clipboard.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Common, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.60\lib\net46\Dapplo.Windows.Common.dll</HintPath>
<Reference Include="Dapplo.Windows.Common, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Common.0.5.61\lib\net46\Dapplo.Windows.Common.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.60\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
<Reference Include="Dapplo.Windows.DesktopWindowsManager, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.DesktopWindowsManager.0.5.61\lib\net46\Dapplo.Windows.DesktopWindowsManager.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.60\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.61\lib\net46\Dapplo.Windows.Dpi.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.60\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.61\lib\net46\Dapplo.Windows.Gdi32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Icons, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Icons.0.5.60\lib\net46\Dapplo.Windows.Icons.dll</HintPath>
<Reference Include="Dapplo.Windows.Icons, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Icons.0.5.61\lib\net46\Dapplo.Windows.Icons.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Input, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.60\lib\net46\Dapplo.Windows.Input.dll</HintPath>
<Reference Include="Dapplo.Windows.Input, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Input.0.5.61\lib\net46\Dapplo.Windows.Input.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.60\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
<Reference Include="Dapplo.Windows.Kernel32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Kernel32.0.5.61\lib\net46\Dapplo.Windows.Kernel32.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.60\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
<Reference Include="Dapplo.Windows.Messages, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Messages.0.5.61\lib\net46\Dapplo.Windows.Messages.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.Multimedia, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Multimedia.0.5.60\lib\net46\Dapplo.Windows.Multimedia.dll</HintPath>
<Reference Include="Dapplo.Windows.Multimedia, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.Multimedia.0.5.61\lib\net46\Dapplo.Windows.Multimedia.dll</HintPath>
</Reference>
<Reference Include="Dapplo.Windows.User32, Version=0.5.60.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.60\lib\net46\Dapplo.Windows.User32.dll</HintPath>
<Reference Include="Dapplo.Windows.User32, Version=0.5.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Windows.User32.0.5.61\lib\net46\Dapplo.Windows.User32.dll</HintPath>
</Reference>
<Reference Include="GongSolutions.Wpf.DragDrop, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\gong-wpf-dragdrop.1.1.0\lib\net46\GongSolutions.Wpf.DragDrop.dll</HintPath>

View file

@ -23,8 +23,10 @@
#region Usings
using System;
using System.Diagnostics;
using System.Net;
using Dapplo.HttpExtensions;
using Dapplo.Log;
using Greenshot.Addons.Core;
@ -99,15 +101,13 @@ namespace Greenshot.Help
{
try
{
var req = NetworkHelper.CreateWebRequest(url);
using (var res = (HttpWebResponse) req.GetResponse())
{
return res.StatusCode;
}
var uri = new Uri(url);
var head = uri.HeadAsync().Result;
return HttpStatusCode.OK;
}
catch (WebException e)
catch (Exception e)
{
return ((HttpWebResponse) e.Response)?.StatusCode;
return HttpStatusCode.NotFound;
}
}
}

View file

@ -31,18 +31,18 @@
<package id="Dapplo.Log.LogFile" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Log.Loggers" version="1.2.1" targetFramework="net46" />
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Clipboard" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Icons" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.Multimedia" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.60" targetFramework="net46" />
<package id="Dapplo.Windows" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Clipboard" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Common" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Dpi" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Gdi32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Icons" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Input" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Kernel32" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Messages" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.Multimedia" version="0.5.61" targetFramework="net46" />
<package id="Dapplo.Windows.User32" version="0.5.61" targetFramework="net46" />
<package id="Fody" version="3.0.3" targetFramework="net46" developmentDependency="true" />
<package id="gong-wpf-dragdrop" version="1.1.0" targetFramework="net46" />
<package id="MahApps.Metro" version="1.6.4" targetFramework="net46" />