diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs | 146 |
1 files changed, 79 insertions, 67 deletions
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 49afbe63b..36d1824a0 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 @@ -381,72 +381,75 @@ namespace Tango.PPC.MachineSettings.ViewModels } } - if (EnableProxy != Settings.EnableProxifier) + if (!BuildProvider.IsEureka) { - CmdCommand cmd = null; - CmdCommandResult result = null; - - if (!EnableProxy) + if (EnableProxy != Settings.EnableProxifier) { - try + CmdCommand cmd = null; + CmdCommandResult result = null; + + if (!EnableProxy) { - cmd = new CmdCommand("taskkill", "/F /IM proxifier.exe"); - result = await cmd.Run(); - Settings.EnableProxifier = false; - Settings.Save(); + try + { + cmd = new CmdCommand("taskkill", "/F /IM proxifier.exe"); + result = await cmd.Run(); + Settings.EnableProxifier = false; + Settings.Save(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Unable to disable the proxy.\n{ex.Message}"); + await NotificationProvider.ShowError($"Unable to disable the proxy.\n{ex.Message}"); + } } - catch (Exception ex) + else { - LogManager.Log(ex, $"Unable to disable the proxy.\n{ex.Message}"); - await NotificationProvider.ShowError($"Unable to disable the proxy.\n{ex.Message}"); + try + { + Process.Start(@"C:\Program Files (x86)\Proxifier\Proxifier.exe"); + Settings.EnableProxifier = true; + Settings.Save(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Unable to start the proxy service.\n{ex.Message}"); + await NotificationProvider.ShowError($"Unable to start the proxy service.\n{ex.Message}"); + } } } - else + + if (_previousEnableUWF != EnableUWF) { + await NotificationProvider.ShowWarning("Changes to disk protection (UWF) will take effect only after a full system restart."); + try { - Process.Start(@"C:\Program Files (x86)\Proxifier\Proxifier.exe"); - Settings.EnableProxifier = true; - Settings.Save(); + LogManager.Log($"Changing UWF mode to '{EnableUWF}'."); + if (EnableUWF) + { + NotificationProvider.SetGlobalBusyMessage("Enabling disk protection (UWF)..."); + await UnifiedWriteFilterManager.Enable(); + } + else + { + NotificationProvider.SetGlobalBusyMessage("Disabling disk protection (UWF)..."); + await UnifiedWriteFilterManager.Disable(); + } + NotificationProvider.ReleaseGlobalBusyMessage(); } catch (Exception ex) { - LogManager.Log(ex, $"Unable to start the proxy service.\n{ex.Message}"); - await NotificationProvider.ShowError($"Unable to start the proxy service.\n{ex.Message}"); + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, "Error setting UWF mode."); + await NotificationProvider.ShowError($"Could not change the disk protection mode\n{ex.FlattenMessage()}"); } } - } - - if (_previousEnableUWF != EnableUWF) - { - await NotificationProvider.ShowWarning("Changes to disk protection (UWF) will take effect only after a full system restart."); - try + if (!isRestarting) { - LogManager.Log($"Changing UWF mode to '{EnableUWF}'."); - if (EnableUWF) - { - NotificationProvider.SetGlobalBusyMessage("Enabling disk protection (UWF)..."); - await UnifiedWriteFilterManager.Enable(); - } - else - { - NotificationProvider.SetGlobalBusyMessage("Disabling disk protection (UWF)..."); - await UnifiedWriteFilterManager.Disable(); - } - NotificationProvider.ReleaseGlobalBusyMessage(); + await NavigationManager.NavigateBack(); } - catch (Exception ex) - { - NotificationProvider.ReleaseGlobalBusyMessage(); - LogManager.Log(ex, "Error setting UWF mode."); - await NotificationProvider.ShowError($"Could not change the disk protection mode\n{ex.FlattenMessage()}"); - } - } - - if (!isRestarting) - { - await NavigationManager.NavigateBack(); } } } @@ -477,19 +480,22 @@ namespace Tango.PPC.MachineSettings.ViewModels MachineDataSynchronizer.SynchronizationStarted += (_, __) => InvalidateRelayCommands(); MachineDataSynchronizer.SynchronizationEnded += (_, __) => InvalidateRelayCommands(); - if (!Settings.EnableProxifier) + if (!BuildProvider.IsEureka) { - CmdCommand cmd = null; - CmdCommandResult result = null; - - try + if (!Settings.EnableProxifier) { - cmd = new CmdCommand("taskkill", "/F /IM proxifier.exe"); - result = await cmd.Run(); - } - catch (Exception ex) - { - LogManager.Log(ex, $"Unable to disable the proxy.\n{ex.Message}"); + CmdCommand cmd = null; + CmdCommandResult result = null; + + try + { + cmd = new CmdCommand("taskkill", "/F /IM proxifier.exe"); + result = await cmd.Run(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Unable to disable the proxy.\n{ex.Message}"); + } } } @@ -571,14 +577,17 @@ namespace Tango.PPC.MachineSettings.ViewModels SelectedTimeZone = TimeZones.SingleOrDefault(x => x.StandardName == TimeZone.CurrentTimeZone.StandardName); _previousTimeZone = SelectedTimeZone; - try + if (!BuildProvider.IsEureka) { - EnableUWF = await UnifiedWriteFilterManager.IsEnabled(); - _previousEnableUWF = EnableUWF; - } - catch (Exception ex) - { - LogManager.Log(ex, "Error getting UWF status."); + try + { + EnableUWF = await UnifiedWriteFilterManager.IsEnabled(); + _previousEnableUWF = EnableUWF; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error getting UWF status."); + } } try @@ -613,7 +622,10 @@ namespace Tango.PPC.MachineSettings.ViewModels LogManager.Log(ex, "Error loading lubrication levels."); } - EnableProxy = Settings.EnableProxifier; + if (!BuildProvider.IsEureka) + { + EnableProxy = Settings.EnableProxifier; + } } private async void OnEnableRemoteAssistanceChanged() |
