namespace ParameterModule.Pops.ViewModels; internal partial class ParaEditAlarmConditionViewModel : ObservableObject, IPopAware { public ParaEditAlarmConditionViewModel() { for (int i = 1; i <= 10; i++) { AlarmConditionTableInfo table = new() { Index = i, Name = $"Tabel {i}", }; Tables.Add(table); } this.Alarms.Add(new("SUB")); this.Alarms.Add(new("U")); this.Alarms.Add(new("CU")); this.Alarms.Add(new("C")); this.Alarms.Add(new("CL")); this.Alarms.Add(new("L")); this.Alarms.Add(new("SL")); this.BoalAlarm.Add(new("Boat Load")); this.BoalAlarm.Add(new("Boat Unload")); } public ImageSource? ImageSource { get; set; } public string? Title { get; set; } = "Alarm Conditon"; public Action? RequestClose { get; set; } [ObservableProperty] private ObservableCollection _Tables = []; [ObservableProperty] private ObservableCollection _Alarms = []; [ObservableProperty] private ObservableCollection _BoalAlarm = []; public bool CanClose() { return true; } public void OnClose() { } public void OnPop(object? state) { this.Title = "Alarm Conditon"; } [RelayCommand] private void Switch(AlarmConditionType type) { this.Alarms.Clear(); switch (type) { case AlarmConditionType.Temp: this.Alarms.Add(new("SUB")); this.Alarms.Add(new("U")); this.Alarms.Add(new("CU")); this.Alarms.Add(new("C")); this.Alarms.Add(new("CL")); this.Alarms.Add(new("L")); this.Alarms.Add(new("SL")); break; case AlarmConditionType.MFC: for (int i = 1; i <= 10; i++) this.Alarms.Add(new($"MFC {i}")); break; case AlarmConditionType.Press: this.Alarms.Add(new("Press 1")); this.Alarms.Add(new("Press 2")); this.Alarms.Add(new("APC Angle")); break; case AlarmConditionType.Aux: for (int i = 1; i <= 16; i++) this.Alarms.Add(new($"U2-CH{i}")); break; case AlarmConditionType.HWILK: break; case AlarmConditionType.HardSoft: break; case AlarmConditionType.ContDown: break; case AlarmConditionType.Sensor: break; case AlarmConditionType.Other: break; default: break; } } [RelayCommand] private void Close() { this.RequestClose?.Invoke(); } }