From f491de7fe88e18c3df8b7d29372a31cab3893bd0 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 26 Nov 2020 05:39:12 +0200 Subject: Prevent back navigation when settings require restart. --- .../Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index ef1126261..20cfd6bf4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -250,6 +250,8 @@ namespace Tango.PPC.MachineSettings.ViewModels await MachineProvider.SaveMachine(); + bool isRestarting = false; + if (_previousTimeZone.ToStringSafe() != SelectedTimeZone.ToStringSafe()) { if (await NotificationProvider.ShowQuestion("Changing the time zone requires the application to restart. Do you wish to restart the application?")) @@ -260,6 +262,7 @@ namespace Tango.PPC.MachineSettings.ViewModels NotificationProvider.SetGlobalBusyMessage("Setting new time zone..."); await OperationSystemManager.ChangeTimeZone(SelectedTimeZone); NotificationProvider.ReleaseGlobalBusyMessage(); + isRestarting = true; ApplicationManager.Restart(); } catch (Exception ex) @@ -298,7 +301,10 @@ namespace Tango.PPC.MachineSettings.ViewModels } } - await NavigationManager.NavigateBack(); + if (!isRestarting) + { + await NavigationManager.NavigateBack(); + } } } -- cgit v1.3.1