OpenQuotesDashboard.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.ComponentModel;
  3. using System.Threading;
  4. using System.Windows.Media;
  5. using Comal.Classes;
  6. using InABox.Configuration;
  7. using InABox.Core;
  8. using InABox.DynamicGrid;
  9. using PRSDesktop.WidgetGroups;
  10. namespace PRSDesktop.Dashboards
  11. {
  12. public class OpenQuotesDashboardProperties : IUserConfigurationSettings, IDashboardProperties
  13. {
  14. }
  15. public class OpenQuotesDashboardElement : DashboardElement<OpenQuotesDashboard, QuotesDashboardGroup,
  16. OpenQuotesDashboardProperties>
  17. {
  18. }
  19. public class OpenQuotesDashboard : DynamicDataGrid<Quote>,
  20. IDashboardWidget<QuotesDashboardGroup, OpenQuotesDashboardProperties>
  21. {
  22. public void Setup()
  23. {
  24. ActionColumns.Add(new DynamicMenuColumn(CreateMenu, GetStatus));
  25. ColumnsTag = GetType().Name;
  26. Refresh(true,false);
  27. }
  28. protected override void DoReconfigure(DynamicGridOptions options)
  29. {
  30. base.DoReconfigure(options);
  31. options.Clear();
  32. options.SelectColumns = true;
  33. }
  34. private DynamicMenuStatus GetStatus(CoreRow row)
  35. {
  36. return DynamicMenuStatus.Enabled;
  37. }
  38. private void CreateMenu(DynamicMenuColumn menu, CoreRow? row)
  39. {
  40. }
  41. public void Shutdown(CancelEventArgs? cancel)
  42. {
  43. }
  44. public void Refresh()
  45. {
  46. Refresh(false, true);
  47. }
  48. protected override void Reload(
  49. Filters<Quote> criteria, Columns<Quote> columns, ref SortOrder<Quote>? sort,
  50. CancellationToken token, Action<CoreTable?, Exception?> action)
  51. {
  52. // criteria.Add(new Filter<Quote>(x => x.Status.Active).IsEqualTo(true));
  53. base.Reload(criteria, columns, ref sort, token, 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. }