From bd95ee3cd5db395d9b48e67737b5941992d37a13 Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Fri, 14 May 2021 12:33:35 +0200 Subject: [PATCH] [Feature] Show loading as mouse cursor and extra loading menu (#161), version 1.0.17.42 --- Business/Menus.cs | 2 +- Business/Program.cs | 2 -- Properties/CustomSettingsProvider.cs | 9 ++++++++- UserInterface/AboutBox.cs | 4 ---- Utilities/File/IconReader.cs | 4 ---- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Business/Menus.cs b/Business/Menus.cs index 2d982c2..182dd06 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -181,7 +181,7 @@ namespace SystemTrayMenu.Business HideOldMenu(menus[level]); } - if (menus[level] != null) + if (menus[level - 1] != null) { menus[level - 1].FocusTextBox(); } diff --git a/Business/Program.cs b/Business/Program.cs index 2184381..1f501ac 100644 --- a/Business/Program.cs +++ b/Business/Program.cs @@ -44,9 +44,7 @@ namespace SystemTrayMenu } } } -#pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) -#pragma warning restore CA1031 // => Represents ThreadException during attached to process { AskUserSendError(ex); } diff --git a/Properties/CustomSettingsProvider.cs b/Properties/CustomSettingsProvider.cs index 96aeae6..c1fa28d 100644 --- a/Properties/CustomSettingsProvider.cs +++ b/Properties/CustomSettingsProvider.cs @@ -79,7 +79,14 @@ namespace SystemTrayMenu.Properties { if (IsConfigPathAssembly()) { - File.Delete(ConfigPathAssembly); + try + { + File.Delete(ConfigPathAssembly); + } + catch (Exception ex) + { + Log.Warn($"Could not delete {ConfigPathAssembly}", ex); + } } } diff --git a/UserInterface/AboutBox.cs b/UserInterface/AboutBox.cs index 70d5664..07b33cb 100644 --- a/UserInterface/AboutBox.cs +++ b/UserInterface/AboutBox.cs @@ -348,9 +348,7 @@ namespace SystemTrayMenu.UserInterface nvc.Add("CodeBase", a.CodeBase.Replace("file:///", string.Empty, StringComparison.InvariantCulture)); } } -#pragma warning disable CA1031 // Do not catch general exception types catch (NotSupportedException) -#pragma warning restore CA1031 // Do not catch general exception types { nvc.Add("CodeBase", "(not supported)"); } @@ -374,9 +372,7 @@ namespace SystemTrayMenu.UserInterface nvc.Add("Location", a.Location); } } -#pragma warning disable CA1031 // Do not catch general exception types catch (NotSupportedException) -#pragma warning restore CA1031 // Do not catch general exception types { nvc.Add("Location", "(not supported)"); } diff --git a/Utilities/File/IconReader.cs b/Utilities/File/IconReader.cs index d785c87..e89e419 100644 --- a/Utilities/File/IconReader.cs +++ b/Utilities/File/IconReader.cs @@ -140,9 +140,7 @@ namespace SystemTrayMenu.Utilities icon = (Icon)Icon.FromHandle(shfi.hIcon).Clone(); DllImports.NativeMethods.User32DestroyIcon(shfi.hIcon); } -#pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) -#pragma warning restore CA1031 // Do not catch general exception types { Log.Error($"directoryPath:'{directoryPath}'", ex); } @@ -239,9 +237,7 @@ namespace SystemTrayMenu.Utilities // Copy (clone) the returned icon to a new object, thus allowing us to clean-up properly icon = (Icon)Icon.FromHandle(hIcon).Clone(); } -#pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) -#pragma warning restore CA1031 // Do not catch general exception types { Log.Error($"filePath:'{filePath}'", ex); }