OpenQuotesDashboard.cs 2.2 KB

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