JobScopePanel.xaml.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Windows.Controls;
  6. using Comal.Classes;
  7. using InABox.Core;
  8. using InABox.DynamicGrid;
  9. namespace PRSDesktop;
  10. public partial class JobScopePanel : UserControl, IPanel<JobScope>, IJobControl
  11. {
  12. public JobScopePanel()
  13. {
  14. InitializeComponent();
  15. }
  16. public Job Job
  17. {
  18. get => _scopes.Job;
  19. set
  20. {
  21. _scopes.Job = value;
  22. }
  23. }
  24. public JobPanelSettings Settings { get; set; }
  25. public bool IsReady { get; set; }
  26. public event DataModelUpdateEvent OnUpdateDataModel;
  27. public void CreateToolbarButtons(IPanelHost host)
  28. {
  29. }
  30. public void Setup()
  31. {
  32. _scopes.Refresh(true, false);
  33. }
  34. public void Shutdown(CancelEventArgs? cancel)
  35. {
  36. }
  37. public void Refresh()
  38. {
  39. _scopes.Refresh(false, true);
  40. }
  41. public string SectionName => "Job Scopes";
  42. public DataModel DataModel(Selection selection)
  43. {
  44. var ids = _scopes.ExtractValues(x => x.ID, selection).ToArray();
  45. return new AutoDataModel<JobScope>(new Filter<JobScope>(c => c.ID).InList(ids));
  46. }
  47. public Dictionary<string, object[]> Selected()
  48. {
  49. return new Dictionary<string, object[]>();
  50. }
  51. public void Heartbeat(TimeSpan time)
  52. {
  53. }
  54. private void _scopes_OnSelectItem(object sender, DynamicGridSelectionEventArgs e)
  55. {
  56. var row = e.Rows?.FirstOrDefault()?.ToObject<JobScope>();
  57. // Populate the sub-grids with the scope summaries
  58. }
  59. }