diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-09-12 12:47:01 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-09-12 12:47:56 +0300 |
| commit | 69a68e9a8b5dd452373cf2c4065e1a50178cfa02 (patch) | |
| tree | b03bd3143bde3f5476ed4a5b080142b33381253a /Software/Visual_Studio/MachineStudio | |
| parent | 3c0b20184527064f1c5d9374894f3d9ec44672e3 (diff) | |
| download | Tango-69a68e9a8b5dd452373cf2c4065e1a50178cfa02.tar.gz Tango-69a68e9a8b5dd452373cf2c4065e1a50178cfa02.zip | |
MachineStudio. Sites. selected RMLs using a text button: “Show selected”. Also allow to filter by words by using: “Filter:_abc_____”
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
2 files changed, 67 insertions, 2 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs index 02c9f4346..bf2ebdbcf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs @@ -14,6 +14,8 @@ using Tango.MachineStudio.Common.Authentication; using Tango.BL.ActionLogs; using Tango.BL.DTO; using Tango.BL.Builders; +using System.ComponentModel; +using System.Windows.Data; namespace Tango.MachineStudio.Sites.ViewModels { @@ -70,12 +72,44 @@ namespace Tango.MachineStudio.Sites.ViewModels set { _spoolTypes = value; RaisePropertyChangedAuto(); } } + private bool _showSelectedRMLsOnly; + + public bool ShowSelectedRMLsOnly + { + get { return _showSelectedRMLsOnly; } + set { _showSelectedRMLsOnly = value; + RaisePropertyChangedAuto(); RMLCollection.Refresh(); } + } + + private String _RMLFilter; + + public String RMLFilter + { + get { return _RMLFilter; } + set { + _RMLFilter = value; + RaisePropertyChangedAuto(); + RMLCollection.Refresh(); + } + } + + + private ICollectionView _rmlscollectionFilter; + public ICollectionView RMLCollection + { + get { return _rmlscollectionFilter; } + set { _rmlscollectionFilter = value; + RaisePropertyChangedAuto(); } + } + + public RelayCommand SaveCommand { get; set; } public SiteDetailsViewVM() { SaveCommand = new RelayCommand(Save, () => IsFree); + _showSelectedRMLsOnly = true; } public async Task Init(String siteGuid, INotificationProvider notification, IAuthenticationProvider authentication, IActionLogManager actionLogManager, bool isNew, string newSiteName = null) @@ -127,6 +161,29 @@ namespace Tango.MachineStudio.Sites.ViewModels } _siteBeforeSave = SiteDTO.FromObservable(Site); + + RMLCollection = CollectionViewSource.GetDefaultView(Rmls); + RMLCollection.Filter = new Predicate<object>(x => + { + SelectedObject Sel_rml = x as SelectedObject; + + if (!String.IsNullOrEmpty(RMLFilter))// by filter and check box Show selected only + { + var rml = Sel_rml.Data as Rml; + if (rml != null && rml.Name.ToLower().Contains(RMLFilter.ToLower())) + { + return ShowSelectedRMLsOnly ? Sel_rml.IsSelected : true; + } + else + return false; + } + else + { + return ShowSelectedRMLsOnly ? Sel_rml.IsSelected : true; + } + + + }); } private async void Save() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/Views/SiteDetailsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/Views/SiteDetailsView.xaml index b4da6f35c..e6c2e78f9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/Views/SiteDetailsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/Views/SiteDetailsView.xaml @@ -114,9 +114,11 @@ <DockPanel Margin="10"> <TextBlock DockPanel.Dock="Top" FontSize="16">SITE RML</TextBlock> + <Grid> - <materialDesign:Card Margin="0 5 0 0" Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch"> - <DataGrid ItemsSource="{Binding Rmls}" Style="{StaticResource GridStyle}" CellStyle="{StaticResource CellStyle}"> + <materialDesign:Card Margin="0 5 0 0" Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch"> + <DataGrid ItemsSource="{Binding RMLCollection}" Style="{StaticResource GridStyle}" CellStyle="{StaticResource CellStyle}"> + <DataGrid.Columns> <DataGridTemplateColumn Header="" Width="Auto"> <DataGridTemplateColumn.CellTemplate> @@ -129,6 +131,12 @@ </DataGrid.Columns> </DataGrid> </materialDesign:Card> + <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="120 20 0 10"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="Magnify" Width="20" Height="20" /> + <TextBox Width="200" FontSize="16" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Name" Text="{Binding RMLFilter,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ></TextBox> + </StackPanel> + <CheckBox IsChecked="{Binding ShowSelectedRMLsOnly, Mode=TwoWay}" Content="Selected" FontSize="16" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0 25 20 0"/> + </Grid> </DockPanel> <DockPanel Margin="10" Grid.Column="1"> |
