From 3c0b20184527064f1c5d9374894f3d9ec44672e3 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 10 Sep 2023 15:00:28 +0300 Subject: Add My Color - add command to save on OK, added name and selection to ListBox. libraries --- .../Dialogs/ColorSelectionView.xaml | 29 +++++++--- .../Dialogs/ColorSelectionViewVM.cs | 67 ++++++++++++++++++---- .../Tango.PPC.JobsV2/Models/ColorLibrary.cs | 19 +++++- 3 files changed, 96 insertions(+), 19 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml index e737a8f7a..3ec03eff7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml @@ -51,7 +51,7 @@ - + @@ -170,7 +170,7 @@ - + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index 3146da179..37f5c3f7b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -323,6 +323,24 @@ namespace Tango.PPC.Jobs.Dialogs private ColorLibrary SelectedColorLibrary { get; set; } + private ColorLibrary _selectedColorLibraryMyColor; + + public ColorLibrary SelectedColorLibraryMyColor + { + get { return _selectedColorLibraryMyColor; } + set { + if(_selectedColorLibraryMyColor != null) + _selectedColorLibraryMyColor.IsSelected = false; + + _selectedColorLibraryMyColor = value; + + if (_selectedColorLibraryMyColor != null) + _selectedColorLibraryMyColor.IsSelected = true; + RaisePropertyChangedAuto(); + } + } + + private FavoriteColor _selectedColor; public FavoriteColor SelectedColor @@ -446,10 +464,11 @@ namespace Tango.PPC.Jobs.Dialogs /// /// Gets or sets the save my colors command. /// + public RelayCommand OpenCloseAddMyColorDialogCommand { get; set; } public RelayCommand SaveMyColorsCommand { get; set; } public RelayCommand AddNewGroupCommand { get; set; } public RelayCommand AddNewGroupAndColorCommand { get; set; } - public RelayCommand AddColorToLibraryCommand { get; set; } + public RelayCommand SelectLibraryCommand { get; set; } /// /// Gets or sets the open my colors command. @@ -501,6 +520,7 @@ namespace Tango.PPC.Jobs.Dialogs } }); + OpenCloseAddMyColorDialogCommand = new RelayCommand(OpenCloseAddMyColorDialog); SaveMyColorsCommand = new RelayCommand(SaveMyColors); OpenMyColorsCommand = new RelayCommand(() => { MyColorsMode = true; }); CloseMyColorsCommand = new RelayCommand(() => { MyColorsMode = false; SearchColorText = "";}); @@ -508,7 +528,8 @@ namespace Tango.PPC.Jobs.Dialogs AddGroupCommand = new RelayCommand(AddGroup); AddNewGroupCommand = new RelayCommand(AddNewGroup); AddNewGroupAndColorCommand = new RelayCommand(AddNewGroupAndColor); - AddColorToLibraryCommand = new RelayCommand(AddColorToLibrary); + + SelectLibraryCommand = new RelayCommand(SelectLibrary); DeleteGroupCommand = new RelayCommand(DeleteGroup); EditColorsLibraryCommand = new RelayCommand(EditColorsLibrary); EditColorsLibrariesCommand = new RelayCommand(EditColorsLibraries); @@ -824,7 +845,7 @@ namespace Tango.PPC.Jobs.Dialogs #region MyColors - private void SaveMyColors() + private void OpenCloseAddMyColorDialog() { if(IsBusy) return; @@ -866,17 +887,37 @@ namespace Tango.PPC.Jobs.Dialogs else { SaveMyColorMode = !SaveMyColorMode; + //Init MyColorName on open the dialog String colorName = "MyColor"; - if (SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null - && SelectedBrushStop.SegmentModel.Job != null) + if ( SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null && SelectedBrushStop.SegmentModel.Job != null ) { colorName = SelectedBrushStop.SegmentModel.Job.Name; if(colorName.Length > 40) colorName = colorName.Substring(0, 40); } MyColorName = colorName; + SelectedColorLibraryMyColor = null; + AddGroupMode = false; } - + IsBusy = false; + + } + + /// + /// Saves my colors on OK button of dialog "Add my Color" + /// + private void SaveMyColors() + { + if (IsBusy) + return; + IsBusy = true; + if (SelectedColorLibraryMyColor != null) + { + AddColorToLibrary(SelectedColorLibraryMyColor); + } + SelectedColorLibraryMyColor = null; + AddGroupMode = false; + SaveMyColorMode = false; IsBusy = false; } @@ -932,14 +973,15 @@ namespace Tango.PPC.Jobs.Dialogs { NotificationProvider.ShowInfo("A group with this name already exists. Try adding a different name."); } + SelectedColorLibrary = library; - AddColorToLibrary(library); + // AddColorToLibrary(library); } NewGroupName = "Library" + (Libraries.Count() + 1); - SaveMyColorMode = false; - AddGroupMode = false; + //SaveMyColorMode = false; + //AddGroupMode = false; } - + /// /// Adds the selected color to library in Save my Colors. /// @@ -985,6 +1027,11 @@ namespace Tango.PPC.Jobs.Dialogs SaveMyColorMode = false; } + private void SelectLibrary(ColorLibrary library) + { + SelectedColorLibraryMyColor = library; + } + private void SelectColor(FavoriteColor favoriteColor) { SelectedColor = favoriteColor; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs index 62dc7ec1b..284b2c787 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs @@ -16,6 +16,7 @@ namespace Tango.PPC.Jobs.Models { public class ColorLibrary: ExtendedObject { + #region Properties private ObservableCollection _colorList; public ObservableCollection ColorList { @@ -51,7 +52,23 @@ namespace Tango.PPC.Jobs.Models OnEditGroupModeChanged(); RaisePropertyChangedAuto(); } } - + + private bool _isSelected; + [BsonIgnore] + public bool IsSelected + { + get { + return _isSelected; + } + set { + _isSelected = value; + RaisePropertyChangedAuto(); + } + } + + + #endregion + public ColorLibrary() { _colorList = new ObservableCollection(); -- cgit v1.3.1 From 38200150dd731b158448316835b069d3fef2bc8f Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Thu, 14 Sep 2023 13:21:10 +0300 Subject: Select All in PPC - new icon. --- .../Tango.PPC.JobsV2/Images/JobView/select_all.png | Bin 0 -> 787 bytes .../Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj | 5 +++- .../Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs | 19 +++++++++++++ .../Modules/Tango.PPC.JobsV2/Views/JobsView.xaml | 22 +++++++++++++-- .../Tango.Touch/Controls/LightTouchDataGrid.cs | 31 ++++++++++++++++++++- 5 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/select_all.png (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/select_all.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/select_all.png new file mode 100644 index 000000000..0a27c2aaa Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/select_all.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj index 96083d842..33ccc5b53 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj @@ -752,10 +752,13 @@ + + + - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs index e5e41b382..5f005385e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs @@ -185,6 +185,16 @@ namespace Tango.PPC.Jobs.ViewModels set { _collectionFilter = value; RaisePropertyChangedAuto(); } } + private bool _selectAll; + + public bool SelectAll + { + get { return _selectAll; } + set { _selectAll = value; + RaisePropertyChangedAuto();} + } + + #endregion @@ -230,6 +240,8 @@ namespace Tango.PPC.Jobs.ViewModels /// public RelayCommand MoveToListJobsCommand { get; set; } + public RelayCommand SelectAllJobsCommand { get; set; } + #endregion #region Constructors @@ -257,6 +269,7 @@ namespace Tango.PPC.Jobs.ViewModels CloneJobsCommand = new RelayCommand(() => CloneJobs(SelectedJobs)); ExportJobCommand = new RelayCommand(ExportJob); MoveToListJobsCommand = new RelayCommand(() => MoveToListJobs(SelectedJobs)); + SelectAllJobsCommand = new RelayCommand(SelectAllJobs); RegisterForMessage(HandleJobRemovedMessage); RegisterForMessage(HandleJobSavedMessage); @@ -421,6 +434,12 @@ namespace Tango.PPC.Jobs.ViewModels IsMultiSelecting = false; } + private void SelectAllJobs() + { + SelectAll = !SelectAll; + } + + /// /// Adds a new job. /// diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml index d3fdedde5..b57619c8c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml @@ -35,6 +35,8 @@ + + @@ -94,6 +96,22 @@ + + + + + + + +