SettingViewModel.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using SWRIS.Dtos;
  2. using SWRIS.Enums;
  3. using SWRIS.Extensions;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. namespace SWRIS.Models.ViewModel
  8. {
  9. public class SettingViewModel : INotifyPropertyChanged
  10. {
  11. private string _appName = "在线式钢丝绳电磁检测系统";
  12. private string _version = "250902";
  13. private string _copyright = "河南恒达机电设备有限公司";
  14. private string _ipAddress = "192.168.1.233";
  15. private int _port = 9005;
  16. private int _dataSaveDays = 120;
  17. private TimeSpan _cleanScheduledTime = TimeSpan.FromHours(2);
  18. private int _damageNearPointCount = 20;
  19. private bool _showDebugMessage = true;
  20. private int _sountRiskLevel = (int)RiskLevel.Moderate;
  21. private double _speedVariationThreshold = 0.25;
  22. private double _damageExtent = 0.5;
  23. private int _alarmValidCount = 3;
  24. private string _crane = "炼钢一跨1#";
  25. private CalibrationDataModel _calibration;
  26. private bool _isAutoStart = true;
  27. /// <summary>
  28. /// 应用名称
  29. /// </summary>
  30. public string AppName
  31. {
  32. get => _appName;
  33. set
  34. {
  35. _appName = value;
  36. OnPropertyChanged(nameof(AppName));
  37. }
  38. }
  39. /// <summary>
  40. /// 应用版本
  41. /// </summary>
  42. public string Version
  43. {
  44. get => _version;
  45. set
  46. {
  47. _version = value;
  48. OnPropertyChanged(nameof(Version));
  49. }
  50. }
  51. /// <summary>
  52. /// 技术支持
  53. /// </summary>
  54. public string Copyright
  55. {
  56. get => _copyright;
  57. set
  58. {
  59. _copyright = value;
  60. OnPropertyChanged(nameof(Copyright));
  61. }
  62. }
  63. /// <summary>
  64. /// 服务端IP地址
  65. /// </summary>
  66. public string IpAddress
  67. {
  68. get => _ipAddress;
  69. set
  70. {
  71. _ipAddress = value;
  72. OnPropertyChanged(nameof(IpAddress));
  73. }
  74. }
  75. /// <summary>
  76. /// 服务端端口号
  77. /// </summary>
  78. public int Port
  79. {
  80. get => _port;
  81. set
  82. {
  83. _port = value;
  84. OnPropertyChanged(nameof(Port));
  85. }
  86. }
  87. /// <summary>
  88. /// 是否显示调试信息
  89. /// </summary>
  90. public bool ShowDebugMessage
  91. {
  92. get => _showDebugMessage;
  93. set
  94. {
  95. _showDebugMessage = value;
  96. OnPropertyChanged(nameof(ShowDebugMessage));
  97. }
  98. }
  99. /// <summary>
  100. /// 数据存储天数
  101. /// </summary>
  102. public int DataSaveDays
  103. {
  104. get => _dataSaveDays;
  105. set
  106. {
  107. _dataSaveDays = value;
  108. OnPropertyChanged(nameof(DataSaveDays));
  109. }
  110. }
  111. /// <summary>
  112. /// 清理数据计划时间
  113. /// </summary>
  114. public TimeSpan CleanScheduledTime
  115. {
  116. get => _cleanScheduledTime;
  117. set
  118. {
  119. _cleanScheduledTime = value;
  120. OnPropertyChanged(nameof(CleanScheduledTime));
  121. }
  122. }
  123. /// <summary>
  124. /// 损伤邻近点数
  125. /// </summary>
  126. public int DamageNearPointCount
  127. {
  128. get => _damageNearPointCount;
  129. set
  130. {
  131. _damageNearPointCount = value;
  132. OnPropertyChanged(nameof(DamageNearPointCount));
  133. }
  134. }
  135. /// <summary>
  136. /// 语音报警风险等级
  137. /// </summary>
  138. public int SoundRiskLevel
  139. {
  140. get => _sountRiskLevel;
  141. set
  142. {
  143. _sountRiskLevel = value;
  144. OnPropertyChanged(nameof(SoundRiskLevel));
  145. }
  146. }
  147. /// <summary>
  148. /// 速度变化阈值
  149. /// </summary>
  150. public double SpeedVariationThreshold
  151. {
  152. get => _speedVariationThreshold;
  153. set
  154. {
  155. _speedVariationThreshold = value;
  156. OnPropertyChanged(nameof(SpeedVariationThreshold));
  157. }
  158. }
  159. /// <summary>
  160. /// 损伤验证范围
  161. /// </summary>
  162. public double DamageExtent
  163. {
  164. get => _damageExtent;
  165. set
  166. {
  167. _damageExtent = value;
  168. OnPropertyChanged(nameof(DamageExtent));
  169. }
  170. }
  171. /// <summary>
  172. /// 损伤验证次数
  173. /// </summary>
  174. public int AlarmValidCount
  175. {
  176. get => _alarmValidCount;
  177. set
  178. {
  179. _alarmValidCount = value;
  180. OnPropertyChanged(nameof(AlarmValidCount));
  181. }
  182. }
  183. /// <summary>
  184. /// 起重机名称
  185. /// </summary>
  186. public string Crane
  187. {
  188. get => _crane;
  189. set
  190. {
  191. _crane = value;
  192. OnPropertyChanged(nameof(Crane));
  193. }
  194. }
  195. /// <summary>
  196. /// 标定设置
  197. /// </summary>
  198. public CalibrationDataModel Calibration
  199. {
  200. get => _calibration;
  201. set
  202. {
  203. _calibration = value;
  204. OnPropertyChanged(nameof(Calibration));
  205. }
  206. }
  207. public bool IsAutoStart
  208. {
  209. get => _isAutoStart;
  210. set
  211. {
  212. _isAutoStart = value;
  213. OnPropertyChanged(nameof(IsAutoStart));
  214. }
  215. }
  216. public List<KeyAndValueDto> RiskLevels => TypeExtension.ToKeyAndDescriptionList(typeof(RiskLevel));
  217. public event PropertyChangedEventHandler PropertyChanged;
  218. protected internal virtual void OnPropertyChanged(string propertyName)
  219. {
  220. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  221. }
  222. }
  223. }