You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

76 lines
2.4 KiB

  1. using Microsoft.Toolkit.Mvvm.Input;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using HBLConsole.Service;
  10. namespace HBLConsole.Model
  11. {
  12. /// <summary>
  13. /// 属性绑定信息
  14. /// </summary>
  15. public class PropBindInfo : VariableInfo
  16. {
  17. public PropBindInfo()
  18. {
  19. ComboBoxItemInit();
  20. CancelCommand = new RelayCommand(() => { IsOpen = false; });
  21. ConfirmCommand = new RelayCommand(() => { IsOpen = false; });
  22. }
  23. /// <summary>
  24. /// 数据类型下拉列表
  25. /// </summary>
  26. public ObservableCollection<string> dataType { get; set; } = new ObservableCollection<string>();
  27. /// <summary>
  28. /// 报警类型下拉列表
  29. /// </summary>
  30. public ObservableCollection<string> alarmType { get; set; } = new ObservableCollection<string>();
  31. /// <summary>
  32. /// 报警设置窗离散量报警类型
  33. /// </summary>
  34. public ObservableCollection<string> PopupDiscreteAlarmType { get; set; } = new ObservableCollection<string>();
  35. /// <summary>
  36. /// 是否显示报警设置框
  37. /// </summary>
  38. public bool IsOpen { get { return _mIsOpen; } set { _mIsOpen = value; OnPropertyChanged(); } }
  39. private bool _mIsOpen;
  40. /// <summary>
  41. /// 报警设置框取消操作
  42. /// </summary>
  43. public RelayCommand CancelCommand { get; set; }
  44. /// <summary>
  45. /// 报警设置框确认按钮
  46. /// </summary>
  47. public RelayCommand ConfirmCommand { get; set; }
  48. /// <summary>
  49. /// 下拉列表初始化
  50. /// </summary>
  51. private void ComboBoxItemInit()
  52. {
  53. dataType.Clear();
  54. alarmType.Clear();
  55. PopupDiscreteAlarmType.Clear();
  56. string[] DataTypeNames = Enum.GetNames(typeof(EDataType));
  57. foreach (var item in DataTypeNames) { dataType.Add(item); }
  58. string[] AlarmTypeNames = Enum.GetNames(typeof(EAlarmType));
  59. foreach (var item in AlarmTypeNames) { alarmType.Add(item); }
  60. string[] PopupAlarmTypes = Enum.GetNames(typeof(EAlongTriggerType));
  61. foreach (var item in PopupAlarmTypes) { PopupDiscreteAlarmType.Add(item); }
  62. }
  63. }
  64. }