IPanel.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using InABox.Configuration;
  6. using InABox.Core;
  7. namespace PRSDesktop
  8. {
  9. public class PanelAction
  10. {
  11. public Action<PanelAction> OnExecute { get; set; }
  12. public string Caption { get; set; }
  13. public Bitmap Image { get; set; }
  14. public void Execute()
  15. {
  16. OnExecute?.Invoke(this);
  17. }
  18. }
  19. public interface ICorePanel
  20. {
  21. void Setup();
  22. /// <summary>
  23. /// Shutdown the panel.
  24. /// </summary>
  25. /// <param name="cancel">If the operation can be cancelled, this is not <see langword="null"/></param>
  26. void Shutdown(CancelEventArgs? cancel);
  27. void Refresh();
  28. }
  29. public interface IBasePanel : ICorePanel, IDataModelSource
  30. {
  31. bool IsReady { get; set; }
  32. void CreateToolbarButtons(IPanelHost host);
  33. Dictionary<string, object[]> Selected();
  34. void Heartbeat(TimeSpan time);
  35. }
  36. public interface IPanel<T> : IBasePanel
  37. {
  38. }
  39. public interface IPropertiesPanel<TProperties>
  40. where TProperties : BaseObject, IGlobalConfigurationSettings, new()
  41. {
  42. public TProperties Properties { get; set; }
  43. }
  44. public interface IPropertiesPanel<TProperties, TSecurity> : IPropertiesPanel<TProperties>
  45. where TProperties : BaseObject, IGlobalConfigurationSettings, new()
  46. where TSecurity : ISecurityDescriptor, new()
  47. {
  48. }
  49. public interface IPanelHost
  50. {
  51. void CreatePanelAction(PanelAction action);
  52. void CreateSetupAction(PanelAction action);
  53. }
  54. }