using Microsoft.Toolkit.Mvvm.Input; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using HBLConsole.Service; namespace HBLConsole.Model { /// /// 属性绑定信息 /// public class PropBindInfo : VariableInfo { public PropBindInfo() { ComboBoxItemInit(); CancelCommand = new RelayCommand(() => { IsOpen = false; }); ConfirmCommand = new RelayCommand(() => { IsOpen = false; }); } /// /// 数据类型下拉列表 /// public ObservableCollection dataType { get; set; } = new ObservableCollection(); /// /// 报警类型下拉列表 /// public ObservableCollection alarmType { get; set; } = new ObservableCollection(); /// /// 报警设置窗离散量报警类型 /// public ObservableCollection PopupDiscreteAlarmType { get; set; } = new ObservableCollection(); /// /// 是否显示报警设置框 /// public bool IsOpen { get { return _mIsOpen; } set { _mIsOpen = value; OnPropertyChanged(); } } private bool _mIsOpen; /// /// 报警设置框取消操作 /// public RelayCommand CancelCommand { get; set; } /// /// 报警设置框确认按钮 /// public RelayCommand ConfirmCommand { get; set; } /// /// 下拉列表初始化 /// private void ComboBoxItemInit() { dataType.Clear(); alarmType.Clear(); PopupDiscreteAlarmType.Clear(); string[] DataTypeNames = Enum.GetNames(typeof(EDataType)); foreach (var item in DataTypeNames) { dataType.Add(item); } string[] AlarmTypeNames = Enum.GetNames(typeof(EAlarmType)); foreach (var item in AlarmTypeNames) { alarmType.Add(item); } string[] PopupAlarmTypes = Enum.GetNames(typeof(EAlongTriggerType)); foreach (var item in PopupAlarmTypes) { PopupDiscreteAlarmType.Add(item); } } } }