diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-07-30 14:52:41 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-07-30 14:52:41 +0300 |
| commit | 064bb0517aa7f8a1906761ae099cf44b785cff9f (patch) | |
| tree | b8cb0b03a486f1bc09b2f8de50319cef7ad29d48 /Software/Visual_Studio/MachineStudio/Modules | |
| parent | 4c4bf90e9b981c41f5329c74ac3cb6c8cbb97c6e (diff) | |
| download | Tango-064bb0517aa7f8a1906761ae099cf44b785cff9f.tar.gz Tango-064bb0517aa7f8a1906761ae099cf44b785cff9f.zip | |
Added filter to RML page
Related Work Items: #3286
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
2 files changed, 50 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index d4bb07a9b..c31c95800 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -34,6 +34,7 @@ namespace Tango.MachineStudio.RML.ViewModels private IAuthenticationProvider _authentication; private IActionLogManager _actionLogManager; private RmlDTO _rmlBeforeSave; + private static object _syncLock = new object(); private ObservablesContext _rmls_context; private ObservablesContext _active_context; @@ -45,6 +46,22 @@ namespace Tango.MachineStudio.RML.ViewModels set { _rmls = value; RaisePropertyChangedAuto(); } } + private ICollectionView _rmlssCollectionView; + /// <summary> + /// Gets or sets the RML collection view. + /// </summary> + public ICollectionView RmlsCollectionView + { + get { return _rmlssCollectionView; } + set + { + _rmlssCollectionView = value; + BindingOperations.EnableCollectionSynchronization(_rmlssCollectionView, _syncLock); + + RaisePropertyChangedAuto(); + } + } + private ObservableCollection<MediaMaterial> _materials; public ObservableCollection<MediaMaterial> Materials { @@ -171,6 +188,16 @@ namespace Tango.MachineStudio.RML.ViewModels set { _colorCalibrationVM = value; RaisePropertyChangedAuto(); } } + private String _RMLFilter; + /// <summary> + /// Gets or sets the job filter. + /// </summary> + public String RMLFilter + { + get { return _RMLFilter; } + set { _RMLFilter = value; RaisePropertyChangedAuto(); OnRMLFilterChanged(); } + } + /// <summary> /// Gets or sets the manage RML command. /// </summary> @@ -262,7 +289,6 @@ namespace Tango.MachineStudio.RML.ViewModels _rmls_context = ObservablesContext.CreateDefault(); Rmls = await new RmlsCollectionBuilder(_rmls_context).SetAll().WithLiquidFactors().WithMediaProperties().BuildAsync(); - //Load CCT file names... var ccts = await _rmls_context.Ccts.Select(x => new { @@ -283,6 +309,8 @@ namespace Tango.MachineStudio.RML.ViewModels }; } } + RmlsCollectionView = CollectionViewSource.GetDefaultView(Rmls); + RmlsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Rml.LastUpdated), ListSortDirection.Descending)); } private async void LoadActiveRML(String guid) @@ -653,6 +681,23 @@ namespace Tango.MachineStudio.RML.ViewModels ActiveProcessParametersTableView.Refresh(); } + private void OnRMLFilterChanged() + { + String filter = RMLFilter.ToLower(); + + RmlsCollectionView.Filter = (rml) => + { + Rml r = rml as Rml; + return String.IsNullOrWhiteSpace(filter) + || + r.Name.ToLower().Contains(filter) //Rml name + || + (r.MediaMaterial != null && r.MediaMaterial.Name.ToLower().Contains(filter)) // Material name + || + (r.Cct != null && r.Cct.FileName != null && r.Cct.FileName.ToString().Contains(filter)); //Cct.FileName + }; + } + private void RemoveLiquidFactor(LiquidTypesRml liquidFactor) { if (_notification.ShowQuestion("Removing this liquid factor will remove the liquid type association with the RML and will drop the calibration data. Are you sure?")) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml index 288f00a3d..18af6bed5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -22,6 +22,10 @@ <DockPanel Margin="100 100 100 50" MaxWidth="1200"> <Grid DockPanel.Dock="Top"> <Image Source="../Images/threads.png" Width="300" Margin="10" /> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 10 30"> + <materialDesign:PackIcon Kind="Magnify" Width="26" Height="26"/> + <TextBox Width="300" materialDesign:HintAssist.Hint="Search name, material,..." Text="{Binding RMLFilter,UpdateSourceTrigger=PropertyChanged}"></TextBox> + </StackPanel> </Grid> <Grid DockPanel.Dock="Bottom"> <StackPanel> |
