IDynamicGridUIComponent.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. void UIFilterChanged(object sender);
  34. }
  35. public interface IDynamicGridUIComponent<T>
  36. where T : BaseObject, new()
  37. {
  38. IDynamicGridUIComponentParent<T> Parent { set; }
  39. FrameworkElement Control { get; }
  40. CoreRow[] SelectedRows { get; set; }
  41. double RowHeight { get; set; }
  42. double HeaderRowHeight { get; set; }
  43. int DesiredWidth();
  44. /// <summary>
  45. /// Do any required updates when the options list is changed.
  46. /// </summary>
  47. /// <returns>Whether the columns need to be reloaded.</returns>
  48. bool OptionsChanged();
  49. void UpdateRow(CoreRow row);
  50. void UpdateCell(CoreRow row, string column, object? value);
  51. void AddVisualFilter(string column, string value, FilterType filtertype = FilterType.Contains);
  52. List<Tuple<string, Func<CoreRow, bool>>> GetFilterPredicates();
  53. void BeforeRefresh();
  54. void RefreshColumns(DynamicGridColumns columns, DynamicActionColumns actionColumns);
  55. void RefreshData(CoreTable data);
  56. void InvalidateRow(CoreRow row);
  57. void ScrollIntoView(CoreRow row);
  58. CoreRow[] GetVisibleRows();
  59. }