IDynamicGridUIComponent.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using InABox.Core;
  2. using Syncfusion.Data;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Input;
  11. namespace InABox.DynamicGrid;
  12. public interface IDynamicGridUIComponentParent<T> : IDynamicGrid<T>
  13. where T : BaseObject, new()
  14. {
  15. bool IsRefreshing { get; }
  16. bool CanFilter();
  17. bool CanSort();
  18. DynamicGridRowStyleSelector<T> RowStyleSelector { get; }
  19. void BeforeSelection(CancelEventArgs cancel);
  20. void SelectItems(CoreRow[] rows);
  21. void HandleKey(KeyEventArgs args);
  22. void LoadColumnsMenu(ContextMenu menu);
  23. BaseEditor CustomiseEditor(DynamicGridColumn column, BaseEditor editor);
  24. void DoubleClickCell(CoreRow? row, DynamicColumnBase? column);
  25. void ExecuteActionColumn(DynamicActionColumn column, CoreRow[]? rows);
  26. void OpenColumnMenu(DynamicColumnBase column);
  27. void UpdateData(T obj, CoreRow row, string changedColumn, Dictionary<CoreColumn, object?> updates);
  28. void EntityChanged(T obj, CoreRow row, string changedColumn, Dictionary<string, object?> changes);
  29. void UpdateRecordCount(int count);
  30. public bool IsDirectEditMode();
  31. void DragOver(object sender, DragEventArgs e);
  32. void Drop(object sender, DragEventArgs e);
  33. void DragStart(object? sender, CoreRow[] rows);
  34. /// <summary>
  35. /// Move the given rows from where they are, inserting them at <paramref name="index"/>. (i.e., before the row at the given index).
  36. /// To insert at the end, set <paramref name="index"/> to the number of rows.
  37. /// </summary>
  38. /// <remarks>
  39. /// Only applicable if <typeparamref name="T"/> is <see cref="ISequenceable"/>.
  40. /// </remarks>
  41. void MoveRows(CoreRow[] rows, int index);
  42. void UIFilterChanged(object sender);
  43. IEnumerable<string>? GetColumnFilterItems(DynamicColumnBase column);
  44. }
  45. public interface IDynamicGridUIComponent<T>
  46. where T : BaseObject, new()
  47. {
  48. IDynamicGridUIComponentParent<T> Parent { get; set; }
  49. FrameworkElement Control { get; }
  50. CoreRow[] SelectedRows { get; set; }
  51. double RowHeight { get; set; }
  52. double HeaderRowHeight { get; set; }
  53. int DesiredWidth();
  54. /// <summary>
  55. /// Do any required updates when the options list is changed.
  56. /// </summary>
  57. /// <returns>Whether the columns need to be reloaded.</returns>
  58. bool OptionsChanged();
  59. void UpdateRow(CoreRow row);
  60. void UpdateCell(CoreRow row, string column, object? value);
  61. void UpdateCell(CoreRow row, DynamicColumnBase column);
  62. void AddVisualFilter(string column, string value, FilterType filtertype = FilterType.Contains);
  63. List<Tuple<string, Func<CoreRow, bool>>> GetFilterPredicates();
  64. void BeforeRefresh();
  65. void RefreshColumns(IEnumerable<DynamicColumnBase> columns, DynamicGridColumnGroupings groupings);
  66. void RefreshData(CoreTable data);
  67. void AddPage(IEnumerable<CoreRow> page);
  68. void InvalidateRow(CoreRow row);
  69. void ScrollIntoView(CoreRow row);
  70. CoreRow[] GetVisibleRows();
  71. }