Fixed typo, updated dependencies and fixed an issue with the notifications.

This commit is contained in:
Robin Krom 2021-04-03 21:58:14 +02:00
commit 54038a3cbe
No known key found for this signature in database
GPG key ID: BCC01364F1371490
16 changed files with 72 additions and 64 deletions

View file

@ -121,7 +121,7 @@ namespace Greenshot.Base.Controls
Close(); Close();
} }
// Check if an exception occured, if so throw it // Check if an exception occurred, if so throw it
if (threadException != null) if (threadException != null)
{ {
throw threadException; throw threadException;

View file

@ -5,8 +5,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="1.0.8" /> <PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="1.0.10" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.31" /> <PackageReference Include="HtmlAgilityPack" Version="1.11.32" />
<PackageReference Include="log4net" version="2.0.12" /> <PackageReference Include="log4net" version="2.0.12" />
<PackageReference Include="Svg" Version="3.2.3" /> <PackageReference Include="Svg" Version="3.2.3" />
<Reference Include="Accessibility" /> <Reference Include="Accessibility" />

View file

@ -496,7 +496,7 @@ namespace Greenshot.Base.IniFile
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("A problem occured while writing the configuration file to: " + iniLocation); Log.Error("A problem occurred while writing the configuration file to: " + iniLocation);
Log.Error(ex); Log.Error(ex);
} }
} }

View file

