WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
83d9758
Chore: Migrate dialogs...
BornToBeRoot Dec 13, 2025
69a45fd
Chore: Migrate dialogs...
BornToBeRoot Dec 13, 2025
d99b8d4
Feature: Migrate more dialogs....
BornToBeRoot Dec 13, 2025
af444a8
Feature: More dialogs
BornToBeRoot Dec 13, 2025
a178a25
Feature: Migrate more dialogs
BornToBeRoot Dec 13, 2025
1223b55
Feature: More dialogs
BornToBeRoot Dec 13, 2025
597d999
Chore: migrate more dialogs
BornToBeRoot Dec 14, 2025
f5353b5
Update PowerShellControl.xaml.cs
BornToBeRoot Dec 14, 2025
3753374
Dotnet format
BornToBeRoot Dec 14, 2025
6f3aef7
Merge branch 'main' into chore/cleanup_dialogs
BornToBeRoot Dec 14, 2025
228c4f5
Merge branch 'main' into chore/cleanup_dialogs
BornToBeRoot Dec 14, 2025
627cc0b
Update TigerVNCSettingsView.xaml.cs
BornToBeRoot Dec 14, 2025
61f9636
Feature: Migrate more dialogs
BornToBeRoot Dec 14, 2025
5a48bb6
Feature: Migrate dialog
BornToBeRoot Dec 14, 2025
a009463
Feature: More dialogs
BornToBeRoot Dec 14, 2025
76fb20c
Feature: More dialogs
BornToBeRoot Dec 14, 2025
ff05489
Chore: More cleanup
BornToBeRoot Dec 14, 2025
dba8983
Chore: ARP dialog
BornToBeRoot Dec 16, 2025
0b83ff2
Merge branch 'main' into chore/cleanup_dialogs
BornToBeRoot Dec 16, 2025
e01c772
Chore: Remove dialog coordinator
BornToBeRoot Dec 16, 2025
0a34a7a
Feature: SNMP Settings dialog
BornToBeRoot Dec 16, 2025
e15bbe6
Feature: SNMP dialog
BornToBeRoot Dec 16, 2025
0475c0c
Merge branch 'main' into chore/cleanup_dialogs
BornToBeRoot Dec 16, 2025
ce0cd19
Fix: NullException in SNMP OID selection
BornToBeRoot Dec 16, 2025
cb74039
Docs: #3271
BornToBeRoot Dec 16, 2025
22e3bd4
Chore: Add default server
BornToBeRoot Dec 16, 2025
70a3eb9
Feature: More dialogs
BornToBeRoot Dec 16, 2025
0dab509
dotnet format
BornToBeRoot Dec 16, 2025
d6d2c74
Feature: More dialogs
BornToBeRoot Dec 17, 2025
f56aaf6
Feature: More dialogs
BornToBeRoot Dec 17, 2025
b7a6300
Feature: More dialogs
BornToBeRoot Dec 17, 2025
f7a37d6
Feature: Migration done & cleanup
BornToBeRoot Dec 17, 2025
30ba769
Update AppearanceManager.cs
BornToBeRoot Dec 17, 2025
a8c48cf
Docs: #3271
BornToBeRoot Dec 17, 2025
835ba57
Fix: ComboBox focus issue
BornToBeRoot Dec 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 78 additions & 2 deletions Source/NETworkManager.Controls/MultiSelectDataGrid.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using System.Collections;
using System.Collections.Specialized;
using System.Windows;
using System.Windows.Controls;

namespace NETworkManager.Controls;

public class MultiSelectDataGrid : DataGrid
{
private bool _isUpdatingSelection;

public static readonly DependencyProperty SelectedItemsListProperty =
DependencyProperty.Register("SelectedItemsList", typeof(IList), typeof(MultiSelectDataGrid),
new PropertyMetadata(null));
new PropertyMetadata(null, OnSelectedItemsListChanged));

public MultiSelectDataGrid()
{
Expand All @@ -21,8 +24,81 @@ public IList SelectedItemsList
set => SetValue(SelectedItemsListProperty, value);
}

private static void OnSelectedItemsListChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is not MultiSelectDataGrid dataGrid)
return;

dataGrid.UnsubscribeFromCollectionChanged(e.OldValue as IList);
dataGrid.SubscribeToCollectionChanged(e.NewValue as IList);
dataGrid.UpdateSelectedItems();
}

