From 54038a3cbe9263510c54bea4674c9c737730e6c7 Mon Sep 17 00:00:00 2001 From: Robin Krom Date: Sat, 3 Apr 2021 21:58:14 +0200 Subject: [PATCH] Fixed typo, updated dependencies and fixed an issue with the notifications. --- src/Greenshot.Base/Controls/PleaseWaitForm.cs | 2 +- src/Greenshot.Base/Greenshot.Base.csproj | 4 +- src/Greenshot.Base/IniFile/IniConfig.cs | 2 +- .../UnmanagedHelpers/GDIplus.cs | 4 +- .../Languages/language_box-en-US.xml | 2 +- .../Languages/language_confluence-en-US.xml | 2 +- .../Languages/language_dropbox-en-US.xml | 2 +- .../Languages/language_flickr-en-US.xml | 2 +- .../Languages/language_googlephotos-en-US.xml | 2 +- .../Languages/language_imgur-en-US.xml | 2 +- .../Languages/language_jira-en-US.xml | 2 +- .../Languages/language_photobucket-en-US.xml | 2 +- .../Greenshot.Plugin.Win10.csproj | 2 +- .../ToastNotificationService.cs | 96 ++++++++++--------- src/Greenshot/Helpers/UpdateService.cs | 4 +- src/Greenshot/Languages/language-en-US.xml | 6 +- 16 files changed, 72 insertions(+), 64 deletions(-) diff --git a/src/Greenshot.Base/Controls/PleaseWaitForm.cs b/src/Greenshot.Base/Controls/PleaseWaitForm.cs index d3dfc99fc..f6a1c78fb 100644 --- a/src/Greenshot.Base/Controls/PleaseWaitForm.cs +++ b/src/Greenshot.Base/Controls/PleaseWaitForm.cs @@ -121,7 +121,7 @@ namespace Greenshot.Base.Controls Close(); } - // Check if an exception occured, if so throw it + // Check if an exception occurred, if so throw it if (threadException != null) { throw threadException; diff --git a/src/Greenshot.Base/Greenshot.Base.csproj b/src/Greenshot.Base/Greenshot.Base.csproj index 2f74649f6..2fcc89e72 100644 --- a/src/Greenshot.Base/Greenshot.Base.csproj +++ b/src/Greenshot.Base/Greenshot.Base.csproj @@ -5,8 +5,8 @@ - - + + diff --git a/src/Greenshot.Base/IniFile/IniConfig.cs b/src/Greenshot.Base/IniFile/IniConfig.cs index 8c99cebab..08bcd1217 100644 --- a/src/Greenshot.Base/IniFile/IniConfig.cs +++ b/src/Greenshot.Base/IniFile/IniConfig.cs @@ -496,7 +496,7 @@ namespace Greenshot.Base.IniFile } 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); } } diff --git a/src/Greenshot.Base/UnmanagedHelpers/GDIplus.cs b/src/Greenshot.Base/UnmanagedHelpers/GDIplus.cs index b95235574..6bf30fdcc 100644 --- a/src/Greenshot.Base/UnmanagedHelpers/GDIplus.cs +++ b/src/Greenshot.Base/UnmanagedHelpers/GDIplus.cs @@ -222,7 +222,7 @@ namespace Greenshot.Base.UnmanagedHelpers /// Rectangle to apply the blur effect to /// 0-255 /// bool true if the edges are expanded with the radius - /// false if there is no GDI+ available or an exception occured + /// false if there is no GDI+ available or an exception occurred public static bool ApplyBlur(Bitmap destinationBitmap, Rectangle area, int radius, bool expandEdges) { if (!IsBlurPossible(radius)) @@ -303,7 +303,7 @@ namespace Greenshot.Base.UnmanagedHelpers /// /// Draw the image on the graphics with GDI+ blur effect /// - /// false if there is no GDI+ available or an exception occured + /// false if there is no GDI+ available or an exception occurred public static bool DrawWithBlur(Graphics graphics, Bitmap image, Rectangle source, Matrix transform, ImageAttributes imageAttributes, int radius, bool expandEdges) { if (!IsBlurPossible(radius)) diff --git a/src/Greenshot.Plugin.Box/Languages/language_box-en-US.xml b/src/Greenshot.Plugin.Box/Languages/language_box-en-US.xml index 181603529..5afc491b8 100644 --- a/src/Greenshot.Plugin.Box/Languages/language_box-en-US.xml +++ b/src/Greenshot.Plugin.Box/Languages/language_box-en-US.xml @@ -20,7 +20,7 @@ Successfully uploaded image to Box! - An error occured while uploading to Box: + An error occurred while uploading to Box: Image format diff --git a/src/Greenshot.Plugin.Confluence/Languages/language_confluence-en-US.xml b/src/Greenshot.Plugin.Confluence/Languages/language_confluence-en-US.xml index c1e325b3f..ab49a8f94 100644 --- a/src/Greenshot.Plugin.Confluence/Languages/language_confluence-en-US.xml +++ b/src/Greenshot.Plugin.Confluence/Languages/language_confluence-en-US.xml @@ -35,7 +35,7 @@ Successfully uploaded image to Confluence! - An error occured while uploading to Confluence: + An error occurred while uploading to Confluence: Open page after upload diff --git a/src/Greenshot.Plugin.Dropbox/Languages/language_dropbox-en-US.xml b/src/Greenshot.Plugin.Dropbox/Languages/language_dropbox-en-US.xml index 682135288..d4fe2ec95 100644 --- a/src/Greenshot.Plugin.Dropbox/Languages/language_dropbox-en-US.xml +++ b/src/Greenshot.Plugin.Dropbox/Languages/language_dropbox-en-US.xml @@ -23,7 +23,7 @@ Successfully uploaded image to Dropbox! - An error occured while uploading to Dropbox: + An error occurred while uploading to Dropbox: Image format diff --git a/src/Greenshot.Plugin.Flickr/Languages/language_flickr-en-US.xml b/src/Greenshot.Plugin.Flickr/Languages/language_flickr-en-US.xml index ec8408d4e..1127f625b 100644 --- a/src/Greenshot.Plugin.Flickr/Languages/language_flickr-en-US.xml +++ b/src/Greenshot.Plugin.Flickr/Languages/language_flickr-en-US.xml @@ -26,7 +26,7 @@ Successfully uploaded image to Flickr! - An error occured while uploading to Flickr: + An error occurred while uploading to Flickr: Image format diff --git a/src/Greenshot.Plugin.GooglePhotos/Languages/language_googlephotos-en-US.xml b/src/Greenshot.Plugin.GooglePhotos/Languages/language_googlephotos-en-US.xml index 70ec9f14a..76c477d50 100644 --- a/src/Greenshot.Plugin.GooglePhotos/Languages/language_googlephotos-en-US.xml +++ b/src/Greenshot.Plugin.GooglePhotos/Languages/language_googlephotos-en-US.xml @@ -20,7 +20,7 @@ Successfully uploaded image to GooglePhotos! - An error occured while uploading to GooglePhotos: + An error occurred while uploading to GooglePhotos: Image format diff --git a/src/Greenshot.Plugin.Imgur/Languages/language_imgur-en-US.xml b/src/Greenshot.Plugin.Imgur/Languages/language_imgur-en-US.xml index 595b226bd..aa9883ef9 100644 --- a/src/Greenshot.Plugin.Imgur/Languages/language_imgur-en-US.xml +++ b/src/Greenshot.Plugin.Imgur/Languages/language_imgur-en-US.xml @@ -20,7 +20,7 @@ Successfully uploaded image to Imgur! - An error occured while uploading to Imgur: + An error occurred while uploading to Imgur: Image format diff --git a/src/Greenshot.Plugin.Jira/Languages/language_jira-en-US.xml b/src/Greenshot.Plugin.Jira/Languages/language_jira-en-US.xml index 5e55b4ea7..ca64fd7a8 100644 --- a/src/Greenshot.Plugin.Jira/Languages/language_jira-en-US.xml +++ b/src/Greenshot.Plugin.Jira/Languages/language_jira-en-US.xml @@ -53,7 +53,7 @@ Successfully uploaded image to Jira! - An error occured while uploading to Jira: + An error occurred while uploading to Jira: Image format diff --git a/src/Greenshot.Plugin.Photobucket/Languages/language_photobucket-en-US.xml b/src/Greenshot.Plugin.Photobucket/Languages/language_photobucket-en-US.xml index 4572e1f60..2cb07985c 100644 --- a/src/Greenshot.Plugin.Photobucket/Languages/language_photobucket-en-US.xml +++ b/src/Greenshot.Plugin.Photobucket/Languages/language_photobucket-en-US.xml @@ -17,7 +17,7 @@ Successfully uploaded image to Photobucket! - An error occured while uploading to Photobucket: + An error occurred while uploading to Photobucket: Image format diff --git a/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj b/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj index 1ffdc4e70..822370739 100644 --- a/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj +++ b/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Greenshot.Plugin.Win10/ToastNotificationService.cs b/src/Greenshot.Plugin.Win10/ToastNotificationService.cs index f28052f05..b9120fee7 100644 --- a/src/Greenshot.Plugin.Win10/ToastNotificationService.cs +++ b/src/Greenshot.Plugin.Win10/ToastNotificationService.cs @@ -111,63 +111,71 @@ namespace Greenshot.Plugin.Win10 Log.Info("Ignoring exception as this means that there was no stored settings."); } - // Generate the toast and send it off - new ToastContentBuilder() - .AddArgument("ToastID", 100) - // Inline image - .AddText(message) - // Profile (app logo override) image - //.AddAppLogoOverride(new Uri($@"file://{_imageFilePath}"), ToastGenericAppLogoCrop.None) - .Show(toast => - { + try + { + // Generate the toast and send it off + new ToastContentBuilder() + .AddArgument("ToastID", 100) + // Inline image + .AddText(message) + // Profile (app logo override) image + //.AddAppLogoOverride(new Uri($@"file://{_imageFilePath}"), ToastGenericAppLogoCrop.None) + .Show(toast => + { // 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) - { - try + void ToastActivatedHandler(ToastNotification toastNotification, object sender) { - onClickAction?.Invoke(); - } - catch (Exception ex) - { - Log.Warn("Exception while handling the onclick action: ", ex); + try + { + onClickAction?.Invoke(); + } + catch (Exception ex) + { + Log.Warn("Exception while handling the onclick action: ", ex); + } + + toast.Activated -= ToastActivatedHandler; } - toast.Activated -= ToastActivatedHandler; - } - - 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) + if (onClickAction != null) { - return; + toast.Activated += ToastActivatedHandler; } - try + void ToastDismissedHandler(ToastNotification toastNotification, ToastDismissedEventArgs eventArgs) { - onClosedAction?.Invoke(); - } - catch (Exception ex) - { - Log.Warn("Exception while handling the onClosed action: ", ex); - } + Log.Debug($"Toast closed with reason {eventArgs.Reason}"); + if (eventArgs.Reason != ToastDismissalReason.UserCanceled) + { + return; + } - 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 toast.Activated -= ToastActivatedHandler; - toast.Failed -= ToastOnFailed; - } + toast.Failed -= ToastOnFailed; + } - toast.Dismissed += ToastDismissedHandler; - toast.Failed += ToastOnFailed; - }); + toast.Dismissed += ToastDismissedHandler; + 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) diff --git a/src/Greenshot/Helpers/UpdateService.cs b/src/Greenshot/Helpers/UpdateService.cs index a93fa5b59..16a73db14 100644 --- a/src/Greenshot/Helpers/UpdateService.cs +++ b/src/Greenshot/Helpers/UpdateService.cs @@ -124,7 +124,7 @@ namespace Greenshot.Helpers } 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 @@ -137,7 +137,7 @@ namespace Greenshot.Helpers } 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); diff --git a/src/Greenshot/Languages/language-en-US.xml b/src/Greenshot/Languages/language-en-US.xml index 0537c965b..3db9fbf0e 100644 --- a/src/Greenshot/Languages/language-en-US.xml +++ b/src/Greenshot/Languages/language-en-US.xml @@ -12,7 +12,7 @@ Details about the GNU General Public License: Greenshot - the revolutionary screenshot utility Close - Sorry, an unexpected error occured. + Sorry, an unexpected error occurred. 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. @@ -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 :) Error Cancel - An unexpected error occured while writing to the clipboard. + An unexpected error occurred while writing to the clipboard. Greenshot wasn't able to write to the clipboard as the process {0} blocked the access. Couldn't find a clipboard image. Windows Bitmap @@ -179,7 +179,7 @@ Please check write accessibility of the selected storage location. Suppress the save dialog when closing the editor Show window thumbnails in context menu (for Vista and windows 7) Exported to: {0} - An error occured while exporting to {0}: + An error occurred while exporting to {0}: Greenshot Help Hotkeys Please choose the JPEG quality for your image.