MasterDetailPanelPage.cs 911 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections.Generic;
  2. using InABox.Core;
  3. using InABox.DynamicGrid;
  4. namespace InABox.Wpf;
  5. public abstract class MasterDetailPanelPage<TMaster,TPanel> : MasterDetailPage<TMaster>
  6. where TPanel : class, IBasePanel, IMasterDetailControl<TMaster>, new()
  7. {
  8. public MasterDetailPanelPage(DynamicTabItem tab) : base(tab) { }
  9. public TPanel? Panel { get; set; }
  10. public override Dictionary<string, object[]>? Selected() => Panel?.Selected();
  11. protected abstract void DoRefresh(TPanel panel);
  12. protected override IDataModelSource Refresh()
  13. {
  14. if (Panel == null)
  15. {
  16. Panel = new TPanel
  17. {
  18. IsReady = false
  19. };
  20. Panel.Setup();
  21. Panel.IsReady = true;
  22. Tab.Content = Panel;
  23. }
  24. Panel.Master = Master;
  25. DoRefresh(Panel);
  26. return Panel;
  27. }
  28. }