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 | 71 |
1 files changed, 69 insertions, 2 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 e77093eee..4e3b4ec13 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 @@ -121,7 +121,17 @@ namespace Tango.MachineStudio.Developer.ViewModels public Segment SelectedSegment { get { return _selectedSegment; } - set { _selectedSegment = value; RaisePropertyChangedAuto(); } + set { _selectedSegment = value; RaisePropertyChangedAuto(); OnSelectedSegmentChanged(); } + } + + private BrushStop _selectedBrushStop; + /// <summary> + /// Gets or sets the selected segment selected brush stop. + /// </summary> + public BrushStop SelectedBrushStop + { + get { return _selectedBrushStop; } + set { _selectedBrushStop = value; RaisePropertyChangedAuto(); } } private Rml _selectedRML; @@ -219,6 +229,16 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> public RelayCommand RemoveJobCommand { get; set; } + /// <summary> + /// Gets or sets the add brush stop command. + /// </summary> + public RelayCommand AddBrushStopCommand { get; set; } + + /// <summary> + /// Gets or sets the remove brush stop command. + /// </summary> + public RelayCommand RemoveBrushStopCommand { get; set; } + #endregion #region Constructors @@ -258,6 +278,8 @@ namespace Tango.MachineStudio.Developer.ViewModels RemoveSegmentCommand = new RelayCommand(RemoveSegment); AddJobCommand = new RelayCommand(AddJob); RemoveJobCommand = new RelayCommand(RemoveJob); + AddBrushStopCommand = new RelayCommand(AddBrushStop); + RemoveBrushStopCommand = new RelayCommand(RemoveBrushStop); } #endregion @@ -279,9 +301,21 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Virtual Methods /// <summary> + /// Called when the selected segment has been changed + /// </summary> + protected virtual void OnSelectedSegmentChanged() + { + if (SelectedSegment != null) + { + SetSegmentBrushStopsInkVolumes(SelectedSegment); + SelectedBrushStop = SelectedSegment.BrushStops.FirstOrDefault(); + } + } + + /// <summary> /// Called when the selected job has been changed. /// </summary> - private void OnSelectedJobChanged() + protected virtual void OnSelectedJobChanged() { if (SelectedJob != null) { @@ -312,6 +346,14 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Private Methods + private void SetSegmentBrushStopsInkVolumes(Segment segment) + { + foreach (var stop in segment.BrushStops) + { + stop.SetInkVolumes(SelectedMachine.Configuration); + } + } + /// <summary> /// Saves the liquid factors. /// </summary> @@ -460,6 +502,31 @@ namespace Tango.MachineStudio.Developer.ViewModels } } + /// <summary> + /// Removes the selected brush stop. + /// </summary> + private void RemoveBrushStop() + { + if (SelectedBrushStop != null && SelectedSegment != null) + { + SelectedSegment.BrushStops.Remove(SelectedBrushStop); + } + } + + /// <summary> + /// Adds a new brush stop to the selected segment. + /// </summary> + private void AddBrushStop() + { + if (SelectedSegment != null) + { + var stop = new BrushStop(); + stop.ColorSpace = Adapter.ColorSpaces.FirstOrDefault(); + stop.SetInkVolumes(SelectedMachine.Configuration); + SelectedSegment.BrushStops.Add(stop); + } + } + #endregion #region Public Events |