@ -222,7 +222,7 @@ namespace Greenshot.Base.UnmanagedHelpers
/// <param name="area">Rectangle to apply the blur effect to</param> /// <param name="area">Rectangle to apply the blur effect to</param>
/// <param name="radius">0-255</param> /// <param name="radius">0-255</param>
/// <param name="expandEdges">bool true if the edges are expanded with the radius</param> /// <param name="expandEdges">bool true if the edges are expanded with the radius</param>
/// <returns>false if there is no GDI+ available or an exception occured</returns> /// <returns>false if there is no GDI+ available or an exception occurred</returns>
public static bool ApplyBlur(Bitmap destinationBitmap, Rectangle area, int radius, bool expandEdges) public static bool ApplyBlur(Bitmap destinationBitmap, Rectangle area, int radius, bool expandEdges)
{ {
if (!IsBlurPossible(radius)) if (!IsBlurPossible(radius))
@ -303,7 +303,7 @@ namespace Greenshot.Base.UnmanagedHelpers
/// <summary> /// <summary>
/// Draw the image on the graphics with GDI+ blur effect /// Draw the image on the graphics with GDI+ blur effect
/// </summary> /// </summary>
/// <returns>false if there is no GDI+ available or an exception occured</returns> /// <returns>false if there is no GDI+ available or an exception occurred</returns>
public static bool DrawWithBlur(Graphics graphics, Bitmap image, Rectangle source, Matrix transform, ImageAttributes imageAttributes, int radius, bool expandEdges) public static bool DrawWithBlur(Graphics graphics, Bitmap image, Rectangle source, Matrix transform, ImageAttributes imageAttributes, int radius, bool expandEdges)
{ {
if (!IsBlurPossible(radius)) if (!IsBlurPossible(radius))

View file

@ -20,7 +20,7 @@
Successfully uploaded image to Box! Successfully uploaded image to Box!
</resource> </resource>
<resource name="upload_failure"> <resource name="upload_failure">
An error occured while uploading to Box: An error occurred while uploading to Box:
</resource> </resource>
<resource name="label_upload_format"> <resource name="label_upload_format">
Image format Image format

View file

@ -35,7 +35,7 @@
Successfully uploaded image to Confluence! Successfully uploaded image to Confluence!
</resource> </resource>
<resource name="upload_failure"> <resource name="upload_failure">
An error occured while uploading to Confluence: An error occurred while uploading to Confluence:
</resource> </resource>
<resource name="open_page_after_upload"> <resource name="open_page_after_upload">
Open page after upload Open page after upload

View file

@ -23,7 +23,7 @@
Successfully uploaded image to Dropbox! Successfully uploaded image to Dropbox!
</resource> </resource>
<resource name="upload_failure"> <resource name="upload_failure">
An error occured while uploading to Dropbox: An error occurred while uploading to Dropbox:
</resource> </resource>
<resource name="label_upload_format"> <resource name="label_upload_format">
Image format Image format

View file

@ -26,7 +26,7 @@
Successfully uploaded image to Flickr! Successfully uploaded image to Flickr!
</resource> </resource>
<resource name="upload_failure"> <resource name="upload_failure">
An error occured while uploading to Flickr: An error occurred while uploading to Flickr:
</resource> </resource>
<resource name="label_upload_format"> <resource name="label_upload_format">
Image format Image format

View file

@ -20,7 +20,7 @@
Successfully uploaded image to GooglePhotos! Successfully uploaded image to GooglePhotos!
</resource> </resource>
<resource name="upload_failure"> <resource name="upload_failure">
An error occured while uploading to GooglePhotos: An error occurred while uploading to GooglePhotos:
</resource> </resource>
<resource name="label_upload_format"> <resource name="label_upload_format">
Image format Image format

View file

@ -20,7 +20,7 @@
Successfully uploaded image to Imgur! Successfully uploaded image to Imgur!
</resource> </resource>
<resource name="upload_failure"> <resource name="upload_failure">
An error occured while uploading to Imgur: An error occurred while uploading to Imgur:
</resource> </resource>
<resource name="label_upload_format"> <resource name="label_upload_format">
Image format Image format

View file

@ -53,7 +53,7 @@
Successfully uploaded image to Jira! Successfully uploaded image to Jira!
</resource> </resource>
<resource name="upload_failure"> <resource name="upload_failure">
An error occured while uploading to Jira: An error occurred while uploading to Jira:
</resource> </resource>
<resource name="label_upload_format"> <resource name="label_upload_format">
Image format Image format

View file

@ -17,7 +17,7 @@
Successfully uploaded image to Photobucket! Successfully uploaded image to Photobucket!
</resource> </resource>
<resource name="upload_failure"> <resource name="upload_failure">
An error occured while uploading to Photobucket: An error occurred while uploading to Photobucket:
</resource> </resource>
<resource name="label_upload_format"> <resource name="label_upload_format">
Image format Image format

View file

@ -6,7 +6,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" version="7.0.0" /> <PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" version="7.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Greenshot.Base\Greenshot.Base.csproj" /> <ProjectReference Include="..\Greenshot.Base\Greenshot.Base.csproj" />

View file

@ -111,63 +111,71 @@ namespace Greenshot.Plugin.Win10
Log.Info("Ignoring exception as this means that there was no stored settings."); Log.Info("Ignoring exception as this means that there was no stored settings.");
} }
// Generate the toast and send it off try
new ToastContentBuilder() {
.AddArgument("ToastID", 100) // Generate the toast and send it off
// Inline image new ToastContentBuilder()
.AddText(message) .AddArgument("ToastID", 100)
// Profile (app logo override) image // Inline image
//.AddAppLogoOverride(new Uri($@"file://{_imageFilePath}"), ToastGenericAppLogoCrop.None) .AddText(message)
.Show(toast => // Profile (app logo override) image
{ //.AddAppLogoOverride(new Uri($@"file://{_imageFilePath}"), ToastGenericAppLogoCrop.None)
.Show(toast =>
{
// Windows 10 first with 1903: ExpiresOnReboot = true // Windows 10 first with 1903: ExpiresOnReboot = true
toast.ExpirationTime = timeout.HasValue ? DateTimeOffset.Now.Add(timeout.Value) : (DateTimeOffset?) null; toast.ExpirationTime = timeout.HasValue ? DateTimeOffset.Now.Add(timeout.Value) : (DateTimeOffset?)null;
void ToastActivatedHandler(ToastNotification toastNotification, object sender) void ToastActivatedHandler(ToastNotification toastNotification, object sender)
{
try
{ {
onClickAction?.Invoke(); try
} {
catch (Exception ex) onClickAction?.Invoke();
{ }
Log.Warn("Exception while handling the onclick action: ", ex); catch (Exception ex)
{
Log.Warn("Exception while handling the onclick action: ", ex);
}
toast.Activated -= ToastActivatedHandler;
} }
toast.Activated -= ToastActivatedHandler; if (onClickAction != null)
}
if (onClickAction != null)
{
toast.Activated += ToastActivatedHandler;
}
void ToastDismissedHandler(ToastNotification toastNotification, ToastDismissedEventArgs eventArgs)
{
Log.Debug($"Toast closed with reason {eventArgs.Reason}");
if (eventArgs.Reason != ToastDismissalReason.UserCanceled)
{ {
return; toast.Activated += ToastActivatedHandler;
} }
try void ToastDismissedHandler(ToastNotification toastNotification, ToastDismissedEventArgs eventArgs)
{ {
onClosedAction?.Invoke(); Log.Debug($"Toast closed with reason {eventArgs.Reason}");
} if (eventArgs.Reason != ToastDismissalReason.UserCanceled)
catch (Exception ex) {
{ return;
Log.Warn("Exception while handling the onClosed action: ", ex); }
}
toast.Dismissed -= ToastDismissedHandler; try
{
onClosedAction?.Invoke();
}
catch (Exception ex)
{
Log.Warn("Exception while handling the onClosed action: ", ex);
}
toast.Dismissed -= ToastDismissedHandler;
// Remove the other handler too // Remove the other handler too
toast.Activated -= ToastActivatedHandler; toast.Activated -= ToastActivatedHandler;
toast.Failed -= ToastOnFailed; toast.Failed -= ToastOnFailed;
} }
toast.Dismissed += ToastDismissedHandler; toast.Dismissed += ToastDismissedHandler;
toast.Failed += ToastOnFailed; toast.Failed += ToastOnFailed;
}); });
}
catch (Exception ex)
{
Log.Warn("Ignoring exception as this means that it was not possible to generate a toast.", ex);
}
} }
private void ToastOnFailed(ToastNotification sender, ToastFailedEventArgs args) private void ToastOnFailed(ToastNotification sender, ToastFailedEventArgs args)

