Skip to content

Commit 86c7877

Browse files
committed
Design: Migrate SNTP dialog
1 parent c8d1e16 commit 86c7877

File tree

2 files changed

+55
-34
lines changed

2 files changed

+55
-34
lines changed

Source/NETworkManager/ViewModels/SNTPLookupSettingsViewModel.cs

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -137,52 +137,59 @@ private void DeleteServerAction()
137137

138138
private async Task AddServer()
139139
{
140-
var customDialog = new CustomDialog
141-
{
142-
Title = Strings.AddSNTPServer
143-
};
140+
var childWindow = new ServerConnectionInfoProfileChildWindow();
144141

145-
var viewModel = new ServerConnectionInfoProfileViewModel(instance =>
146-
{
147-
_dialogCoordinator.HideMetroDialogAsync(this, customDialog);
142+
var childWindowViewModel = new ServerConnectionInfoProfileViewModel(instance =>
143+
{
144+
childWindow.IsOpen = false;
145+
ConfigurationManager.Current.IsChildWindowOpen = false;
148146

149-
SettingsManager.Current.SNTPLookup_SNTPServers.Add(
150-
new ServerConnectionInfoProfile(instance.Name, instance.Servers.ToList()));
151-
}, _ => { _dialogCoordinator.HideMetroDialogAsync(this, customDialog); },
147+
SettingsManager.Current.SNTPLookup_SNTPServers.Add(
148+
new ServerConnectionInfoProfile(instance.Name, [.. instance.Servers]));
149+
}, _ =>
150+
{
151+
childWindow.IsOpen = false;
152+
ConfigurationManager.Current.IsChildWindowOpen = false;
153+
},
152154
(ServerInfoProfileNames, false, false), _profileDialogDefaultValues);
153155

154-
customDialog.Content = new ServerConnectionInfoProfileDialog
155-
{
156-
DataContext = viewModel
157-
};
158156

159-
await _dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
157+
childWindow.Title = Strings.AddSNTPServer;
158+
159+
childWindow.DataContext = childWindowViewModel;
160+
161+
ConfigurationManager.Current.IsChildWindowOpen = true;
162+
163+
await (Application.Current.MainWindow as MainWindow).ShowChildWindowAsync(childWindow);
160164
}
161165

162166
public async Task EditServer()
163167
{
164-
var customDialog = new CustomDialog
168+
var childWindow = new ServerConnectionInfoProfileChildWindow();
169+
170+
var childWindowViewModel = new ServerConnectionInfoProfileViewModel(instance =>
165171
{
166-
Title = Strings.EditSNTPServer
167-
};
168-
169-
var viewModel = new ServerConnectionInfoProfileViewModel(instance =>
170-
{
171-
_dialogCoordinator.HideMetroDialogAsync(this, customDialog);
172-
173-
SettingsManager.Current.SNTPLookup_SNTPServers.Remove(SelectedSNTPServer);
174-
SettingsManager.Current.SNTPLookup_SNTPServers.Add(
175-
new ServerConnectionInfoProfile(instance.Name, instance.Servers.ToList()));
176-
}, _ => { _dialogCoordinator.HideMetroDialogAsync(this, customDialog); },
177-
(ServerInfoProfileNames, true, false),
178-
_profileDialogDefaultValues, SelectedSNTPServer);
172+
childWindow.IsOpen = false;
173+
ConfigurationManager.Current.IsChildWindowOpen = false;
179174

180-
customDialog.Content = new ServerConnectionInfoProfileDialog
175+
SettingsManager.Current.SNTPLookup_SNTPServers.Remove(SelectedSNTPServer);
176+
SettingsManager.Current.SNTPLookup_SNTPServers.Add(
177+
new ServerConnectionInfoProfile(instance.Name, [.. instance.Servers]));
178+
}, _ =>
181179
{
182-
DataContext = viewModel
183-
};
180+
childWindow.IsOpen = false;
181+
ConfigurationManager.Current.IsChildWindowOpen = false;
182+
},
183+
(ServerInfoProfileNames, true, false),
184+
_profileDialogDefaultValues, SelectedSNTPServer);
185+
186+
childWindow.Title = Strings.EditSNTPServer;
187+
188+
childWindow.DataContext = childWindowViewModel;
189+
190+
ConfigurationManager.Current.IsChildWindowOpen = true;
184191

