Skip to content

Commit 0760671

Browse files
committed
Feature: Use dialog for admin error message
1 parent 1c31db8 commit 0760671

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Source/NETworkManager/ViewModels/HostsFileEditorViewModel.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,21 @@ private async Task RestartAsAdminAction()
473473
}
474474
catch (Exception ex)
475475
{
476-
await _dialogCoordinator.ShowMessageAsync(this, Strings.Error, ex.Message,
477-
MessageDialogStyle.Affirmative, AppearanceManager.MetroDialog);
476+
var childWindow = new OKMessageChildWindow();
477+
478+
var childWindowViewModel = new OKMessageViewModel(_ =>
479+
{
480+
childWindow.IsOpen = false;
481+
ConfigurationManager.Current.IsChildWindowOpen = false;
482+
}, ex.Message, Strings.OK, ChildWindowIcon.Error);
483+
484+
childWindow.Title = Strings.Error;
485+
486+
childWindow.DataContext = childWindowViewModel;
487+
488+
ConfigurationManager.Current.IsChildWindowOpen = true;
489+
490+
await (Application.Current.MainWindow as MainWindow).ShowChildWindowAsync(childWindow);
478491
}
479492
}
480493

0 commit comments

Comments
 (0)