diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-08-02 12:44:48 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-08-02 12:44:48 +0300 |
| commit | 8341015db09be9aa52f7b349792ecaa394d73680 (patch) | |
| tree | 768b33719802357782e270b37d38cfdf7ef03b2a /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs | |
| parent | 9b8bd5cac01ad553ebbda9b1b40be1bcd535c47e (diff) | |
| parent | 8a5c623fd4e3247b4b24f430c14725f7a9986433 (diff) | |
| download | Tango-8341015db09be9aa52f7b349792ecaa394d73680.tar.gz Tango-8341015db09be9aa52f7b349792ecaa394d73680.zip | |
head type name change
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs | 47 |
1 files changed, 46 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?")) |
