From 1c31db8f12b38e114c81889da35417e4dfcfd9ff Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Wed, 23 Jul 2025 00:07:45 +0200 Subject: [PATCH 1/2] Feature: Improve command exec & use hotkeys --- .../Views/AWSSessionManagerSettingsView.xaml.cs | 3 ++- ...redentialsPasswordProfileFileChildWindow.xaml.cs | 1 - .../Views/DNSLookupSettingsView.xaml.cs | 9 +++++---- .../NETworkManager/Views/GroupChildWindow.xaml.cs | 1 - .../Views/HostsFileEditorEntryChildWindow.xaml.cs | 1 - .../NETworkManager/Views/HostsFileEditorView.xaml | 5 +++++ .../Views/HostsFileEditorView.xaml.cs | 12 +++++++++--- .../Views/OKCancelInfoMessageChildWindow.xaml | 11 +++++++---- .../Views/OKCancelInfoMessageChildWindow.xaml.cs | 13 ++++++++++++- .../NETworkManager/Views/OKMessageChildWindow.xaml | 6 ++++-- .../Views/OKMessageChildWindow.xaml.cs | 13 ++++++++++++- .../Views/PortScannerSettingsView.xaml.cs | 3 ++- .../NETworkManager/Views/ProfileChildWindow.xaml.cs | 1 - .../NETworkManager/Views/SNMPSettingsView.xaml.cs | 3 ++- .../Views/SNTPLookupSettingsView.xaml.cs | 3 ++- .../Views/SettingsProfilesView.xaml.cs | 3 ++- Source/NETworkManager/Views/UpgradeChildWindow.xaml | 4 +++- .../NETworkManager/Views/UpgradeChildWindow.xaml.cs | 13 ++++++++++++- Source/NETworkManager/Views/WelcomeChildWindow.xaml | 4 +++- .../NETworkManager/Views/WelcomeChildWindow.xaml.cs | 13 ++++++++++++- Website/docs/application/hosts-file-editor.md | 4 +++- 21 files changed, 97 insertions(+), 29 deletions(-) diff --git a/Source/NETworkManager/Views/AWSSessionManagerSettingsView.xaml.cs b/Source/NETworkManager/Views/AWSSessionManagerSettingsView.xaml.cs index 65366d24f4..49f34fec1a 100644 --- a/Source/NETworkManager/Views/AWSSessionManagerSettingsView.xaml.cs +++ b/Source/NETworkManager/Views/AWSSessionManagerSettingsView.xaml.cs @@ -41,6 +41,7 @@ private void ContextMenu_Opened(object sender, RoutedEventArgs e) private void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e) { - _viewModel.EditAWSProfile().ConfigureAwait(false); + if (_viewModel.EditAWSProfileCommand.CanExecute(null)) + _viewModel.EditAWSProfileCommand.Execute(null); } } \ No newline at end of file diff --git a/Source/NETworkManager/Views/CredentialsPasswordProfileFileChildWindow.xaml.cs b/Source/NETworkManager/Views/CredentialsPasswordProfileFileChildWindow.xaml.cs index 3e20cd5bd4..d73f9cb2d5 100644 --- a/Source/NETworkManager/Views/CredentialsPasswordProfileFileChildWindow.xaml.cs +++ b/Source/NETworkManager/Views/CredentialsPasswordProfileFileChildWindow.xaml.cs @@ -13,7 +13,6 @@ public CredentialsPasswordProfileFileChildWindow() private void ChildWindow_OnLoaded(object sender, RoutedEventArgs e) { - // Focus the PasswordBox when the child window is loaded Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, new Action(delegate { PasswordBoxPassword.Focus(); diff --git a/Source/NETworkManager/Views/DNSLookupSettingsView.xaml.cs b/Source/NETworkManager/Views/DNSLookupSettingsView.xaml.cs index 6a6f7c3a3e..e1af7b0db9 100644 --- a/Source/NETworkManager/Views/DNSLookupSettingsView.xaml.cs +++ b/Source/NETworkManager/Views/DNSLookupSettingsView.xaml.cs @@ -1,8 +1,8 @@ -using System.Windows; +using MahApps.Metro.Controls.Dialogs; +using NETworkManager.ViewModels; +using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using MahApps.Metro.Controls.Dialogs; -using NETworkManager.ViewModels; namespace NETworkManager.Views; @@ -24,6 +24,7 @@ private void ContextMenu_Opened(object sender, RoutedEventArgs e) private void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e) { - _viewModel.EditDNSServer().ConfigureAwait(false); + if (_viewModel.EditDNSServerCommand.CanExecute(null)) + _viewModel.EditDNSServerCommand.Execute(null); } } \ No newline at end of file diff --git a/Source/NETworkManager/Views/GroupChildWindow.xaml.cs b/Source/NETworkManager/Views/GroupChildWindow.xaml.cs index fcfef3c050..47375ed158 100644 --- a/Source/NETworkManager/Views/GroupChildWindow.xaml.cs +++ b/Source/NETworkManager/Views/GroupChildWindow.xaml.cs @@ -27,7 +27,6 @@ public GroupChildWindow(Window parentWindow) private void ChildWindow_OnLoaded(object sender, RoutedEventArgs e) { - // Focus the PasswordBox when the child window is loaded Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, new Action(delegate { TextBoxName.Focus(); diff --git a/Source/NETworkManager/Views/HostsFileEditorEntryChildWindow.xaml.cs b/Source/NETworkManager/Views/HostsFileEditorEntryChildWindow.xaml.cs index bfa0a4fbfa..4d52038ece 100644 --- a/Source/NETworkManager/Views/HostsFileEditorEntryChildWindow.xaml.cs +++ b/Source/NETworkManager/Views/HostsFileEditorEntryChildWindow.xaml.cs @@ -13,7 +13,6 @@ public HostsFileEditorEntryChildWindow() private void ChildWindow_OnLoaded(object sender, RoutedEventArgs e) { - // Focus the PasswordBox when the child window is loaded Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, new Action(delegate { TextBoxIPAddress.Focus(); diff --git a/Source/NETworkManager/Views/HostsFileEditorView.xaml b/Source/NETworkManager/Views/HostsFileEditorView.xaml index 092ff929be..ae580fe8f5 100644 --- a/Source/NETworkManager/Views/HostsFileEditorView.xaml +++ b/Source/NETworkManager/Views/HostsFileEditorView.xaml @@ -169,6 +169,7 @@