185-
await _dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
192+
await (Application.Current.MainWindow as MainWindow).ShowChildWindowAsync(childWindow);
186193
}
187194

188195
private async Task DeleteServer()

Website/docs/changelog/next-release.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ Release date: **xx.xx.2025**
3333

3434
- New language Ukrainian (`uk-UA`) has been added. Thanks to [@vadickkt](https://github.com/vadickkt) [#3240](https://github.com/BornToBeRoot/NETworkManager/pull/3240)
3535

36+
**DNS Lookup**
37+
38+
- Allow direct dns server input (`<hostname>|<ipadress>:<port>` - `<port>` is optional) in the lookup view in addition to select from a list of configured servers. [#3261](https://github.com/BornToBeRoot/NETworkManager/pull/3261)
39+
See the [DNS Lookup](../application/dns-lookup.md) documentation for more information.
40+
3641
**Remote Desktop**
3742

3843
- Flag to enable `Admin (console) session` added to the RDP connect, profile and group dialogs. This flag allows connecting to the console session of the remote computer. [#3216](https://github.com/BornToBeRoot/NETworkManager/pull/3216)
@@ -45,6 +50,11 @@ Release date: **xx.xx.2025**
4550
- Profile file dialog migrated to a child window to improve usability. [#3227](https://github.com/BornToBeRoot/NETworkManager/pull/3227)
4651
- Credential dialogs migrated to child windows to improve usability. [#3231](https://github.com/BornToBeRoot/NETworkManager/pull/3231)
4752

53+
**DNS Lookup**
54+
55+
- Allow hostname as server address in addition to IP address in the add/edit server dialog. [#3261](https://github.com/BornToBeRoot/NETworkManager/pull/3261)
56+
- Redesign add/edit server dialog (migrated from dialog to child window). [#3261](https://github.com/BornToBeRoot/NETworkManager/pull/3261)
57+
4858
**Remote Desktop**
4959

5060
- Redesign RDP connect dialog (migrated from dialog to child window). [#3216](https://github.com/BornToBeRoot/NETworkManager/pull/3216)
@@ -61,6 +71,10 @@ Release date: **xx.xx.2025**
6171

6272
- Redesign Web Console connect dialog (migrated from dialog to child window). [#3234](https://github.com/BornToBeRoot/NETworkManager/pull/3234)
6373

74+
**SNTP Lookup**
75+
76+
- Redesign add/edit server dialog (migrated from dialog to child window). [#3261](https://github.com/BornToBeRoot/NETworkManager/pull/3261)
77+
6478
## Bug Fixes
6579

6680
**PowerShell**
@@ -77,7 +91,7 @@ Release date: **xx.xx.2025**
7791
- Documentation updated
7892
- Code cleanup & refactoring
7993
- Introduced a new DialogHelper utility to centralize creation of `OK` and `OK/Cancel` dialogs. This reduces duplication and enforces a consistent layout. [#3231](https://github.com/BornToBeRoot/NETworkManager/pull/3231)
80-
- Migrate RegexHelper to precompiled Regex patterns for improved performance. [#3261](https://github.com/BornToBeRoot/NETworkManager/pull/3261)
94+
- Migrate RegexHelper to precompiled Regex patterns for improved performance. [#3261](https://github.com/BornToBeRoot/NETworkManager/pull/3261)
8195
- Migrated existing credential and profile dialogs to use DialogHelper, improving usability, accessibility and maintainability across the app. [#3231](https://github.com/BornToBeRoot/NETworkManager/pull/3231)
8296
- Language files updated via [#transifex](https://github.com/BornToBeRoot/NETworkManager/pulls?q=author%3Aapp%2Ftransifex-integration)
8397
- Dependencies updated via [#dependabot](https://github.com/BornToBeRoot/NETworkManager/pulls?q=author%3Aapp%2Fdependabot)

0 commit comments

Comments
 (0)