IDynamicGridUIComponent.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 CanSort();
  17. DynamicGridRowStyleSelector<T> RowStyleSelector { get; }
  18. void BeforeSelection(CancelEventArgs cancel);
  19. void SelectItems(CoreRow[] rows);
  20. void HandleKey(KeyEventArgs args);
  21. void LoadColumnsMenu(ContextMenu menu);
  22. BaseEditor CustomiseEditor(DynamicGridColumn column, BaseEditor editor);
  23. void DoubleClickCell(CoreRow? row, DynamicColumnBase? column);
  24. void ExecuteActionColumn(DynamicActionColumn column, CoreRow[]? rows);
  25. void OpenColumnMenu(DynamicColumnBase column);
  26. void UpdateData(T obj, CoreRow row, string changedColumn, Dictionary<CoreColumn, object?> updates);
  27. void EntityChanged(T obj, CoreRow row, string changedColumn, Dictionary<string, object?> changes);
  28. void UpdateRecordCount(int count);
  29. public bool IsDirectEditMode();
  30. void DragOver(object sender, DragEventArgs e);
  31. void Drop(object sender, DragEventArgs e);
  32. void DragStart(object? sender, CoreRow[] rows);
  33. void UIFilterChanged(object sender);
  34. IEnumerable<string>? GetColumnFilterItems(DynamicColumnBase column);
  35. }
  36. public interface IDynamicGridUIComponent<T>
  37. where T : BaseObject, new()
  38. {
  39. IDynamicGridUIComponentParent<T> Parent { get; set; }
  40. FrameworkElement Control { get; }
  41. CoreRow[] SelectedRows { get; set; }
  42. double RowHeight { get; set; }
  43. double HeaderRowHeight { get; set; }
  44. int DesiredWidth();
  45. /// <summary>
  46. /// Do any required updates when the options list is changed.
  47. /// </summary>
  48. /// <returns>Whether the columns need to be reloaded.</returns>
  49. bool OptionsChanged();
  50. void UpdateRow(CoreRow row);
  51. void UpdateCell(CoreRow row, string column, object? value);
  52. void UpdateCell(CoreRow row, DynamicColumnBase column);
  53. void AddVisualFilter(string column, string value, FilterType filtertype = FilterType.Contains);
  54. List<Tuple<string, Func<CoreRow, bool>>> GetFilterPredicates();
  55. void BeforeRefresh();
  56. void RefreshColumns(IEnumerable<DynamicColumnBase> columns, DynamicGridColumnGroupings groupings);
  57. void RefreshData(CoreTable data);
  58. void AddPage(IEnumerable<CoreRow> page);
  59. void InvalidateRow(CoreRow row);
  60. void ScrollIntoView(CoreRow row);
  61. CoreRow[] GetVisibleRows();
  62. }