JobAssignmentPanel.xaml.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Controls;
  5. using Comal.Classes;
  6. using System.ComponentModel;
  7. using InABox.Core;
  8. namespace PRSDesktop
  9. {
  10. public partial class JobAssignmentPanel : UserControl, IBasePanel, IJobControl, IDataModelSource
  11. {
  12. public JobAssignmentPanel()
  13. {
  14. InitializeComponent();
  15. }
  16. #region IJobPanel
  17. public Job Job
  18. {
  19. get => Activities.Job;
  20. set
  21. {
  22. Activities.Job = value;
  23. Assignments.Job = value;
  24. }
  25. }
  26. public JobPanelSettings Settings { get; set; }
  27. #endregion
  28. #region IDataModelSource
  29. public event DataModelUpdateEvent? OnUpdateDataModel;
  30. public string SectionName => "Job Assignments";
  31. public DataModel DataModel(Selection selection)
  32. {
  33. var ids = Assignments.ExtractValues(x => x.ID, selection).ToArray();
  34. return new AssignmentDataModel(new Filter<Assignment>(x => x.ID).InList(ids));
  35. }
  36. #endregion
  37. #region IBasePanel
  38. public void Setup()
  39. {
  40. Activities.Refresh(true, false);
  41. Assignments.Refresh(true, false);
  42. }
  43. public void Shutdown(CancelEventArgs? cancel)
  44. {
  45. }
  46. public void Refresh()
  47. {
  48. Activities.Refresh(false, true);
  49. Assignments.Refresh(false, true);
  50. }
  51. public bool IsReady { get; set; }
  52. public void CreateToolbarButtons(IPanelHost host)
  53. {
  54. }
  55. public Dictionary<string, object[]> Selected()
  56. {
  57. return new Dictionary<string, object[]>();
  58. }
  59. public void Heartbeat(TimeSpan time)
  60. {
  61. }
  62. #endregion
  63. }
  64. }