View file

@ -124,7 +124,7 @@ namespace Greenshot.Helpers
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("Error occured when trying to check for updates.", ex); Log.Error("Error occurred when trying to check for updates.", ex);
} }
try try
@ -137,7 +137,7 @@ namespace Greenshot.Helpers
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("Error occured await for the next update check.", ex); Log.Error("Error occurred await for the next update check.", ex);
} }
} }
}, cancellationToken).ConfigureAwait(false); }, cancellationToken).ConfigureAwait(false);

View file

@ -12,7 +12,7 @@ Details about the GNU General Public License:</resource>
<resource name="about_translation"><!-- diplayed in about dialog, use to add credits or other translation-related info, e.g. "English translation by Jane Doe" --></resource> <resource name="about_translation"><!-- diplayed in about dialog, use to add credits or other translation-related info, e.g. "English translation by Jane Doe" --></resource>
<resource name="application_title">Greenshot - the revolutionary screenshot utility</resource> <resource name="application_title">Greenshot - the revolutionary screenshot utility</resource>
<resource name="bugreport_cancel">Close</resource> <resource name="bugreport_cancel">Close</resource>
<resource name="bugreport_info">Sorry, an unexpected error occured. <resource name="bugreport_info">Sorry, an unexpected error occurred.
The good news is: you can help us getting rid of it by filing a bug report. The good news is: you can help us getting rid of it by filing a bug report.
Please visit the URL below, create a new bug report and paste the contents from the text area into the description. Please visit the URL below, create a new bug report and paste the contents from the text area into the description.
@ -21,7 +21,7 @@ Please add a meaningful summary and enclose any information you consider to be h
Also, we would highly appreciate if you checked whether a tracker item already exists for this bug. (You can use the search to find those quickly.) Thank you :)</resource> Also, we would highly appreciate if you checked whether a tracker item already exists for this bug. (You can use the search to find those quickly.) Thank you :)</resource>
<resource name="bugreport_title">Error</resource> <resource name="bugreport_title">Error</resource>
<resource name="CANCEL">Cancel</resource> <resource name="CANCEL">Cancel</resource>
<resource name="clipboard_error">An unexpected error occured while writing to the clipboard.</resource> <resource name="clipboard_error">An unexpected error occurred while writing to the clipboard.</resource>
<resource name="clipboard_inuse">Greenshot wasn't able to write to the clipboard as the process {0} blocked the access.</resource> <resource name="clipboard_inuse">Greenshot wasn't able to write to the clipboard as the process {0} blocked the access.</resource>
<resource name="clipboard_noimage">Couldn't find a clipboard image.</resource> <resource name="clipboard_noimage">Couldn't find a clipboard image.</resource>
<resource name="ClipboardFormat.BITMAP">Windows Bitmap</resource> <resource name="ClipboardFormat.BITMAP">Windows Bitmap</resource>
@ -179,7 +179,7 @@ Please check write accessibility of the selected storage location.</resource>
<resource name="expertsettings_suppresssavedialogatclose">Suppress the save dialog when closing the editor</resource> <resource name="expertsettings_suppresssavedialogatclose">Suppress the save dialog when closing the editor</resource>
<resource name="expertsettings_thumbnailpreview">Show window thumbnails in context menu (for Vista and windows 7)</resource> <resource name="expertsettings_thumbnailpreview">Show window thumbnails in context menu (for Vista and windows 7)</resource>
<resource name="exported_to">Exported to: {0}</resource> <resource name="exported_to">Exported to: {0}</resource>
<resource name="exported_to_error">An error occured while exporting to {0}:</resource> <resource name="exported_to_error">An error occurred while exporting to {0}:</resource>
<resource name="help_title">Greenshot Help</resource> <resource name="help_title">Greenshot Help</resource>
<resource name="hotkeys">Hotkeys</resource> <resource name="hotkeys">Hotkeys</resource>
<resource name="jpegqualitydialog_choosejpegquality">Please choose the JPEG quality for your image.</resource> <resource name="jpegqualitydialog_choosejpegquality">Please choose the JPEG quality for your image.</resource>