private void SubscribeToCollectionChanged(IList list)
{
if (list is INotifyCollectionChanged observableCollection)
{
observableCollection.CollectionChanged += OnSelectedItemsListCollectionChanged;
}
}

private void UnsubscribeFromCollectionChanged(IList list)
{
if (list is INotifyCollectionChanged observableCollection)
{
observableCollection.CollectionChanged -= OnSelectedItemsListCollectionChanged;
}
}

private void OnSelectedItemsListCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
UpdateSelectedItems();
}

private void UpdateSelectedItems()
{
if (_isUpdatingSelection)
return;

_isUpdatingSelection = true;

try
{
SelectedItems.Clear();

if (SelectedItemsList != null)
{
foreach (var item in SelectedItemsList)
{
SelectedItems.Add(item);
}
}
}
finally
{
_isUpdatingSelection = false;
}
}

private void DataGridMultiItemSelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
SelectedItemsList = SelectedItems;
if (_isUpdatingSelection || SelectedItemsList == null)
return;

_isUpdatingSelection = true;

try
{
SelectedItemsList.Clear();

foreach (var item in SelectedItems)
{
SelectedItemsList.Add(item);
}
}
finally
{
_isUpdatingSelection = false;
}
}
}
15 changes: 0 additions & 15 deletions Source/NETworkManager.Settings/AppearanceManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ControlzEx.Theming;
using MahApps.Metro.Controls.Dialogs;
using MahApps.Metro.Theming;
using NETworkManager.Models.Appearance;
using System;
Expand Down Expand Up @@ -42,11 +41,6 @@ public static class AppearanceManager
/// </summary>
private const string ThemeFolderName = "Themes";

/// <summary>
/// Contains the default settings for a new <see cref="BaseMetroDialog" />
/// </summary>
public static readonly MetroDialogSettings MetroDialog = new();

/// <summary>
/// List who contains all MahApps.Metro themes.
/// </summary>
Expand Down Expand Up @@ -83,15 +77,6 @@ static AppearanceManager()
ThemeManager.Current.ThemeChanged += Current_ThemeChanged;

LoadCustomThemes();

MetroDialog.CustomResourceDictionary = new ResourceDictionary
{
Source = new Uri("NETworkManager;component/Resources/Styles/MetroDialogStyles.xaml",
UriKind.RelativeOrAbsolute)
};

MetroDialog.DialogButtonFontSize = 14;
MetroDialog.DialogMessageFontSize = 14;
}
#endregion

Expand Down
19 changes: 18 additions & 1 deletion Source/NETworkManager.Utilities/VisualTreeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,25 @@

namespace NETworkManager.Utilities;

