aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs33
1 files changed, 17 insertions, 16 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
index 09770e607..86748d2f0 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
@@ -25,6 +25,7 @@ using System.Reflection;
using Tango.PMR.Common;
using Tango.SharedUI.Helpers;
using Tango.Transport;
+using Tango.Integration.Printing;
namespace Tango.MachineStudio.Developer.ViewModels
{
@@ -38,6 +39,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
private TimeSpan _runningJobEstimatedDuration;
private Dictionary<String, GraphControllerBase> _controllers;
private int _fullScreenGraphIndex;
+ private JobHandler _jobHandler;
#region Properties
@@ -661,6 +663,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
IsJobRunning = false;
IsJobCanceled = true;
+ _jobHandler.Cancel();
}
private void CompleteJob()
@@ -687,27 +690,25 @@ namespace Tango.MachineStudio.Developer.ViewModels
RunningJob = SelectedJob;
_runningJobEstimatedDuration = EstimatedDuration;
- DispatcherTimer timer = new DispatcherTimer();
- timer.Interval = TimeSpan.FromSeconds(0.03);
- timer.Tick += (x, y) =>
+
+ _jobHandler = MachineOperator.Print(SelectedJob, SelectedProcessParametersTable);
+
+ _jobHandler.StatusReceived += (x, status) =>
{
RunningJobRemainingTime = _runningJobEstimatedDuration - TimeSpan.FromSeconds(RunningJobProgress / (SelectedProcessParametersTable.DyeingSpeed / 100d));
- RunningJobProgress += 0.03;
+ RunningJobProgress = status.Progress;
+ };
- if (!IsJobRunning)
- {
- timer.Stop();
- return;
- }
- else if (RunningJobProgress >= RunningJob.Length)
- {
- timer.Stop();
- CompleteJob();
- return;
- }
+
+ _jobHandler.Completed += (x, e) =>
+ {
+ CompleteJob();
};
- timer.Start();
+ _jobHandler.Canceled += (x, y) =>
+ {
+ //Finally Canceled..
+ };
}
private async void SaveJobs()