diff options
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.cs | 66 |
1 files changed, 51 insertions, 15 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 8fbce16a3..85febd0f1 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 @@ -14,6 +14,7 @@ using Tango.MachineStudio.Common.Controls; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.SharedUI; +using System.Runtime.CompilerServices; namespace Tango.MachineStudio.Developer.ViewModels { @@ -201,6 +202,14 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _estimatedDuration = value; RaisePropertyChangedAuto(); } } + private bool _isJobRunning; + + public bool IsJobRunning + { + get { return _isJobRunning; } + set { _isJobRunning = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -265,6 +274,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> public RelayCommand SaveJobsCommand { get; set; } + /// <summary> + /// Gets or sets the start job command. + /// </summary> + public RelayCommand StartJobCommand { get; set; } + #endregion #region Constructors @@ -294,19 +308,22 @@ namespace Tango.MachineStudio.Developer.ViewModels public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider) : this() { _notification = notificationProvider; - EditMachineCommand = new RelayCommand(EditMachine, (x) => SelectedMachine != null); ApplicationManager = applicationManager; - EditRMLCommand = new RelayCommand(EditRML, (x) => SelectedRML != null); + + //Initialize Commands... + EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null); + EditRMLCommand = new RelayCommand(EditRML, () => SelectedRML != null); ToggleSideBarCommand = new RelayCommand(() => IsSideBarOpened = !IsSideBarOpened); - SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters); - SaveLiquidFactorsCommand = new RelayCommand(SaveLiquidFactors); - AddSegmentCommand = new RelayCommand(AddSegment); - RemoveSegmentCommand = new RelayCommand(RemoveSegment); - AddJobCommand = new RelayCommand(AddJob); - RemoveJobCommand = new RelayCommand(RemoveJob); - AddBrushStopCommand = new RelayCommand(AddBrushStop); - RemoveBrushStopCommand = new RelayCommand(RemoveBrushStop); - SaveJobsCommand = new RelayCommand(SaveJobs); + SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0); + SaveLiquidFactorsCommand = new RelayCommand(SaveLiquidFactors, () => SelectedRML != null); + AddSegmentCommand = new RelayCommand(AddSegment, () => SelectedJob != null); + RemoveSegmentCommand = new RelayCommand(RemoveSegment, () => SelectedSegment != null); + AddJobCommand = new RelayCommand(AddJob, () => SelectedMachine != null); + RemoveJobCommand = new RelayCommand(RemoveJob, () => SelectedJob != null); + AddBrushStopCommand = new RelayCommand(AddBrushStop, () => SelectedSegment != null); + RemoveBrushStopCommand = new RelayCommand(RemoveBrushStop, () => SelectedBrushStop != null); + SaveJobsCommand = new RelayCommand(SaveJobs, () => SelectedMachine != null); + StartJobCommand = new RelayCommand(StartJob, () => SelectedJob != null && !IsJobRunning); } #endregion @@ -328,7 +345,7 @@ namespace Tango.MachineStudio.Developer.ViewModels UpdateEstimatedDuration(); } - private void SelectedProcessParametersTable_DyeingSpeedChanged(object sender, EventArgs e) + private void SelectedProcessParametersTable_DyeingSpeedMinInkUptakeChanged(object sender, EventArgs e) { if (SelectedSegment != null) { @@ -347,6 +364,12 @@ namespace Tango.MachineStudio.Developer.ViewModels protected virtual void OnSelectedParametersTableChanged() { + if (SelectedProcessParametersTable != null) + { + SelectedProcessParametersTable.DyeingSpeedMinInkUptakeChanged -= SelectedProcessParametersTable_DyeingSpeedMinInkUptakeChanged; + SelectedProcessParametersTable.DyeingSpeedMinInkUptakeChanged += SelectedProcessParametersTable_DyeingSpeedMinInkUptakeChanged; + } + SetSegmentBrushStopsLiquidVolumes(SelectedSegment); } @@ -359,9 +382,6 @@ namespace Tango.MachineStudio.Developer.ViewModels if (RmlProcessParametersTableGroup != null && RmlProcessParametersTableGroup.ProcessParametersTables.Count > 0) { SelectedProcessParametersTable = RmlProcessParametersTableGroup.ProcessParametersTables.First(); - - SelectedProcessParametersTable.DyeingSpeedChanged -= SelectedProcessParametersTable_DyeingSpeedChanged; - SelectedProcessParametersTable.DyeingSpeedChanged += SelectedProcessParametersTable_DyeingSpeedChanged; } UpdateEstimatedDuration(); @@ -418,6 +438,11 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Private Methods + private void StartJob() + { + IsJobRunning = true; + } + private async void SaveJobs() { if (SelectedMachine != null) @@ -625,6 +650,17 @@ namespace Tango.MachineStudio.Developer.ViewModels #endregion + #region Override Methods + + protected override void RaisePropertyChangedAuto([CallerMemberName] string caller = null) + { + base.RaisePropertyChangedAuto(caller); + + InvalidateRelayCommands(); + } + + #endregion + #region Public Events /// <summary> |