/// <summary>
/// Provides helper methods for traversing and querying the visual tree of WPF elements.
/// </summary>
/// <remarks>The VisualTreeHelper class contains static methods that facilitate searching for and enumerating
/// visual child elements within a WPF application's visual tree. These methods are useful for scenarios where you need
/// to locate elements of a specific type or perform operations on all descendants of a visual element.</remarks>
public class VisualTreeHelper
{
/// <summary>
/// Enumerates all descendant visual children of a specified type from the visual tree starting at the given
/// dependency object.
/// </summary>
/// <remarks>This method performs a recursive depth-first traversal of the visual tree. It yields each
/// descendant of the specified type, including those nested at any depth. The enumeration is deferred and elements
/// are returned as they are discovered.</remarks>
/// <typeparam name="T">The type of visual child to search for. Must derive from DependencyObject.</typeparam>
/// <param name="depObj">The root of the visual tree to search. Cannot be null.</param>
/// <returns>An enumerable collection of all descendant elements of type T found in the visual tree. The collection is empty
/// if no matching elements are found.</returns>
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
{
if (depObj == null)
Expand All @@ -19,4 +36,4 @@ public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) wher
foreach (var childOfChild in FindVisualChildren<T>(child)) yield return childOfChild;
}
}
}
}
1 change: 0 additions & 1 deletion Source/NETworkManager/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<ResourceDictionary Source="/Resources/Styles/LoadingIndicatorArcsStyle.xaml" />
<ResourceDictionary Source="/Resources/Styles/LoadingIndicatorPulseStyle.xaml" />
<ResourceDictionary Source="/Resources/Styles/MenuItemStyles.xaml" />
<ResourceDictionary Source="/Resources/Styles/MetroDialogStyles.xaml" />
<ResourceDictionary Source="/Resources/Styles/NumericUpDownStyles.xaml" />
<ResourceDictionary Source="/Resources/Styles/RadioButtonStyles.xaml" />
<ResourceDictionary Source="/Resources/Styles/ScrollBarStyles.xaml" />
Expand Down
6 changes: 2 additions & 4 deletions Source/NETworkManager/Controls/DragablzTabHostWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
xmlns:controls="clr-namespace:NETworkManager.Controls"
xmlns:application="clr-namespace:NETworkManager.Models;assembly=NETworkManager.Models"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:wpfHelpers="clr-namespace:NETworkManager.Utilities.WPF;assembly=NETworkManager.Utilities.WPF"
xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
xmlns:wpfHelpers="clr-namespace:NETworkManager.Utilities.WPF;assembly=NETworkManager.Utilities.WPF"
mc:Ignorable="d"
Style="{DynamicResource DefaultWindow}" MinWidth="800" Width="1024" Height="768" MinHeight="600"
TitleAlignment="Left" Activated="MetroWindow_Activated"
dialogs:DialogParticipation.Register="{Binding}"
TitleAlignment="Left" Activated="MetroWindow_Activated"
Closing="DragablzTabHostWindow_OnClosing"
d:DataContext="{d:DesignInstance controls:DragablzTabHostWindow}">
<mah:MetroWindow.Resources>
Expand Down
11 changes: 5 additions & 6 deletions Source/NETworkManager/Controls/DragablzTabHostWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Dragablz;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.Localization;
using NETworkManager.Localization.Resources;
using NETworkManager.Models;
Expand Down Expand Up @@ -224,13 +223,13 @@ private async void RemoteDesktop_SendCtrlAltDelAction(object view)
}
catch (Exception ex)
{
ConfigurationManager.OnDialogOpen();
//ConfigurationManager.OnDialogOpen();

await this.ShowMessageAsync(Strings.Error,
string.Format("{0}\n\nMessage:\n{1}",
Strings.CouldNotSendKeystroke, ex.Message));
// Use built-in message box because we have visual issues in the dragablz window
System.Windows.MessageBox.Show(string.Format("{0}\n\nMessage:\n{1}",
Strings.CouldNotSendKeystroke, ex.Message), Strings.Error, MessageBoxButton.OK, MessageBoxImage.Error);

ConfigurationManager.OnDialogClose();
//ConfigurationManager.OnDialogClose();
}
}

Expand Down
3 changes: 1 addition & 2 deletions Source/NETworkManager/Controls/PowerShellControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
xmlns:local="clr-namespace:NETworkManager.Controls"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
mah:DialogParticipation.Register="{Binding}"
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
mc:Ignorable="d" Loaded="UserControl_Loaded"
d:DataContext="{d:DesignInstance local:PowerShellControl}">
<local:UserControlBase.Resources>
Expand Down
18 changes: 2 additions & 16 deletions Source/NETworkManager/Controls/PowerShellControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.Localization.Resources;
using NETworkManager.Models.PowerShell;
using NETworkManager.Settings;
Expand All @@ -29,8 +28,6 @@ private void WindowGrid_SizeChanged(object sender, SizeChangedEventArgs e)
private bool _initialized;
private bool _closed;

private readonly IDialogCoordinator _dialogCoordinator;

private readonly Guid _tabId;
private readonly PowerShellSessionInfo _sessionInfo;

Expand Down Expand Up @@ -76,8 +73,6 @@ public PowerShellControl(Guid tabId, PowerShellSessionInfo sessionInfo)
InitializeComponent();
DataContext = this;

_dialogCoordinator = DialogCoordinator.Instance;

ConfigurationManager.Current.PowerShellTabCount++;

