diff options
| author | Avi Levkovich <avi@twine-s.com> | 2019-11-19 13:33:51 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2019-11-19 13:33:51 +0200 |
| commit | b5ea623d1ea2cef2e117c12eaf4cd66351c42cce (patch) | |
| tree | ff15a121e57afc6cf4f017bcc2d4d6a7cc7dd78d /Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels | |
| parent | d87f59593916413b747ebe15f409ec09007747a3 (diff) | |
| parent | d50797ddb8c3d886d38a56a09dfe34540512e331 (diff) | |
| download | Tango-b5ea623d1ea2cef2e117c12eaf4cd66351c42cce.tar.gz Tango-b5ea623d1ea2cef2e117c12eaf4cd66351c42cce.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs | 77 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 4 |
2 files changed, 59 insertions, 22 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index b98cde7dd..e49be7166 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Tango.BL.Entities; using Tango.Core.Commands; using Tango.Integration.Operation; +using Tango.PMR.Printing; using Tango.PPC.Common; using Tango.PPC.Common.Navigation; using Tango.PPC.Jobs.AppBarItems; @@ -47,6 +48,26 @@ namespace Tango.PPC.Jobs.ViewModels set { _runningJobStatus = value; RaisePropertyChangedAuto(); } } + private bool _isDisplayJobOutline; + /// <summary> + /// Gets or sets a value indicating whether to display the job outline. + /// </summary> + public bool IsDisplayJobOutline + { + get { return _isDisplayJobOutline; } + set { _isDisplayJobOutline = value; RaisePropertyChangedAuto(); } + } + + private JobTicket _jobOutlineTicket; + /// <summary> + /// Gets or sets the job outline ticket. + /// </summary> + public JobTicket JobOutlineTicket + { + get { return _jobOutlineTicket; } + set { _jobOutlineTicket = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -59,6 +80,16 @@ namespace Tango.PPC.Jobs.ViewModels /// </value> public RelayCommand GoToJobCommand { get; set; } + /// <summary> + /// Gets or sets the display job outline command. + /// </summary> + public RelayCommand DisplayJobOutlineCommand { get; set; } + + /// <summary> + /// Gets or sets the hide job outline command. + /// </summary> + public RelayCommand HideJobOutlineCommand { get; set; } + #endregion public JobProgressViewVM() @@ -67,14 +98,21 @@ namespace Tango.PPC.Jobs.ViewModels _stop_job_btn.Pressed += _stop_job_btn_Pressed; GoToJobCommand = new RelayCommand(GoToJob); + DisplayJobOutlineCommand = new RelayCommand(DisplayJobOutline); + HideJobOutlineCommand = new RelayCommand(HideJobOutline); } - private void _stop_job_btn_Pressed() + #region Private Methods + + private void HideJobOutline() { - if (_handler != null) - { - _handler.Cancel(); - } + IsDisplayJobOutline = false; + } + + private void DisplayJobOutline() + { + JobOutlineTicket = _handler.JobTicket; + IsDisplayJobOutline = true; } private void GoToJob() @@ -83,6 +121,8 @@ namespace Tango.PPC.Jobs.ViewModels NavigationManager.ClearHistoryExcept<JobsView>(); } + #endregion + #region Override Methods /// <summary> @@ -117,6 +157,8 @@ namespace Tango.PPC.Jobs.ViewModels { base.OnNavigatedTo(); + IsDisplayJobOutline = false; + if (NotificationProvider.HasAppBarItem && NotificationProvider.CurrentAppBarItem is JobProgressAppBarItem) { NotificationProvider.CurrentAppBarItem.Close(); @@ -132,6 +174,14 @@ namespace Tango.PPC.Jobs.ViewModels #region Event Handlers + private void _stop_job_btn_Pressed() + { + if (_handler != null) + { + _handler.Cancel(); + } + } + /// <summary> /// Handles the PrintingStarted event of the MachineOperator. /// </summary> @@ -144,27 +194,10 @@ namespace Tango.PPC.Jobs.ViewModels e.JobHandler.StatusChanged += JobHandler_StatusChanged; e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; e.JobHandler.Stopped += JobHandler_Stopped; - e.JobHandler.Failed += JobHandler_Failed; _stop_job_btn.Push(); } - private void JobHandler_Failed(object sender, Exception ex) - { - if (ex is InsufficientLiquidQuantityException) - { - InvokeUI(async () => - { - await NotificationProvider.ShowDialog(new InsufficientLiquidQuantityViewVM(ex as InsufficientLiquidQuantityException)); - - if (IsVisible) - { - await NavigationManager.NavigateBack(); - } - }); - } - } - /// <summary> /// Handles the SpoolChangeRequired event of the JobHandler. /// </summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index ebdd18aeb..a4cf491ba 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -651,6 +651,10 @@ namespace Tango.PPC.Jobs.ViewModels var handler = await PrintingManager.Print(Job, _db); await NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView)); } + catch (InsufficientLiquidQuantityException) + { + //Ignore.. + } catch (Exception ex) { LogManager.Log(ex, "Could not start the current job."); |
