终端一体化运控平台
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.

AlarmTypeTextConvert.cs 1.2 KiB

2 years ago
2 years ago
12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Data;
  8. using BPASmart.Model;
  9. namespace BPASmart.VariableManager.Converter
  10. {
  11. /// <summary>
  12. /// 报警类型文本转换
  13. /// </summary>
  14. public class AlarmTypeTextConvert : IValueConverter
  15. {
  16. //当值从绑定源传播给绑定目标时,调用方法Convert,绑定源是控件的数据,绑定目标是后台值
  17. //界面传递给后台数据
  18. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  19. {
  20. if (value != null)
  21. {
  22. if (value.ToString() == "Bool")
  23. return EAlarmType.离散量报警.ToString();
  24. else
  25. return EAlarmType.模拟量报警.ToString();
  26. }
  27. return EAlarmType.无.ToString();
  28. }
  29. //当值从绑定目标传播给绑定源时,调用此方法ConvertBack
  30. //从后台数据传递给界面
  31. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  32. {
  33. return value.ToString();
  34. }
  35. }
  36. }