aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
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.cs47
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?"))