From c698425b1ab832fe351aff257815709c01950fc3 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 6 Nov 2019 18:06:45 +0200 Subject: Implemented liquid quantity validation on PPC and MS. Improved PPC full control view. --- .../ViewModels/MainViewVM.cs | 48 ++++++++++++++-------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') 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 3a1f3fb11..c9483b9a2 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 @@ -1481,15 +1481,39 @@ namespace Tango.MachineStudio.Developer.ViewModels JobHandler.Failed += (x, ex) => { - LogManager.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name)); - _eventLogger.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name)); - SetJobFailed(); + if (ex is InsufficientLiquidQuantityException) + { + InvokeUI(() => + { + _notification.ShowModalDialog(new InsufficientLiquidQuantityViewVM(ex as InsufficientLiquidQuantityException), (_) => + { - InvokeUI(() => + MachineOperator.EnableJobLiquidQuantityValidation = false; + StartJob(); + + }, () => + { + SetJobFailed(); + + InvokeUI(() => + { + StopRecordingIfInProgress(); + }); + }); + }); + } + else { - _notification.ShowError("Job failed. " + ex.FlattenMessage()); - StopRecordingIfInProgress(); - }); + LogManager.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name)); + _eventLogger.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name)); + SetJobFailed(); + + InvokeUI(() => + { + _notification.ShowError("Job failed. " + ex.FlattenMessage()); + StopRecordingIfInProgress(); + }); + } }; JobHandler.Finalizing += (_, __) => @@ -1521,16 +1545,6 @@ namespace Tango.MachineStudio.Developer.ViewModels //Finally Canceled.. }; } - catch (InsufficientLiquidQuantityException ex) - { - _notification.ShowModalDialog(new InsufficientLiquidQuantityViewVM(ex), (x) => - { - - MachineOperator.EnableJobLiquidQuantityValidation = false; - StartJob(); - - }, () => { }); - } catch (Exception ex) { LogManager.Log(ex); -- cgit v1.3.1