IDynamicGridUIComponent.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using InABox.Core;
  2. using Syncfusion.Data;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Input;
  12. namespace InABox.DynamicGrid;
  13. public interface IDynamicGridUIComponentParent<T> : IDynamicGrid<T>
  14. where T : BaseObject, new()
  15. {
  16. bool IsRefreshing { get; }
  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. 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(IEnumerable<DynamicGridOption>? options = null);
  30. void DragOver(object sender, DragEventArgs e);
  31. void Drop(object sender, DragEventArgs e);
  32. void DragStart(object? sender, CoreRow[] rows);
  33. }
  34. public interface IDynamicGridUIComponent<T>
  35. where T : BaseObject, new()
  36. {
  37. IDynamicGridUIComponentParent<T> Parent { set; }
  38. FrameworkElement Control { get; }
  39. CoreRow[] SelectedRows { get; set; }
  40. double RowHeight { get; set; }
  41. double HeaderRowHeight { get; set; }
  42. int DesiredWidth();
  43. /// <summary>
  44. /// Do any required updates when the options list is changed.
  45. /// </summary>
  46. /// <returns>Whether the columns need to be reloaded.</returns>
  47. bool OptionsChanged();
  48. void UpdateRow(CoreRow row);
  49. void UpdateCell(CoreRow row, string column, object? value);
  50. void AddVisualFilter(string column, string value, FilterType filtertype = FilterType.Contains);
  51. List<Tuple<string, Func<CoreRow, bool>>> GetFilterPredicates();
  52. void BeforeRefresh();
  53. void RefreshColumns(DynamicGridColumns columns, DynamicActionColumns actionColumns);
  54. void RefreshData(CoreTable data);
  55. void InvalidateRow(CoreRow row);
  56. void ScrollIntoView(CoreRow row);
  57. CoreRow[] GetVisibleRows();
  58. }