From f99f56c619bed96ab7b75be8477dec6e504bad7e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 27 Jun 2018 16:42:04 +0300 Subject: Implemented segment & brush stop remove. --- .../Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml | 12 ++++++- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 41 ++++++++++++++++++++++ .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 5 +-- .../PPC/Tango.PPC.Common/Resources/Merged.xaml | 1 + .../PPCApplication/DefaultPPCApplicationManager.cs | 7 +++- .../Tango.BL/EntitiesExtensions/Segment.cs | 9 +++++ .../Tango.Settings/SettingsManager.cs | 8 +++++ 7 files changed, 79 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml index c674b57fe..48116c581 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml @@ -34,7 +34,17 @@ - + + + + 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 90e404307..5edab6255 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 @@ -131,6 +131,16 @@ namespace Tango.PPC.Jobs.ViewModels /// public RelayCommand SegmentDroppedCommand { get; set; } + /// + /// Gets or sets the remove segment command. + /// + public RelayCommand RemoveSegmentCommand { get; set; } + + /// + /// Gets or sets the remove brush stop command. + /// + public RelayCommand RemoveBrushStopCommand { get; set; } + #endregion #region Constructors @@ -157,6 +167,9 @@ namespace Tango.PPC.Jobs.ViewModels (e.Draggable as FrameworkElement).DataContext as Segment, (e.Droppable as FrameworkElement).DataContext as Segment); }); + + RemoveSegmentCommand = new RelayCommand(RemoveSegment); + RemoveBrushStopCommand = new RelayCommand(RemoveBrushStop); } #endregion @@ -205,6 +218,18 @@ namespace Tango.PPC.Jobs.ViewModels SegmentsCollectionView.Refresh(); } + /// + /// Removes the segment. + /// + /// The segment. + private async void RemoveSegment(Segment segment) + { + if (await NotificationProvider.ShowQuestion("Are you sure you want to remove the selected segment?")) + { + Job.Segments.Remove(segment); + } + } + #endregion #region Brush Stops Management @@ -218,6 +243,22 @@ namespace Tango.PPC.Jobs.ViewModels segment.AddBrushStop(); } + /// + /// Removes the brush stop. + /// + /// The brush stop. + private void RemoveBrushStop(BrushStop brushStop) + { + if (brushStop.Segment.BrushStops.Count > 2) + { + brushStop.Segment.BrushStops.Remove(brushStop); + } + else + { + NotificationProvider.ShowInfo("Gradient segments must contain at least two colors."); + } + } + #endregion #region Job Selection Message diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 26a0db10f..e9fb4cde4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -163,7 +163,7 @@ - +