_tabId = tabId;
Expand Down Expand Up @@ -196,17 +191,8 @@ private async Task Connect()
catch (Exception ex)
{
if (!_closed)
{
var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Strings.OK;

ConfigurationManager.OnDialogOpen();

await _dialogCoordinator.ShowMessageAsync(this, Strings.Error,
ex.Message, MessageDialogStyle.Affirmative, settings);

ConfigurationManager.OnDialogClose();
}
// Use built-in message box because we have visual issues in the dragablz window
MessageBox.Show(ex.Message, Strings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
}

IsConnecting = false;
Expand Down
1 change: 0 additions & 1 deletion Source/NETworkManager/Controls/PuTTYControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
xmlns:local="clr-namespace:NETworkManager.Controls"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
mah:DialogParticipation.Register="{Binding}"
mc:Ignorable="d" Loaded="UserControl_Loaded"
d:DataContext="{d:DesignInstance local:PuTTYControl}">
<local:UserControlBase.Resources>
Expand Down
18 changes: 2 additions & 16 deletions Source/NETworkManager/Controls/PuTTYControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.Localization.Resources;
using NETworkManager.Models.PuTTY;
using NETworkManager.Settings;
Expand All @@ -30,8 +29,6 @@ private void WindowGrid_SizeChanged(object sender, SizeChangedEventArgs e)
private bool _initialized;
private bool _closed;

private readonly IDialogCoordinator _dialogCoordinator;

private readonly Guid _tabId;
private readonly PuTTYSessionInfo _sessionInfo;

Expand Down Expand Up @@ -77,8 +74,6 @@ public PuTTYControl(Guid tabId, PuTTYSessionInfo sessionInfo)
InitializeComponent();
DataContext = this;

_dialogCoordinator = DialogCoordinator.Instance;

ConfigurationManager.Current.PuTTYTabCount++;

_tabId = tabId;
Expand Down Expand Up @@ -213,17 +208,8 @@ private async Task Connect()
catch (Exception ex)
{
if (!_closed)
{
var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Strings.OK;

ConfigurationManager.OnDialogOpen();

await _dialogCoordinator.ShowMessageAsync(this, Strings.Error,
ex.Message, MessageDialogStyle.Affirmative, settings);

ConfigurationManager.OnDialogClose();
}
// Use built-in message box because we have visual issues in the dragablz window
MessageBox.Show(ex.Message, Strings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
}

IsConnecting = false;
Expand Down
1 change: 0 additions & 1 deletion Source/NETworkManager/Controls/TigerVNCControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
xmlns:local="clr-namespace:NETworkManager.Controls"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
mah:DialogParticipation.Register="{Binding}"
mc:Ignorable="d" Loaded="UserControl_Loaded"
d:DataContext="{d:DesignInstance local:TigerVNCControl}">
<local:UserControlBase.Resources>
Expand Down
17 changes: 2 additions & 15 deletions Source/NETworkManager/Controls/TigerVNCControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.Localization.Resources;
using NETworkManager.Models.TigerVNC;
using NETworkManager.Settings;
Expand All @@ -29,8 +28,6 @@ private void TigerVNCGrid_SizeChanged(object sender, SizeChangedEventArgs e)
private bool _initialized;
private bool _closed;

private readonly IDialogCoordinator _dialogCoordinator;

private readonly Guid _tabId;
private readonly TigerVNCSessionInfo _sessionInfo;

Expand Down Expand Up @@ -76,8 +73,6 @@ public TigerVNCControl(Guid tabId, TigerVNCSessionInfo sessionInfo)
InitializeComponent();
DataContext = this;

_dialogCoordinator = DialogCoordinator.Instance;

ConfigurationManager.Current.TigerVNCTabCount++;

_tabId = tabId;
Expand Down Expand Up @@ -209,16 +204,8 @@ private async Task Connect()
catch (Exception ex)
{
if (!_closed)
{
var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Strings.OK;
ConfigurationManager.OnDialogOpen();

await _dialogCoordinator.ShowMessageAsync(this, Strings.Error,
ex.Message, MessageDialogStyle.Affirmative, settings);

ConfigurationManager.OnDialogClose();
}
// Use built-in message box because we have visual issues in the dragablz window
MessageBox.Show(ex.Message, Strings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
}

IsConnecting = false;
Expand Down
1 change: 0 additions & 1 deletion Source/NETworkManager/Controls/WebConsoleControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
xmlns:webview="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
mah:DialogParticipation.Register="{Binding}"
mc:Ignorable="d" Loaded="UserControl_Loaded"
d:DataContext="{d:DesignInstance local:WebConsoleControl}">
<local:UserControlBase.Resources>
Expand Down
Loading