LogikalPhasesGrid.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Comal.Classes;
  6. using InABox.Core;
  7. using InABox.DynamicGrid;
  8. using InABox.Integration.Logikal;
  9. using PRSDesktop.Integrations.Logikal;
  10. namespace PRSDesktop;
  11. public class LogikalPhasesGrid : LogikalGrid<LogikalPhase>
  12. {
  13. public Guid ProjectID { get; set; }
  14. protected override void Init()
  15. {
  16. base.Init();
  17. HiddenColumns.Add(x => x.ID);
  18. }
  19. protected override DynamicGridColumns LoadColumns()
  20. {
  21. var result = new DynamicGridColumns();
  22. result.Add<LogikalPhase>(x => x.Title, 0, "Phases", "", Alignment.MiddleLeft);
  23. return result;
  24. }
  25. protected override void DoReconfigure(DynamicGridOptions options)
  26. {
  27. base.DoReconfigure(options);
  28. options.FilterRows = true;
  29. options.HideDatabaseFilters = true;
  30. }
  31. protected override void DoGet(LogikalClient client, IProgress<string> progress)
  32. {
  33. Items = new List<LogikalPhase>();
  34. if (ProjectID != Guid.Empty)
  35. {
  36. client.GetPhases(ProjectID)
  37. .Always(NotifyResponseReceived)
  38. .Success<LogikalPhasesResponse<LogikalPhase>>(p =>
  39. {
  40. Items = p.Phases.ToList();
  41. });
  42. }
  43. }
  44. }