diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs | 99 |
1 files changed, 13 insertions, 86 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs index aeb349bdc..8d221c3f3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs @@ -11,6 +11,7 @@ using Tango.Integration.Operation; using Tango.Logging; using Tango.PMR.MachineStatus; using Tango.PPC.Common; +using Tango.PPC.Maintenance.Commands; using Tango.PPC.Maintenance.Helpers; using Tango.PPC.Maintenance.Models; using Tango.PPC.Maintenance.Views; @@ -38,11 +39,15 @@ namespace Tango.PPC.Maintenance.ViewModels set { _overallTemperature = value; RaisePropertyChangedAuto(); } } - public RelayCommand OpenDyeingHeadCommand { get; set; } + public RelayCommand ExportLogsCommand { get; set; } - public RelayCommand CloseDyeingHeadCommand { get; set; } + public OpenCloseDyeingHeadCommand OpenCloseDyeingHeadCommand { get; set; } - public RelayCommand ExportLogsCommand { get; set; } + public OpenCloseLeftLeadingWheelsCommand OpenCloseLeftLeadingWheelsCommand { get; set; } + + public OpenCloseRightLeadingWheelsCommand OpenCloseRightLeadingWheelsCommand { get; set; } + + public ResetThreadLoadingCommand ResetThreadLoadingCommand { get; set; } public MaintenanceViewVM() { @@ -50,10 +55,12 @@ namespace Tango.PPC.Maintenance.ViewModels OverallTemperature = new OverallTemperatureModel(); OpenGuideCommand = new RelayCommand<GuideBase>(OpenGuide); - - OpenDyeingHeadCommand = new RelayCommand(OpenDyeingHead); - CloseDyeingHeadCommand = new RelayCommand(CloseDyeingHead); ExportLogsCommand = new RelayCommand(ExportLogsToStorage); + + OpenCloseDyeingHeadCommand = new OpenCloseDyeingHeadCommand(); + OpenCloseLeftLeadingWheelsCommand = new OpenCloseLeftLeadingWheelsCommand(); + OpenCloseRightLeadingWheelsCommand = new OpenCloseRightLeadingWheelsCommand(); + ResetThreadLoadingCommand = new ResetThreadLoadingCommand(); } public override void OnApplicationStarted() @@ -101,86 +108,6 @@ namespace Tango.PPC.Maintenance.ViewModels } } - private void OpenDyeingHead() - { - IsFree = false; - - try - { - NotificationProvider.SetGlobalBusyMessage("Opening dyeing head lead..."); - - MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest() - { - Direction = PMR.Diagnostics.MotorDirection.Backward, - MotorType = PMR.Hardware.HardwareMotorType.MotoDhLid, - Speed = 400, - }).Subscribe((response) => - { - //Next - }, (ex) => - { - //Error - IsFree = true; - NotificationProvider.ReleaseGlobalBusyMessage(); - LogManager.Log(ex, "Error opening dyeing head lead."); - NotificationProvider.ShowError(ex.FlattenMessage()); - }, () => - { - //Complete - IsFree = true; - NotificationProvider.ReleaseGlobalBusyMessage(); - NotificationProvider.ShowSuccess("The dyeing head lead is now opened."); - }); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error opening dyeing head lead."); - NotificationProvider.ReleaseGlobalBusyMessage(); - NotificationProvider.ShowError(ex.FlattenMessage()); - IsFree = true; - } - } - - private void CloseDyeingHead() - { - IsFree = false; - - try - { - NotificationProvider.SetGlobalBusyMessage("Closing dyeing head lead..."); - - MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest() - { - Direction = PMR.Diagnostics.MotorDirection.Forward, - MotorType = PMR.Hardware.HardwareMotorType.MotoDhLid, - Speed = 400, - }).Subscribe((response) => - { - //Next - }, (ex) => - { - //Error - IsFree = true; - NotificationProvider.ReleaseGlobalBusyMessage(); - LogManager.Log(ex, "Error closing dyeing head lead."); - NotificationProvider.ShowError(ex.FlattenMessage()); - }, () => - { - //Complete - IsFree = true; - NotificationProvider.ReleaseGlobalBusyMessage(); - NotificationProvider.ShowSuccess("The dyeing head lead is now closed."); - }); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error closing dyeing head lead."); - NotificationProvider.ReleaseGlobalBusyMessage(); - NotificationProvider.ShowError(ex.FlattenMessage()); - IsFree = true; - } - } - private async void ExportLogsToStorage() { var result = await NavigationManager. |
