diff --git a/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj b/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj index 4fe039cbb..f222b387e 100644 --- a/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj +++ b/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj @@ -3,7 +3,7 @@ Greenshot.Addon.Win10 Greenshot.Addon.Win10 - net471 + netcoreapp3.0;net471 @@ -12,6 +12,13 @@ + + + + C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.16299.0\Windows.winmd + + + diff --git a/src/Greenshot.Addon.Win10/Win10ShareDestination.cs b/src/Greenshot.Addon.Win10/Win10ShareDestination.cs index cdfef62a6..f9d7451d5 100644 --- a/src/Greenshot.Addon.Win10/Win10ShareDestination.cs +++ b/src/Greenshot.Addon.Win10/Win10ShareDestination.cs @@ -79,7 +79,7 @@ namespace Greenshot.Addon.Win10 public bool IsDestroyed { get; set; } public bool IsShareCompleted { get; set; } - public TaskCompletionSource ShareTask { get; } = new TaskCompletionSource(); + public TaskCompletionSource ShareTask { get; } = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); public bool IsDataRequested { get; set; } } @@ -90,7 +90,7 @@ namespace Greenshot.Addon.Win10 /// /// /// ExportInformation - protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) + public override async Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); try @@ -121,7 +121,7 @@ namespace Greenshot.Addon.Win10 }); var windowHandle = new WindowInteropHelper(triggerWindow).Handle; - Share(shareInfo, windowHandle, surface, captureDetails).Wait(); + await Share(shareInfo, windowHandle, surface, captureDetails); Log.Debug().WriteLine("Sharing finished, closing window."); triggerWindow.Close(); if (string.IsNullOrWhiteSpace(shareInfo.ApplicationName)) @@ -216,6 +216,7 @@ namespace Greenshot.Addon.Win10 } // Signal that the stream is ready streamedFileDataRequest.Dispose(); + shareInfo.ShareTask.TrySetResult(true); } catch (Exception) { diff --git a/src/Greenshot/Greenshot.csproj b/src/Greenshot/Greenshot.csproj index 176d07794..a71bb32d3 100644 --- a/src/Greenshot/Greenshot.csproj +++ b/src/Greenshot/Greenshot.csproj @@ -120,9 +120,9 @@ + - \ No newline at end of file diff --git a/src/Greenshot/Startup.cs b/src/Greenshot/Startup.cs index 902a989ce..8f8e770d5 100644 --- a/src/Greenshot/Startup.cs +++ b/src/Greenshot/Startup.cs @@ -174,6 +174,8 @@ namespace Greenshot // A dirty fix to make sure the messagebox is visible as a Greenshot window on the taskbar using (var multiInstanceForm = new DpiAwareForm { + + // TODO: Fix a problem that in this case instance is null Icon = GreenshotResources.Instance.GetGreenshotIcon(), ShowInTaskbar = true, MaximizeBox = false,