Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Source/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("2025.6.13.0")]
[assembly: AssemblyFileVersion("2025.6.13.0")]
[assembly: AssemblyVersion("2025.8.11.0")]
[assembly: AssemblyFileVersion("2025.8.11.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
{
case ChildWindowIcon.Info:
return Application.Current.FindResource("InfoImageRectangle");
case ChildWindowIcon.Question:
return Application.Current.FindResource("QuestionImageRectangle");
case ChildWindowIcon.Warn:
return Application.Current.FindResource("WarnImageRectangle");
case ChildWindowIcon.Error:
Expand Down
20 changes: 16 additions & 4 deletions Source/NETworkManager.Settings/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ public static void Upgrade(Version fromVersion, Version toVersion)
if (fromVersion < new Version(2024, 11, 11, 0))
UpgradeTo_2024_11_11_0();

// 2025.8.11.0
if (fromVersion < new Version(2025, 8, 11, 0))
UpgradeTo_2025_8_11_0();

// Latest
if (fromVersion < toVersion)
UpgradeToLatest(toVersion);
Expand Down Expand Up @@ -311,12 +315,11 @@ private static void UpgradeTo_2024_11_11_0()
}

/// <summary>
/// Method to apply changes for the latest version.
/// Method to apply changes for version 2025.8.11.0.
/// </summary>
/// <param name="version">Latest version.</param>
private static void UpgradeToLatest(Version version)
private static void UpgradeTo_2025_8_11_0()
{
Log.Info($"Apply upgrade to {version}...");
Log.Info("Apply upgrade to 2025.8.11.0...");

// Add Hosts editor application
Log.Info("Add new app \"Hosts File Editor\"...");
Expand All @@ -326,5 +329,14 @@ private static void UpgradeToLatest(Version version)
ApplicationManager.GetDefaultList().First(x => x.Name == ApplicationName.HostsFileEditor));
}

/// <summary>
/// Method to apply changes for the latest version.
/// </summary>
/// <param name="version">Latest version.</param>
private static void UpgradeToLatest(Version version)
{
Log.Info($"Apply upgrade to {version}...");
}

#endregion
}
5 changes: 5 additions & 0 deletions Source/NETworkManager.Utilities/ChildWindowIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ public enum ChildWindowIcon
/// </summary>
Info,

/// <summary>
/// Question icon.
/// </summary>
Question,

/// <summary>
/// Warning icon.
/// </summary>
Expand Down
14 changes: 14 additions & 0 deletions Source/NETworkManager/Resources/Styles/RectangleStyles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@
<Setter Property="ToolTipService.ShowDuration" Value="600000" />
</Style>

<Style x:Key="QuestionImageRectangle" TargetType="{x:Type Rectangle}">
<Style.Resources>
<Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource DefaultToolTip}" />
</Style.Resources>
<Setter Property="Fill" Value="{DynamicResource MahApps.Brushes.Gray3}" />
<Setter Property="OpacityMask">
<Setter.Value>
<VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=HelpCircleOutline}" />
</Setter.Value>
</Setter>
<Setter Property="ToolTipService.InitialShowDelay" Value="0" />
<Setter Property="ToolTipService.ShowDuration" Value="600000" />
</Style>

