|
@@ -2,6 +2,7 @@
|
|
|
using InABox.Wpf;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Diagnostics.CodeAnalysis;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading;
|
|
@@ -9,9 +10,20 @@ using System.Threading.Tasks;
|
|
|
|
|
|
namespace InABox.DynamicGrid
|
|
|
{
|
|
|
- public class DynamicGridFilterGrid : DynamicGrid<CoreFilterDefinition>
|
|
|
+ public class DynamicGridFilterGrid : DynamicItemsListGrid<CoreFilterDefinition>
|
|
|
{
|
|
|
- public CoreFilterDefinitions Filters;
|
|
|
+ private CoreFilterDefinitions _filters;
|
|
|
+ public CoreFilterDefinitions Filters
|
|
|
+ {
|
|
|
+ get => _filters;
|
|
|
+ [MemberNotNull(nameof(_filters))]
|
|
|
+ set
|
|
|
+ {
|
|
|
+ _filters = value;
|
|
|
+ Items = value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private Type FilterType;
|
|
|
|
|
|
public DynamicGridFilterGrid(Type filterType)
|
|
@@ -42,39 +54,5 @@ namespace InABox.DynamicGrid
|
|
|
filterEditor.Type = FilterType;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- public override void DeleteItems(params CoreRow[] rows)
|
|
|
- {
|
|
|
- foreach (var row in rows.OrderByDescending(x => x.Index))
|
|
|
- Filters.RemoveAt(row.Index);
|
|
|
- }
|
|
|
-
|
|
|
- public override CoreFilterDefinition LoadItem(CoreRow row)
|
|
|
- {
|
|
|
- var index = Data.Rows.IndexOf(row);
|
|
|
- return Filters[index];
|
|
|
- }
|
|
|
-
|
|
|
- protected override void Reload(
|
|
|
- Filters<CoreFilterDefinition> criteria, Columns<CoreFilterDefinition> columns, ref SortOrder<CoreFilterDefinition>? sort,
|
|
|
- CancellationToken token, Action<CoreTable?, Exception?> action)
|
|
|
- {
|
|
|
- var result = new CoreTable();
|
|
|
- if (columns == null || columns.Count == 0)
|
|
|
- result.LoadColumns(typeof(CoreFilterDefinition));
|
|
|
- else
|
|
|
- result.LoadColumns(columns);
|
|
|
- result.LoadRows(Filters);
|
|
|
- action.Invoke(result, null);
|
|
|
- }
|
|
|
-
|
|
|
- public override void SaveItem(CoreFilterDefinition item)
|
|
|
- {
|
|
|
- if (!Filters.Contains(item))
|
|
|
- {
|
|
|
- Filters.Add(item);
|
|
|
- }
|
|
|
- Filters.Sort((x, y) => x.Sequence.CompareTo(y.Sequence));
|
|
|
- }
|
|
|
}
|
|
|
}
|