aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels
diff options
context:
space:
mode:
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.cs173
1 files changed, 83 insertions, 90 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..6787136be 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
@@ -323,7 +323,7 @@ namespace Tango.PPC.MachineSettings.ViewModels
{
Settings.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList();
Settings.SupportedColorSpaces = SelectedColorSpaces.SynchedSource.ToList();
-
+
Machine.MapPropertiesTo(MachineProvider.Machine, MappingFlags.NoReferenceTypes);
Settings.EnableHotSpot = EnableHotSpot;
@@ -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,45 +480,29 @@ 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}");
+ }
}
}
using (ObservablesContext db = ObservablesContext.CreateDefault())
{
Rmls = (await new RmlsCollectionBuilder(db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).OrderBy(x => x.FinalName).ToObservableCollection();
-
- try
- {
- SpoolTypes = (await db.SitesSpoolTypes.Where(x => x.SiteGuid == MachineProvider.Machine.SiteGuid).Include(x => x.SpoolType).Select(x => x.SpoolType).ToListAsync()).OrderBy(x => x.LastUpdated).ToObservableCollection();
-
- if (SpoolTypes.Count == 0)
- {
- SpoolTypes = new ObservableCollection<SpoolType>();
- var standardSpool = await db.SpoolTypes.FirstOrDefaultAsync(x => x.Code == (int)BL.Enumerations.SpoolTypes.StandardSpool);
- if (standardSpool != null)
- {
- SpoolTypes.Add(standardSpool);
- }
- }
-
- }
- catch (Exception ex)
- {
- LogManager.Log(ex, "Error getting machine site spool types.");
- }
+ SpoolTypes = await MachineProvider.Machine.GetSiteSpoolTypes(db);
}
}
@@ -549,8 +536,8 @@ namespace Tango.PPC.MachineSettings.ViewModels
SelectedJobTypes = new SelectedObjectCollection<JobTypes>(Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToObservableCollection(), Settings.SupportedJobTypes.ToObservableCollection());
SelectedColorSpaces = new SelectedObjectCollection<ColorSpaces>(Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace()).ToObservableCollection(), Settings.SupportedColorSpaces.ToObservableCollection());
- TabsColorSpaces = new ObservableCollection<ColorSpaces>(Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x!= ColorSpaces.Volume /*&& x!= ColorSpaces.HSB*/).ToObservableCollection());
- DefaultTabColorSpace = Settings.DefaultTabColorSpace == null? ColorSpaces.CMYK : TabsColorSpaces.SingleOrDefault(x => x == Settings.DefaultTabColorSpace);
+ TabsColorSpaces = new ObservableCollection<ColorSpaces>(Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x != ColorSpaces.Volume /*&& x!= ColorSpaces.HSB*/).ToObservableCollection());
+ DefaultTabColorSpace = Settings.DefaultTabColorSpace == null ? ColorSpaces.CMYK : TabsColorSpaces.SingleOrDefault(x => x == Settings.DefaultTabColorSpace);
DefaultRML = Rmls.SingleOrDefault(x => x.Guid == Settings.DefaultRmlGuid);
SelectedSpoolType = SpoolTypes.SingleOrDefault(x => x.Guid == Settings.SpoolTypeGuid);
@@ -571,14 +558,17 @@ namespace Tango.PPC.MachineSettings.ViewModels
SelectedTimeZone = TimeZones.SingleOrDefault(x => x.StandardName == TimeZone.CurrentTimeZone.StandardName);
_previousTimeZone = SelectedTimeZone;
- try
- {
- EnableUWF = await UnifiedWriteFilterManager.IsEnabled();
- _previousEnableUWF = EnableUWF;
- }
- catch (Exception ex)
+ if (!BuildProvider.IsEureka)
{
- 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 +603,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()