aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2023-03-29 17:51:32 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2023-03-29 17:51:32 +0300
commitc61d12100372054de07f6201c27c7755c7be35e8 (patch)
treeeca0ada6201de7dd90a0227a8a06bc681060d2fb /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
parent0766ff8488c961c7f73eec50fb9ee64c89da5eb1 (diff)
downloadTango-c61d12100372054de07f6201c27c7755c7be35e8.tar.gz
Tango-c61d12100372054de07f6201c27c7755c7be35e8.zip
Eureka PPC. Added weight of job by length and RML.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs100
1 files changed, 92 insertions, 8 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 594f418a7..f22d43b19 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs
@@ -7,6 +7,9 @@ using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.Integration.Operation;
using Tango.PPC.Common;
+using Tango.PPC.Jobs;
+using Tango.PPC.Jobs.NavigationObjects;
+using Tango.PPC.Jobs.Views;
namespace Tango.PPC.UI.ViewModels
{
@@ -44,12 +47,37 @@ namespace Tango.PPC.UI.ViewModels
set { _isJobStatusViewEnable = value; RaisePropertyChangedAuto(); }
}
+ private bool _isEnabledStopButton;
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is enabled stop button.
+ /// </summary>
+ public bool IsEnabledStopButton
+ {
+ get { return _isEnabledStopButton; }
+ set { _isEnabledStopButton = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isSpoolView;
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is spool view.
+ /// </summary>
+ public bool IsSpoolView
+ {
+ get { return _isSpoolView; }
+ set { _isSpoolView = value; RaisePropertyChangedAuto(); }
+ }
+
+
#endregion
#region Commands
public RelayCommand StopCommand { get; set; }
+ public RelayCommand AbortCommand { get; set; }
+
+ public RelayCommand GoToJobCommand { get; set; }
+
/// <summary>
/// Gets or sets the job status view command.
/// </summary>
@@ -64,16 +92,26 @@ namespace Tango.PPC.UI.ViewModels
public MachineStatusViewVM()
{
- StopCommand = new RelayCommand(StopJob);
+ StopCommand = new RelayCommand(StopJob, ()=>CanStopped());
+ AbortCommand = new RelayCommand(AbortJob, () => CanStopped());
+ GoToJobCommand = new RelayCommand(GoToJob);
JobStatusViewCommand = new RelayCommand(JobStatusView);
OverviewViewCommand = new RelayCommand(OverviewView);
IsJobStatusViewEnable = true;
+ IsEnabledStopButton = false;
+ IsSpoolView = false;
}
-
+
public override void OnApplicationStarted()
{
MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted;
+ MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded;
+ }
+
+ private bool CanStopped()
+ {
+ return IsEnabledStopButton;
}
private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e)
@@ -83,7 +121,15 @@ namespace Tango.PPC.UI.ViewModels
e.JobHandler.StatusChanged += JobHandler_StatusChanged;
//e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired;
e.JobHandler.Stopped += JobHandler_Stopped;
- //e.JobHandler.CanCancelChanged += JobHandler_CanCancelChanged;
+ e.JobHandler.CanCancelChanged += JobHandler_CanCancelChanged;
+ InvokeUI(() =>
+ {
+ IsEnabledStopButton = true;
+ StopCommand.RaiseCanExecuteChanged();
+ AbortCommand.RaiseCanExecuteChanged();
+ });
+
+
}
private void JobHandler_Stopped(object sender, EventArgs e)
@@ -93,9 +139,22 @@ namespace Tango.PPC.UI.ViewModels
_handler.StatusChanged -= JobHandler_StatusChanged;
//_handler.SpoolChangeRequired -= JobHandler_SpoolChangeRequired;
_handler.Stopped -= JobHandler_Stopped;
+ _handler.StatusChanged -= JobHandler_StatusChanged;
+ _handler.CanCancelChanged -= JobHandler_CanCancelChanged;
}
}
+ private void MachineOperator_PrintingEnded(object sender, PrintingEventArgs e)
+ {
+ LogManager.Log("Printing ended");
+ InvokeUI(() =>
+ {
+ IsEnabledStopButton = false;
+ StopCommand.RaiseCanExecuteChanged();
+ AbortCommand.RaiseCanExecuteChanged();
+ });
+ }
+
private void JobHandler_StatusChanged(object sender, RunningJobStatus e)
{
InvokeUI(() =>
@@ -103,7 +162,35 @@ namespace Tango.PPC.UI.ViewModels
RunningJobStatus = e;
});
}
-
+
+ private void JobHandler_CanCancelChanged(object sender, EventArgs e)
+ {
+ InvokeUI( () =>
+ {
+ IsEnabledStopButton = _handler.CanCancel;
+ StopCommand.RaiseCanExecuteChanged();
+ AbortCommand.RaiseCanExecuteChanged();
+ });
+ }
+
+ private void StopJob()
+ {
+ _handler?.Cancel();
+ }
+
+ private void AbortJob()
+ {
+ _handler?.Cancel();
+ Job = null;
+ }
+
+ private void GoToJob()
+ {
+
+ // NavigationManager.NavigateWithObject<JobsV2Module, JobEurekaView, JobNavigationObject>(new JobNavigationObject() { Job = _handler.Job });
+ // NavigationManager.ClearHistoryExcept<JobsView>();
+
+ }
#region Public Methods
/// <summary>
@@ -121,10 +208,7 @@ namespace Tango.PPC.UI.ViewModels
}
}
- private void StopJob()
- {
- _handler?.Cancel();
- }
+
protected void JobStatusView()
{