<Style x:Key="WarnImageRectangle" TargetType="{x:Type Rectangle}">
<Style.Resources>
<Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource DefaultToolTip}" />
Expand Down
19 changes: 15 additions & 4 deletions Source/NETworkManager/ViewModels/OKCancelInfoMessageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace NETworkManager.ViewModels;
public class OKCancelInfoMessageViewModel : ViewModelBase
{
public OKCancelInfoMessageViewModel(Action<OKCancelInfoMessageViewModel> okCommand,
Action<OKCancelInfoMessageViewModel> cancelHandler, string message, string okButtonText = null, string cancelButtonText = null)
Action<OKCancelInfoMessageViewModel> cancelHandler, string message, string okButtonText = null, string cancelButtonText = null, ChildWindowIcon icon = ChildWindowIcon.Info)
{
OKCommand = new RelayCommand(_ => okCommand(this));
CancelCommand = new RelayCommand(_ => cancelHandler(this));
Expand All @@ -23,7 +23,6 @@ public OKCancelInfoMessageViewModel(Action<OKCancelInfoMessageViewModel> okComma
public ICommand CancelCommand { get; }

private readonly string _message;

public string Message
{
get => _message;
Expand All @@ -38,7 +37,6 @@ private init
}

private readonly string _okButtonText;

public string OKButtonText
{
get => _okButtonText;
Expand All @@ -53,7 +51,6 @@ private init
}

private readonly string _cancelButtonText;

public string CancelButtonText
{
get => _cancelButtonText;
Expand All @@ -66,4 +63,18 @@ private init
OnPropertyChanged();
}
}

private ChildWindowIcon _icon;
public ChildWindowIcon Icon
{
get => _icon;
private init
{
if (value == _icon)
return;

_icon = value;
OnPropertyChanged();
}
}
}
3 changes: 0 additions & 3 deletions Source/NETworkManager/ViewModels/OKMessageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public OKMessageViewModel(Action<OKMessageViewModel> okCommand, string message,
public ICommand OKCommand { get; }

private readonly string _message;

public string Message
{
get => _message;
Expand All @@ -34,7 +33,6 @@ private init
}

private readonly string _okButtonText;

public string OKButtonText
{
get => _okButtonText;
Expand All @@ -49,7 +47,6 @@ private init
}

private ChildWindowIcon _icon;

public ChildWindowIcon Icon
{
get => _icon;
Expand Down
71 changes: 44 additions & 27 deletions Source/NETworkManager/ViewModels/SettingsSettingsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using MahApps.Metro.Controls.Dialogs;
using MahApps.Metro.SimpleChildWindow;
using NETworkManager.Localization.Resources;
using NETworkManager.Settings;
using NETworkManager.Utilities;
using NETworkManager.Views;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;

namespace NETworkManager.ViewModels;

public class SettingsSettingsViewModel : ViewModelBase
{
#region Variables

private readonly IDialogCoordinator _dialogCoordinator;

public Action CloseAction { get; set; }

private string _location;
Expand All @@ -31,15 +30,12 @@ public string Location
OnPropertyChanged();
}
}

#endregion

#region Constructor, LoadSettings

public SettingsSettingsViewModel(IDialogCoordinator instance)
public SettingsSettingsViewModel()
{
_dialogCoordinator = instance;

LoadSettings();
}

Expand All @@ -61,26 +57,47 @@ private static void OpenLocationAction()

public ICommand ResetSettingsCommand => new RelayCommand(_ => ResetSettingsAction());

private async void ResetSettingsAction()
private void ResetSettingsAction()
{
var settings = AppearanceManager.MetroDialog;
ResetSettings().ConfigureAwait(false);
}

settings.AffirmativeButtonText = Strings.Reset;
settings.NegativeButtonText = Strings.Cancel;
#endregion

settings.DefaultButtonFocus = MessageDialogResult.Affirmative;
#region Methods

if (await _dialogCoordinator.ShowMessageAsync(this, Strings.ResetSettingsQuestion,
Strings.SettingsAreResetAndApplicationWillBeRestartedMessage,
MessageDialogStyle.AffirmativeAndNegative, settings) != MessageDialogResult.Affirmative)
return;
private Task ResetSettings()
{
var childWindow = new OKCancelInfoMessageChildWindow();

// Init default settings
SettingsManager.Initialize();
var childWindowViewModel = new OKCancelInfoMessageViewModel(_ =>
{
childWindow.IsOpen = false;
ConfigurationManager.Current.IsChildWindowOpen = false;

// Restart the application
(Application.Current.MainWindow as MainWindow)?.RestartApplication();
}
// Init default settings
SettingsManager.Initialize();

// Restart the application
(Application.Current.MainWindow as MainWindow)?.RestartApplication();
}, _ =>
{
childWindow.IsOpen = false;
ConfigurationManager.Current.IsChildWindowOpen = false;
},
Strings.SettingsAreResetAndApplicationWillBeRestartedMessage,
Strings.Reset,
Strings.Cancel,
ChildWindowIcon.Question
);

childWindow.Title = Strings.ResetSettingsQuestion;

childWindow.DataContext = childWindowViewModel;

ConfigurationManager.Current.IsChildWindowOpen = true;

return (Application.Current.MainWindow as MainWindow).ShowChildWindowAsync(childWindow);
}
#endregion
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using System;
using MahApps.Metro.SimpleChildWindow;
using MahApps.Metro.SimpleChildWindow;
using Microsoft.Web.WebView2.Core;
using NETworkManager.Localization.Resources;
using NETworkManager.Settings;
using NETworkManager.Utilities;
using NETworkManager.Views;
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using Microsoft.Web.WebView2.Core;
using Microsoft.Web.WebView2.Wpf;

namespace NETworkManager.ViewModels;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
xmlns:simpleChildWindow="clr-namespace:MahApps.Metro.SimpleChildWindow;assembly=MahApps.Metro.SimpleChildWindow"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:converters="clr-namespace:NETworkManager.Converters;assembly=NETworkManager.Converters"
ChildWindowWidth="450"
ChildWindowMaxHeight="500"
ShowTitleBar="True"
Expand All @@ -20,6 +21,9 @@
OverlayBrush="{DynamicResource ResourceKey=MahApps.Brushes.Gray.SemiTransparent}"
Loaded="ChildWindow_Loaded"
mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:OKCancelInfoMessageViewModel}">
<simpleChildWindow:ChildWindow.Resources>
<converters:ChildWindowIconToRectangleStyleConverter x:Key="ChildWindowIconToRectangleStyleConverter" />
</simpleChildWindow:ChildWindow.Resources>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
Expand All @@ -36,8 +40,8 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Grid.Row="0"
Width="32" Height="32"
Style="{StaticResource InfoImageRectangle}" />
Width="32" Height="32"
Style="{Binding Icon, Converter={StaticResource ChildWindowIconToRectangleStyleConverter}}" />
<TextBlock Grid.Column="2" Grid.Row="0"
VerticalAlignment="Center"
Text="{Binding Message}"
Expand Down
2 changes: 0 additions & 2 deletions Source/NETworkManager/Views/SettingsSettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
xmlns:viewModels="clr-namespace:NETworkManager.ViewModels"
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
dialogs:DialogParticipation.Register="{Binding}"
mc:Ignorable="d" Loaded="UserControl_Loaded"
d:DataContext="{d:DesignInstance viewModels:SettingsSettingsViewModel}">
<StackPanel>
Expand Down
7 changes: 3 additions & 4 deletions Source/NETworkManager/Views/SettingsSettingsView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System.Windows;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.ViewModels;
using NETworkManager.ViewModels;
using System.Windows;

namespace NETworkManager.Views;

public partial class SettingsSettingsView
{
private readonly SettingsSettingsViewModel _viewModel = new(DialogCoordinator.Instance);
private readonly SettingsSettingsViewModel _viewModel = new();

public SettingsSettingsView()
{
Expand Down
2 changes: 2 additions & 0 deletions Website/docs/changelog/next-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Release date: **xx.xx.2025**

## Improvements

- Redesign settings reset dialog. [#3138](https://github.com/BornToBeRoot/NETworkManager/pull/3138)

## Bugfixes

## Dependencies, Refactoring & Documentation
Expand Down