ParaEditAlarmConditionViewModel.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. namespace ParameterModule.Pops.ViewModels;
  2. internal partial class ParaEditAlarmConditionViewModel : ObservableObject, IPopAware
  3. {
  4. public ParaEditAlarmConditionViewModel()
  5. {
  6. for (int i = 1; i <= 10; i++)
  7. {
  8. AlarmConditionTableInfo table = new()
  9. {
  10. Index = i,
  11. Name = $"Tabel {i}",
  12. };
  13. Tables.Add(table);
  14. }
  15. this.Alarms.Add(new("SUB"));
  16. this.Alarms.Add(new("U"));
  17. this.Alarms.Add(new("CU"));
  18. this.Alarms.Add(new("C"));
  19. this.Alarms.Add(new("CL"));
  20. this.Alarms.Add(new("L"));
  21. this.Alarms.Add(new("SL"));
  22. this.BoalAlarm.Add(new("Boat Load"));
  23. this.BoalAlarm.Add(new("Boat Unload"));
  24. }
  25. public ImageSource? ImageSource { get; set; }
  26. public string? Title { get; set; } = "Alarm Conditon";
  27. public Action? RequestClose { get; set; }
  28. [ObservableProperty]
  29. private ObservableCollection<AlarmConditionTableInfo> _Tables = [];
  30. [ObservableProperty]
  31. private ObservableCollection<AlarmPair> _Alarms = [];
  32. [ObservableProperty]
  33. private ObservableCollection<BoatLoadInhibitDetail> _BoalAlarm = [];
  34. public bool CanClose()
  35. {
  36. return true;
  37. }
  38. public void OnClose()
  39. {
  40. }
  41. public void OnPop(object? state)
  42. {
  43. this.Title = "Alarm Conditon";
  44. }
  45. [RelayCommand]
  46. private void Switch(AlarmConditionType type)
  47. {
  48. this.Alarms.Clear();
  49. switch (type)
  50. {
  51. case AlarmConditionType.Temp:
  52. this.Alarms.Add(new("SUB"));
  53. this.Alarms.Add(new("U"));
  54. this.Alarms.Add(new("CU"));
  55. this.Alarms.Add(new("C"));
  56. this.Alarms.Add(new("CL"));
  57. this.Alarms.Add(new("L"));
  58. this.Alarms.Add(new("SL"));
  59. break;
  60. case AlarmConditionType.MFC:
  61. for (int i = 1; i <= 10; i++)
  62. this.Alarms.Add(new($"MFC {i}"));
  63. break;
  64. case AlarmConditionType.Press:
  65. this.Alarms.Add(new("Press 1"));
  66. this.Alarms.Add(new("Press 2"));
  67. this.Alarms.Add(new("APC Angle"));
  68. break;
  69. case AlarmConditionType.Aux:
  70. for (int i = 1; i <= 16; i++)
  71. this.Alarms.Add(new($"U2-CH{i}"));
  72. break;
  73. case AlarmConditionType.HWILK:
  74. break;
  75. case AlarmConditionType.HardSoft:
  76. break;
  77. case AlarmConditionType.ContDown:
  78. break;
  79. case AlarmConditionType.Sensor:
  80. break;
  81. case AlarmConditionType.Other:
  82. break;
  83. default:
  84. break;
  85. }
  86. }
  87. [RelayCommand]
  88. private void Close()
  89. {
  90. this.RequestClose?.Invoke();
  91. }
  92. }