diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-04 16:44:48 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-04 16:44:48 +0200 |
| commit | ba6abe56c52a9ba0e73c30062ed2e73dee883fa6 (patch) | |
| tree | 3348b09b1e8188244bad289903edcb2e8a519f1c /Software/Visual_Studio/MachineStudio | |
| parent | 2885eca102b05b2a853f3b1f082f39d48b0132a2 (diff) | |
| download | Tango-ba6abe56c52a9ba0e73c30062ed2e73dee883fa6.tar.gz Tango-ba6abe56c52a9ba0e73c30062ed2e73dee883fa6.zip | |
Added basic skeleton for job printing communication.
Added Job Handling for Machine Operator & Machine Emulator.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
3 files changed, 39 insertions, 16 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 43c5707ef..7a3e838cf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -57,6 +57,22 @@ </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> + <Reference Include="System.Reactive.Core, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Interfaces, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Linq, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.PlatformServices, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.PlatformServices.3.1.1\lib\net46\System.Reactive.PlatformServices.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Windows.Threading, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll</HintPath> + </Reference> + <Reference Include="System.Windows" /> <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath> </Reference> 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() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config index 9f69ed86f..6c338d81b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config @@ -6,4 +6,10 @@ <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> + <package id="System.Reactive" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Core" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Linq" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.PlatformServices" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Windows.Threading" version="3.1.1" targetFramework="net46" /> </packages>
\ No newline at end of file |
