OpenQuotesDashboard.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.ComponentModel;
  3. using System.Windows.Media;
  4. using Comal.Classes;
  5. using InABox.Configuration;
  6. using InABox.Core;
  7. using InABox.DynamicGrid;
  8. using PRSDesktop.WidgetGroups;
  9. namespace PRSDesktop.Dashboards
  10. {
  11. public class OpenQuotesDashboardProperties : IUserConfigurationSettings, IDashboardProperties
  12. {
  13. }
  14. public class OpenQuotesDashboardElement : DashboardElement<OpenQuotesDashboard, QuotesDashboardGroup,
  15. OpenQuotesDashboardProperties>
  16. {
  17. }
  18. public class OpenQuotesDashboard : DynamicDataGrid<Quote>,
  19. IDashboardWidget<QuotesDashboardGroup, OpenQuotesDashboardProperties>
  20. {
  21. public void Setup()
  22. {
  23. ActionColumns.Add(new DynamicMenuColumn(CreateMenu, GetStatus));
  24. ColumnsTag = GetType().Name;
  25. Refresh(true,false);
  26. }
  27. protected override void DoReconfigure(FluentList<DynamicGridOption> options)
  28. {
  29. base.DoReconfigure(options);
  30. options
  31. .BeginUpdate()
  32. .Clear()
  33. .Add(DynamicGridOption.SelectColumns)
  34. .EndUpdate();
  35. }
  36. private DynamicMenuStatus GetStatus(CoreRow row)
  37. {
  38. return DynamicMenuStatus.Enabled;
  39. }
  40. private void CreateMenu(DynamicMenuColumn menu, CoreRow? row)
  41. {
  42. }
  43. public void Shutdown(CancelEventArgs? cancel)
  44. {
  45. }
  46. public void Refresh()
  47. {
  48. Refresh(false, true);
  49. }
  50. protected override void Reload(Filters<Quote> criteria, Columns<Quote> columns, ref SortOrder<Quote>? sort, Action<CoreTable?, Exception?> action)
  51. {
  52. // criteria.Add(new Filter<Quote>(x => x.Status.Active).IsEqualTo(true));
  53. base.Reload(criteria, columns, ref sort, action);
  54. }
  55. protected override DynamicGridStyle GetRowStyle(CoreRow row, DynamicGridStyle style)
  56. {
  57. var result = base.GetRowStyle(row, style);
  58. result.Background = new SolidColorBrush(Colors.Firebrick);
  59. result.Foreground = new SolidColorBrush(Colors.Yellow);
  60. return result;
  61. }
  62. public OpenQuotesDashboardProperties Properties { get; set; }
  63. public event LoadSettings<OpenQuotesDashboardProperties>? LoadSettings;
  64. public event SaveSettings<OpenQuotesDashboardProperties>? SaveSettings;
  65. }
  66. }