From 1ab5d6100ea81f75e92600fc4282408e49365ec9 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Wed, 31 Jul 2024 22:45:52 +0200 Subject: [PATCH] Fix: Close #2803 --- Source/GlobalAssemblyInfo.cs | 4 ++-- Source/NETworkManager.Profiles/ProfileManager.cs | 4 ++-- Source/NETworkManager.Settings/SettingsManager.cs | 5 +++++ Source/NETworkManager/MainWindow.xaml.cs | 10 +++++----- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Source/GlobalAssemblyInfo.cs b/Source/GlobalAssemblyInfo.cs index ccc08c98e2..db5eadba3e 100644 --- a/Source/GlobalAssemblyInfo.cs +++ b/Source/GlobalAssemblyInfo.cs @@ -6,5 +6,5 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("2024.5.12.0")] -[assembly: AssemblyFileVersion("2024.5.12.0")] \ No newline at end of file +[assembly: AssemblyVersion("2024.8.1.0")] +[assembly: AssemblyFileVersion("2024.8.1.0")] \ No newline at end of file diff --git a/Source/NETworkManager.Profiles/ProfileManager.cs b/Source/NETworkManager.Profiles/ProfileManager.cs index 02c9b1b4dc..7288b487c2 100644 --- a/Source/NETworkManager.Profiles/ProfileManager.cs +++ b/Source/NETworkManager.Profiles/ProfileManager.cs @@ -482,7 +482,7 @@ public static void Save() // Only if the password provided earlier was valid... if (LoadedProfileFile.IsPasswordValid) { - var decryptedBytes = SerializeToByteArray(new List(Groups)); + var decryptedBytes = SerializeToByteArray([..Groups]); var encryptedBytes = CryptoHelper.Encrypt(decryptedBytes, SecureStringHelper.ConvertToString(LoadedProfileFile.Password), GlobalStaticConfiguration.Profile_EncryptionKeySize, @@ -493,7 +493,7 @@ public static void Save() } else { - SerializeToFile(LoadedProfileFile.Path, new List(Groups)); + SerializeToFile(LoadedProfileFile.Path, [..Groups]); } ProfilesChanged = false; diff --git a/Source/NETworkManager.Settings/SettingsManager.cs b/Source/NETworkManager.Settings/SettingsManager.cs index 269f39e2b2..bd77a3b107 100644 --- a/Source/NETworkManager.Settings/SettingsManager.cs +++ b/Source/NETworkManager.Settings/SettingsManager.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Xml.Serialization; using log4net; +using NETworkManager.Controls; using NETworkManager.Models; using NETworkManager.Models.Network; using NETworkManager.Models.PowerShell; @@ -333,6 +334,10 @@ private static void UpgradeTo_2023_11_28_0() private static void UpgradeToLatest(Version version) { Log.Info($"Apply upgrade to {version}..."); + + Log.Info("Reset ApplicationList to default..."); + Current.General_ApplicationList = + new ObservableSetCollection(ApplicationManager.GetDefaultList()); } #endregion diff --git a/Source/NETworkManager/MainWindow.xaml.cs b/Source/NETworkManager/MainWindow.xaml.cs index 805b289414..ffcc5ed7bd 100644 --- a/Source/NETworkManager/MainWindow.xaml.cs +++ b/Source/NETworkManager/MainWindow.xaml.cs @@ -700,8 +700,8 @@ private void LoadApplicationList() // Select the application // Set application via command line, or select the default one, fallback to the first visible one - var applicationList = Applications.Cast(); - + var applicationList = Applications.Cast().ToArray(); + if (CommandLineManager.Current.Application != ApplicationName.None) SelectedApplication = applicationList.FirstOrDefault(x => x.Name == CommandLineManager.Current.Application); else @@ -1259,7 +1259,7 @@ private void RunCommandDoAction() private void RunCommandCloseAction() { - RunCommandFlyoutClose(); + RunCommandFlyoutClose().ConfigureAwait(false); } #endregion @@ -1321,7 +1321,7 @@ private void RunCommandDo() } // Close the flyout - RunCommandFlyoutClose(true); + RunCommandFlyoutClose(true).ConfigureAwait(false); } /// @@ -1360,7 +1360,7 @@ private void FlyoutRunCommand_IsKeyboardFocusWithinChanged(object sender, Depend if (e.NewValue is not false) return; - RunCommandFlyoutClose(); + RunCommandFlyoutClose().ConfigureAwait(false); } #endregion