diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-09-26 12:34:25 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-09-26 12:34:25 +0300 |
| commit | 189f45f48fbf1181cc9af20c93901fa9cedb9fb1 (patch) | |
| tree | cb18927a213fdf73ffc4b6197220db97a87984fe /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels | |
| parent | 387c1ee40b7bce5edd92491dc8d9edeb30a02524 (diff) | |
| parent | 60186d68fdbb9c3cc1a6f83c12228db90b48488d (diff) | |
| download | Tango-189f45f48fbf1181cc9af20c93901fa9cedb9fb1.tar.gz Tango-189f45f48fbf1181cc9af20c93901fa9cedb9fb1.zip | |
version 1.4.5.1
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels')
2 files changed, 90 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/InsufficientLiquidQuantityViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/InsufficientLiquidQuantityViewVM.cs new file mode 100644 index 000000000..e18fc842f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/InsufficientLiquidQuantityViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Operation; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Developer.ViewModels +{ + public class InsufficientLiquidQuantityViewVM : DialogViewVM + { + public InsufficientLiquidQuantityException Exception { get; set; } + + public InsufficientLiquidQuantityViewVM(InsufficientLiquidQuantityException ex) + { + Exception = ex; + } + } +} 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 3f551c866..2d04866d8 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 @@ -552,14 +552,35 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _enableColorConversion = value; RaisePropertyChangedAuto(); } } + /// <summary> + /// Gets or sets the authentication provider. + /// </summary> public IAuthenticationProvider AuthenticationProvider { get; set; } + /// <summary> + /// Gets or sets the module settings. + /// </summary> public DeveloperModuleSettings Settings { get { return _settings; } set { _settings = value; RaisePropertyChangedAuto(); } } + private bool _autoProcessSelection; + /// <summary> + /// Gets or sets a value indicating whether [automatic process selection]. + /// </summary> + public bool AutoProcessSelection + { + get { return _autoProcessSelection; } + set + { + _autoProcessSelection = value; + RaisePropertyChangedAuto(); + Settings.AutoProcessSelection = _autoProcessSelection; + } + } + #endregion #region Commands @@ -795,6 +816,8 @@ namespace Tango.MachineStudio.Developer.ViewModels { Settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>(); + AutoProcessSelection = Settings.AutoProcessSelection; + SelectedJobs = new ObservableCollection<Job>(); JobEvents = new ObservableCollection<MachinesEvent>(); @@ -864,6 +887,23 @@ namespace Tango.MachineStudio.Developer.ViewModels catch { } } + if (AutoProcessSelection && IsJobVisible && IsVisible && ActiveJob != null && ActiveJob.Segments != null && !_rml_has_no_cct && !_disable_gamut_check) + { + try + { + var recommendedProcess = _converter.GetRecommendedProcessParameters(ActiveJob, RmlProcessParametersTableGroup); + + if (recommendedProcess != null && recommendedProcess != SelectedProcessParametersTable) + { + SelectedProcessParametersTable = recommendedProcess; + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error resolving recommended process parameters."); + } + } + Thread.Sleep(500); } } @@ -1338,6 +1378,26 @@ namespace Tango.MachineStudio.Developer.ViewModels stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML, SelectedProcessParametersTable); } + if (AutoProcessSelection) + { + LogManager.Log("Auto process parameters selection enabled. Trying to resolve the recommended process parameters..."); + try + { + var recommendedProcess = _converter.GetRecommendedProcessParameters(ActiveJob, RmlProcessParametersTableGroup); + + if (recommendedProcess != null && recommendedProcess != SelectedProcessParametersTable) + { + SelectedProcessParametersTable = recommendedProcess; + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error resolving recommended process parameters."); + _notification.ShowError("An error occurred while trying to resolve the recommended process parameters.Please try to disable the auto selection."); + return; + } + } + JobEvents.Clear(); IsJobFailed = false; IsJobCanceled = false; @@ -1446,6 +1506,16 @@ namespace Tango.MachineStudio.Developer.ViewModels //Finally Canceled.. }; } + catch (InsufficientLiquidQuantityException ex) + { + _notification.ShowModalDialog<InsufficientLiquidQuantityViewVM, InsufficientLiquidQuantityView>(new InsufficientLiquidQuantityViewVM(ex), (x) => + { + + MachineOperator.EnableJobLiquidQuantityValidation = false; + StartJob(); + + }, () => { }); + } catch (Exception ex) { LogManager.Log(ex); |
