diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-05-10 14:57:24 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-05-10 14:57:24 +0300 |
| commit | edd7e8af06fe0e70e78ce2de9423ec49a799b78a (patch) | |
| tree | 87ed11cd060ea9e562277df8063a4e7bc19a5cd0 /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels | |
| parent | 41463773c087d7aa8d085edf78613530d948e950 (diff) | |
| download | Tango-edd7e8af06fe0e70e78ce2de9423ec49a799b78a.tar.gz Tango-edd7e8af06fe0e70e78ce2de9423ec49a799b78a.zip | |
add values to UI dashboard indicators
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index fba49ced3..6d77ebcb9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -8,12 +8,14 @@ using Tango.BL.Enumerations; using Tango.Core.Commands; using Tango.Core.DI; using Tango.Integration.Operation; +using Tango.PMR.Diagnostics; using Tango.PPC.Common; using Tango.PPC.Common.Diagnostics; using Tango.PPC.Jobs; using Tango.PPC.Jobs.NavigationObjects; using Tango.PPC.Jobs.Views; using Tango.PPC.Maintenance.Models; +using Tango.PPC.UI.Models; namespace Tango.PPC.UI.ViewModels { @@ -23,9 +25,9 @@ namespace Tango.PPC.UI.ViewModels [TangoInject] public IDiagnosticsFrameProvider DefaultDiagnosticsFrameProvider { get; set; } - - private JobHandler _handler; + + private JobHandler _handler; private Job _job; /// <summary> @@ -34,10 +36,13 @@ namespace Tango.PPC.UI.ViewModels public Job Job { get { return _job; } - set { _job = value; - if(_job == null) + set + { + _job = value; + if (_job == null) IsDyeingProcess = false; - RaisePropertyChangedAuto(); } + RaisePropertyChangedAuto(); + } } private RunningJobStatus _runningJobStatus; @@ -47,13 +52,14 @@ namespace Tango.PPC.UI.ViewModels public RunningJobStatus RunningJobStatus { get { return _runningJobStatus; } - set { + set + { _runningJobStatus = value; - IsDyeingProcess = (_runningJobStatus != null && _runningJobStatus.CurrentSegment != null); - if(_runningJobStatus != null && _runningJobStatus.CurrentSegment != null) + IsDyeingProcess = (_runningJobStatus != null && _runningJobStatus.CurrentSegment != null); + if (_runningJobStatus != null && _runningJobStatus.CurrentSegment != null) { - var segment = Job.Segments.FirstOrDefault(x=>x.SegmentIndex == _runningJobStatus.CurrentSegment.SegmentIndex); - if(segment != null) + var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == _runningJobStatus.CurrentSegment.SegmentIndex); + if (segment != null) CurrentBrushStop = segment.FirstBrushStop; } RaisePropertyChangedAuto(); @@ -104,8 +110,9 @@ namespace Tango.PPC.UI.ViewModels public bool IsDyeingProcess { get { return _isDyeingProcess; } - set { - if(_isDyeingProcess != value) + set + { + if (_isDyeingProcess != value) { _isDyeingProcess = value; RaisePropertyChangedAuto(); @@ -118,8 +125,9 @@ namespace Tango.PPC.UI.ViewModels public BrushStop CurrentBrushStop { get { return _currentBrushStop; } - set { - if(_currentBrushStop != value) + set + { + if (_currentBrushStop != value) { _currentBrushStop = value; OnUpdateCurrentBrush(); @@ -147,7 +155,7 @@ namespace Tango.PPC.UI.ViewModels { get { return GetVolumeLiquidType(LiquidTypes.Black); } } - + public double LightCyanOutput { get { return GetVolumeLiquidType(LiquidTypes.LightCyan); } @@ -180,6 +188,8 @@ namespace Tango.PPC.UI.ViewModels set { _midTankLevels = value; RaisePropertyChangedAuto(); } } + public MachineOverviewModel OverviewModel { get; set; } + #endregion #region Commands @@ -206,7 +216,7 @@ namespace Tango.PPC.UI.ViewModels public MachineStatusViewVM() { - StopCommand = new RelayCommand(StopJob, ()=>CanStopped()); + StopCommand = new RelayCommand(StopJob, () => CanStopped()); AbortCommand = new RelayCommand(AbortJob, () => CanStopped()); GoToJobCommand = new RelayCommand(GoToJob); JobStatusViewCommand = new RelayCommand(JobStatusView); @@ -217,6 +227,8 @@ namespace Tango.PPC.UI.ViewModels IsEnabledStopButton = false; IsSpoolView = false; IsWeghtView = false; + + OverviewModel = new MachineOverviewModel(); } public override void OnApplicationReady() @@ -237,12 +249,12 @@ namespace Tango.PPC.UI.ViewModels MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; - //DefaultDiagnosticsFrameProvider.FrameReceived += DefaultDiagnosticsFrameProvider_FrameReceived; + DefaultDiagnosticsFrameProvider.FrameReceived += DefaultDiagnosticsFrameProvider_FrameReceived; } private void DefaultDiagnosticsFrameProvider_FrameReceived(object sender, PMR.Diagnostics.StartDiagnosticsResponse e) { - var frame = e; + OverviewModel.Update(e, this.Job != null ? Job.Rml : null, null); } private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) @@ -296,24 +308,24 @@ namespace Tango.PPC.UI.ViewModels private void JobHandler_CanCancelChanged(object sender, EventArgs e) { - InvokeUI( () => - { - IsEnabledStopButton = _handler.CanCancel; - StopCommand.RaiseCanExecuteChanged(); - AbortCommand.RaiseCanExecuteChanged(); - }); + InvokeUI(() => + { + IsEnabledStopButton = _handler.CanCancel; + StopCommand.RaiseCanExecuteChanged(); + AbortCommand.RaiseCanExecuteChanged(); + }); } - + #endregion #region Methods private void GoToJob() { - + NavigationManager.NavigateWithObject<JobsV2Module, JobEurekaView, JobNavigationObject>(new JobNavigationObject() { Job = _handler.Job }); NavigationManager.ClearHistoryExcept<JobsView>(); - + } /// <summary> /// Toggles the application technician mode. @@ -329,7 +341,7 @@ namespace Tango.PPC.UI.ViewModels ApplicationManager.ExitTechnicianMode(); } } - + protected void JobStatusView() { IsJobStatusViewEnable = true; @@ -342,7 +354,7 @@ namespace Tango.PPC.UI.ViewModels private double GetVolumeLiquidType(LiquidTypes liquidType) { - if(CurrentBrushStop != null && CurrentBrushStop.LiquidVolumes != null && CurrentBrushStop.LiquidVolumes.Count > 0) + if (CurrentBrushStop != null && CurrentBrushStop.LiquidVolumes != null && CurrentBrushStop.LiquidVolumes.Count > 0) { var lt = CurrentBrushStop.LiquidVolumes.FirstOrDefault(x => x.LiquidType == liquidType); @@ -372,7 +384,7 @@ namespace Tango.PPC.UI.ViewModels protected void ClearAllNotifications() { - NotificationProvider.NotificationItems.Where(x=>x.CanClose).ToList().ForEach(y=> NotificationProvider.PopNotification(y)); + NotificationProvider.NotificationItems.Where(x => x.CanClose).ToList().ForEach(y => NotificationProvider.PopNotification(y)); } protected void OnUpdateCurrentBrush() |
