终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

451 行
24 KiB

  1. using BPASmartClient.Business;
  2. using BPASmartClient.Device;
  3. using BPASmartClient.DRCoffee;
  4. using BPASmartClient.EventBus;
  5. using BPASmartClient.Helper;
  6. using BPASmartClient.LebaiRobot;
  7. using BPASmartClient.Message;
  8. using BPASmartClient.Model;
  9. using BPASmartClient.Model.乐白机器人;
  10. using BPASmartClient.Model.冰淇淋.Enum;
  11. using BPASmartClient.Model.单片机;
  12. using BPASmartClient.Model.单片机.Enum;
  13. using BPASmartClient.Model.咖啡机.Enum;
  14. using Microsoft.Toolkit.Mvvm.ComponentModel;
  15. using Microsoft.Toolkit.Mvvm.Input;
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Collections.ObjectModel;
  19. using System.Linq;
  20. using System.Threading;
  21. namespace BPASmartClient.MorkT_Container.ViewModel;
  22. public class DebugViewModel : ObservableObject
  23. {
  24. #region 乐白机器人
  25. /// <summary>
  26. /// 乐白机器人连接状态
  27. /// </summary>
  28. public string RobotConnected { get { return _robotConnected; } set { _robotConnected = value; OnPropertyChanged(); } }
  29. private string _robotConnected { get; set; }
  30. /// <summary>
  31. /// 乐白机器人的模式状态
  32. /// </summary>
  33. public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } }
  34. private string _robotMode { get; set; }
  35. /// <summary>
  36. /// 机器人控制指令
  37. /// </summary>
  38. public RelayCommand<object> Button_RobotControlCommand { get; set; }
  39. public RelayCommand<object> IceMaker_State { get; set; }
  40. public RelayCommand Robot_DOutput { get; set; }
  41. /// <summary>
  42. /// 机器人控制
  43. /// </summary>
  44. /// <param name="o"></param>
  45. private void Button_RobotControl(object o)
  46. {
  47. EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() });
  48. }
  49. private void Button_RobotDoutput()
  50. {
  51. bool DO_Value =int.Parse(Robot_DOutput_Value) == 0;
  52. EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { Pin = int.Parse(Robot_DOutput_Pin), Value = DO_Value });
  53. }
  54. public bool Robot_TCPDI0 { get { return _robot_TCPDI0; } set { _robot_TCPDI0 = value;OnPropertyChanged(); } }
  55. private bool _robot_TCPDI0;
  56. public bool Robot_DI0 { get { return _robot_DI0; } set { _robot_DI0 = value; OnPropertyChanged(); } }
  57. private bool _robot_DI0;
  58. public bool Robot_DI1 { get { return _robot_DI1; } set { _robot_DI1 = value; OnPropertyChanged(); } }
  59. private bool _robot_DI1;
  60. public bool Robot_DI2 { get { return _robot_DI2; } set { _robot_DI2 = value; OnPropertyChanged(); } }
  61. private bool _robot_DI2;
  62. public bool Robot_DI3 { get { return _robot_DI3; } set { _robot_DI3 = value; OnPropertyChanged(); } }
  63. private bool _robot_DI3;
  64. public string Robot_DOutput_Pin { get { return _robot_DOutput_Pin; } set { _robot_DOutput_Pin = value; OnPropertyChanged(); } }
  65. private string _robot_DOutput_Pin { get; set; }
  66. public string Robot_DOutput_Value { get { return _robot_DOutput_Valuet; } set { _robot_DOutput_Valuet = value; OnPropertyChanged(); } }
  67. private string _robot_DOutput_Valuet { get; set; }
  68. #endregion
  69. #region 单片机
  70. public string MCUConnected { get { return _mcuConnected; } set { _mcuConnected = value; OnPropertyChanged(); } }
  71. private string _mcuConnected { get; set; }
  72. public bool MCUDI0 { get { return _mCUDI0; } set { _mCUDI0 = value; OnPropertyChanged(); } }
  73. private bool _mCUDI0 { get; set; }
  74. public bool MCUDI1 { get { return _mCUDI1; } set { _mCUDI1 = value; OnPropertyChanged(); } }
  75. private bool _mCUDI1 { get; set; }
  76. public bool MCUDI2 { get { return _mCUDI2; } set { _mCUDI2 = value; OnPropertyChanged(); } }
  77. private bool _mCUDI2 { get; set; }
  78. public bool MCUDI3 { get { return _mCUDI3; } set { _mCUDI3 = value; OnPropertyChanged(); } }
  79. private bool _mCUDI3 { get; set; }
  80. public bool MCUDI4 { get { return _mCUDI4; } set { _mCUDI4 = value; OnPropertyChanged(); } }
  81. private bool _mCUDI4 { get; set; }
  82. public bool MCUDI5 { get { return _mCUDI5; } set { _mCUDI5 = value; OnPropertyChanged(); } }
  83. private bool _mCUDI5 { get; set; }
  84. public bool MCUDI6 { get { return _mCUDI6; } set { _mCUDI6 = value; OnPropertyChanged(); } }
  85. private bool _mCUDI6 { get; set; }
  86. public bool MCUDI7 { get { return _mCUDI7; } set { _mCUDI7 = value; OnPropertyChanged(); } }
  87. private bool _mCUDI7 { get; set; }
  88. public RelayCommand Button_MCUOuputCommand { get; set; }
  89. public RelayCommand Button_MCUDOuputCommand { get; set; }
  90. public int MCU_PWM_CH { get { return _choosePWM; } set { _choosePWM = value; OnPropertyChanged(); } }
  91. private int _choosePWM = 1;
  92. public int PWMInputNumber { get { return _pwmInputNumber; } set { _pwmInputNumber = value; OnPropertyChanged(); } }
  93. private int _pwmInputNumber = 1;
  94. private int[] DICH { get { return _diCH; } set { _diCH = value; OnPropertyChanged(); } }
  95. private int[] _diCH = new int[8];
  96. public int MCU_DO_CH { get { return _mcuDO_CH; } set { _mcuDO_CH = value; OnPropertyChanged(); } }
  97. private int _mcuDO_CH = 1;
  98. public bool MCU_DO_Value { get { return _mcu_DO_Valuer; } set { _mcu_DO_Valuer = value; OnPropertyChanged(); } }
  99. private bool _mcu_DO_Valuer = true;
  100. private void Button_McuPWMOutput()
  101. {
  102. string sChoosePWM = Convert.ToString(MCU_PWM_CH + 1);
  103. new WriteMcu() { TagName = "ServoControl", Address = sChoosePWM, Value = PWMInputNumber }.Publish();
  104. }
  105. private void Button_McuDOutput()
  106. {
  107. string sChooseDO = Convert.ToString(MCU_DO_CH + 1);
  108. new WriteMcu() { TagName = "OutputControl", Address = sChooseDO, Value = MCU_DO_Value }.Publish();
  109. }
  110. #endregion
  111. #region 果汁机
  112. /// <summary>
  113. /// 果汁机的连接状态
  114. /// </summary>
  115. public string JuicerConnected { get { return _JuicerConnected; } set { _JuicerConnected = value; OnPropertyChanged(); } }
  116. private string _JuicerConnected { get; set; }
  117. public System.Windows.Visibility JuiceState_Heating { get { return _juiceState_Heating; } set { _juiceState_Heating = value;OnPropertyChanged(); } }
  118. public System.Windows.Visibility _juiceState_Heating { get; set; }
  119. public System.Windows.Visibility JuiceState_Cooling { get { return _juiceState_Cooling; } set { _juiceState_Cooling = value; OnPropertyChanged(); } }
  120. public System.Windows.Visibility _juiceState_Cooling { get; set; }
  121. public System.Windows.Visibility JuiceState_LackOfWater { get { return _juiceState_LackOfWater; } set { _juiceState_LackOfWater = value; OnPropertyChanged(); } }
  122. public System.Windows.Visibility _juiceState_LackOfWater { get; set; }
  123. public System.Windows.Visibility JuiceState_ChildLocks { get { return _juiceState_ChildLocks; } set { _juiceState_ChildLocks = value; OnPropertyChanged(); } }
  124. public System.Windows.Visibility _juiceState_ChildLocks { get; set; }
  125. public System.Windows.Visibility JuiceState_Using { get { return _juiceState_Using; } set { _juiceState_Using = value; OnPropertyChanged(); } }
  126. public System.Windows.Visibility _juiceState_Using { get; set; }
  127. public string MakeJuice_Index { get { return _makeJuice_Index; } set { _makeJuice_Index = value; OnPropertyChanged(); } }
  128. public string _makeJuice_Index { get; set; }
  129. public RelayCommand Button_MakeJuiceCommand { get; set; }
  130. public void Button_MakeJuice()
  131. {
  132. new WriteJuicer() { Value = MakeJuice_Index }.Publish();
  133. }
  134. #endregion
  135. #region 制冰机
  136. public string IceMakerConnect { get { return _iceMakerConnect; } set { _iceMakerConnect = value;OnPropertyChanged(); } }
  137. private string _iceMakerConnect { get; set; }
  138. public int IceMakerState { get { return _iceMakerState; } set { _iceMakerState = value; OnPropertyChanged(); } }
  139. private int _iceMakerState { get; set; }
  140. public string IceMakerState1 { get { return _iceMakerState1; } set { _iceMakerState1 = value; OnPropertyChanged(); } }
  141. private string _iceMakerState1 { get; set; }
  142. public string IceMakerState2 { get { return _iceMakerState2; } set { _iceMakerState2 = value; OnPropertyChanged(); } }
  143. private string _iceMakerState2 { get; set; }
  144. public string IceMakerState3 { get { return _iceMakerState3; } set { _iceMakerState3 = value; OnPropertyChanged(); } }
  145. private string _iceMakerState3 { get; set; }
  146. public string IceMakerState4 { get { return _iceMakerState4; } set { _iceMakerState4 = value; OnPropertyChanged(); } }
  147. private string _iceMakerState4 { get; set; }
  148. public string IceMakerState5 { get { return _iceMakerState5; } set { _iceMakerState5 = value; OnPropertyChanged(); } }
  149. private string _iceMakerState5 { get; set; }
  150. public int IceMaker_IceTime { get { return _iceMaker_IceTime; } set { _iceMaker_IceTime = value; OnPropertyChanged(); } }
  151. private int _iceMaker_IceTime = 3;
  152. #region 订单模拟
  153. public RelayCommand SimOrderMakeCoffee { get; set; }
  154. public RelayCommand SimOrderMakeJuice { get; set; }
  155. public RelayCommand SimOrderMakeTea { get; set; }
  156. public RelayCommand SimOrderMakeWater { get; set; }
  157. public int SimOrder_JuiceList { get { return _simOrder_JuiceList; } set { _simOrder_JuiceList = value; OnPropertyChanged(); } }
  158. public int _simOrder_JuiceList { get; set; }
  159. public string SimOrder_JuiceMakeID { get { return _simOrder_JuiceMakeID; } set { _simOrder_JuiceMakeID = value; OnPropertyChanged(); } }
  160. public string _simOrder_JuiceMakeID { get; set; }
  161. #endregion
  162. public RelayCommand IceMaker_BtnPowerOn { get; set; }
  163. public RelayCommand IceMaker_BtnStandby { get; set;}
  164. public RelayCommand IceMaker_BtnPump { get; set;}
  165. public RelayCommand IceMaker_BtnStart { get; set; }
  166. public RelayCommand IceMaker_BtnEnd { get; set; }
  167. public RelayCommand IceMaker_BtnSetIceTime { get; set; }
  168. private void IceMaker_BtnPowerOnCommand()
  169. {
  170. new PowerOnMakeIce().Publish();
  171. }
  172. private void IceMaker_BtnStandbyCommand()
  173. {
  174. new StandbyMakeIce().Publish();
  175. }
  176. private void IceMaker_BtnPumpCommand()
  177. {
  178. new PumpMakeIce().Publish();
  179. }
  180. private void IceMaker_BtnStartCommand()
  181. {
  182. new StartMakeIce().Publish();
  183. }
  184. private void IceMaker_BtnEndCommand()
  185. {
  186. new StopMakeIce().Publish();
  187. }
  188. private void IceMaker_BtnSetIceTimeCommand()
  189. {
  190. new SetIceNumber{ Value= IceMaker_IceTime * 0.1 }.Publish();
  191. }
  192. #endregion
  193. #region 咖啡机
  194. /// <summary>
  195. /// 咖啡机连接状态
  196. /// </summary>
  197. public string CoffeeConnected { get { return _coffeeConnected; } set { _coffeeConnected = value; OnPropertyChanged(); } }
  198. private string _coffeeConnected { get; set; }
  199. /// <summary>
  200. /// 咖啡机状态
  201. /// </summary>
  202. public string CoffeeStatus { get { return _coffeeStatus; } set { _coffeeStatus = value; OnPropertyChanged(); } }
  203. private string _coffeeStatus { get; set; }
  204. /// <summary>
  205. /// 应用状态
  206. /// </summary>
  207. public string AppStatus { get { return _appStatus; } set { _appStatus = value; OnPropertyChanged(); } }
  208. private string _appStatus { get; set; }
  209. /// <summary>
  210. /// 告警
  211. /// </summary>
  212. public string Warning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } }
  213. public string _warning { get; set; }
  214. /// <summary>
  215. /// 故障信息
  216. /// </summary>
  217. public string CaffeeFault { get { return _caffeeFault; } set { _caffeeFault = value; OnPropertyChanged(); } }
  218. public string _caffeeFault { get; set; }
  219. public List<string> Coffees { get; set; } = new List<string>();
  220. public string SelectedCoffee { get { return _selectedCoffee; } set { _selectedCoffee = value; OnPropertyChanged(); } }
  221. public string _selectedCoffee { get; set; }
  222. public List<string> CoffeeCmds { get; set; } = new List<string>();
  223. public string SelectedCoffeeCmd { get; set; }
  224. public string SimOrderCoffeeList { get { return _simOrderCoffeeList; } set { _simOrderCoffeeList = value; OnPropertyChanged(); } }
  225. public string _simOrderCoffeeList { get; set; }
  226. /// <summary>
  227. /// 制作咖啡
  228. /// </summary>
  229. public RelayCommand Button_MakeCoffeeCommand { get; set; }
  230. /// <summary>
  231. /// 停止制作咖啡
  232. /// </summary>
  233. public RelayCommand Button_StopMakeCoffeCommand { get; set; }
  234. /// <summary>
  235. /// 咖啡模式设置
  236. /// </summary>
  237. public RelayCommand Button_CoffeeModeSetCommand { get; set; }
  238. private void Button_MakeCoffee()
  239. {
  240. EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SelectedCoffee) });
  241. }
  242. private void Button_StopMakeCoffe()
  243. {
  244. EventBus.EventBus.GetInstance().Publish(new DRCoffee_CancelMakeCoffeeEvent() { DeviceId = DeviceId });
  245. }
  246. private void Button_CoffeeModeSet()
  247. {
  248. EventBus.EventBus.GetInstance().Publish(new DRCoffee_CoffeeCommCmdEvent() { DeviceId = DeviceId, CommCmd = (DrCoffeeCommCmd)Enum.Parse(typeof(DrCoffeeCommCmd), SelectedCoffeeCmd) });
  249. }
  250. #endregion
  251. /// <summary>
  252. /// 设备ID
  253. /// </summary>
  254. public int DeviceId { get; set; }
  255. /// <summary>
  256. /// 设备数据
  257. /// </summary>
  258. public ObservableCollection<VariableMonitor> variableMonitors { get; set; }
  259. public DebugViewModel()
  260. {
  261. SimOrderMakeCoffee = new RelayCommand(() =>
  262. {
  263. new MorkTSimOrder() { OrderNum = 1, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SimOrderCoffeeList) }.Publish();
  264. });
  265. SimOrderMakeJuice = new RelayCommand(() =>
  266. {
  267. new MorkTSimOrder() { OrderNum = 2, JuiceList = SimOrder_JuiceList, JuiceMakeID = SimOrder_JuiceMakeID }.Publish();
  268. });
  269. SimOrderMakeTea = new RelayCommand(() =>
  270. {
  271. new MorkTSimOrder() { OrderNum = 3 }.Publish();
  272. });
  273. SimOrderMakeWater = new RelayCommand(() =>
  274. {
  275. new MorkTSimOrder() { OrderNum = 4 }.Publish();
  276. });
  277. Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl);
  278. Robot_DOutput = new RelayCommand(Button_RobotDoutput);
  279. Button_MakeCoffeeCommand = new RelayCommand(Button_MakeCoffee);
  280. Button_StopMakeCoffeCommand = new RelayCommand(Button_StopMakeCoffe);
  281. Button_CoffeeModeSetCommand = new RelayCommand(Button_CoffeeModeSet);
  282. Button_MCUOuputCommand = new RelayCommand(Button_McuPWMOutput);
  283. Button_MCUDOuputCommand = new RelayCommand(Button_McuDOutput);
  284. Button_MakeJuiceCommand = new RelayCommand(Button_MakeJuice);
  285. IceMaker_BtnPowerOn = new RelayCommand(IceMaker_BtnPowerOnCommand);
  286. IceMaker_BtnStandby = new RelayCommand(IceMaker_BtnStandbyCommand);
  287. IceMaker_BtnPump = new RelayCommand(IceMaker_BtnPumpCommand);
  288. IceMaker_BtnStart = new RelayCommand(IceMaker_BtnStartCommand);
  289. IceMaker_BtnEnd = new RelayCommand(IceMaker_BtnEndCommand);
  290. IceMaker_BtnSetIceTime = new RelayCommand(IceMaker_BtnSetIceTimeCommand);
  291. foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode)))
  292. {
  293. Coffees.Add(code.ToString());
  294. }
  295. SelectedCoffee = Coffees[0];
  296. SimOrderCoffeeList = Coffees[0];
  297. foreach (DrCoffeeCommCmd code in Enum.GetValues(typeof(DrCoffeeCommCmd)))
  298. {
  299. CoffeeCmds.Add(code.ToString());
  300. }
  301. SelectedCoffeeCmd = CoffeeCmds[0];
  302. Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device =>
  303. {
  304. if (device.Name == "Container") DeviceId = device.DeviceId
  305. ;
  306. });
  307. ThreadManage.GetInstance().StartLong(new Action(async () =>
  308. {
  309. variableMonitors = Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;
  310. if (variableMonitors != null && variableMonitors.Count > 0)
  311. {
  312. #region 机器人
  313. RobotConnected = variableMonitors.FirstOrDefault(p => p.Notes == "机器人连接状态").CurrentValue == "True" ? "已连接" : "未连接";
  314. RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue;
  315. Robot_TCPDI0 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人TCP输入状态").SwitchValue;
  316. Robot_DI0 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入0状态").SwitchValue;
  317. Robot_DI1 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入1状态").SwitchValue;
  318. Robot_DI2 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入2状态").SwitchValue;
  319. Robot_DI3 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入3状态").SwitchValue;
  320. #endregion
  321. #region 咖啡机
  322. CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
  323. CoffeeStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机状态").CurrentValue;
  324. AppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue;
  325. Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue;
  326. CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue;
  327. #endregion
  328. #region 单片机
  329. MCUConnected = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
  330. MCUDI0 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入0状态").SwitchValue;
  331. MCUDI1 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入1状态").SwitchValue;
  332. MCUDI2 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入2状态").SwitchValue;
  333. MCUDI3 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入3状态").SwitchValue;
  334. MCUDI4 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入4状态").SwitchValue;
  335. MCUDI5 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入5状态").SwitchValue;
  336. MCUDI6 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入6状态").SwitchValue;
  337. MCUDI7 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入7状态").SwitchValue;
  338. #endregion
  339. #region 制冰机
  340. IceMakerConnect = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
  341. IceMakerState = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机设备状态").IntValue;
  342. if (IceMakerState>=0 && IceMakerState<=255)
  343. {
  344. byte a = (byte)IceMakerState;
  345. if ((a >> 0 & 1) == 1)
  346. {
  347. IceMakerState1 = "关机状态";
  348. }
  349. else
  350. {
  351. IceMakerState1 = "开机状态";
  352. }
  353. if ((a >> 1 & 1) == 1)
  354. {
  355. IceMakerState2 = "制冰状态";
  356. }
  357. else
  358. {
  359. IceMakerState2 = "待机状态";
  360. }
  361. if ((a >> 2 & 1) == 1)
  362. {
  363. IceMakerState3 = "电机故障";
  364. }
  365. else
  366. {
  367. IceMakerState3 = "正常";
  368. }
  369. if ((a >> 3 & 1) == 1)
  370. {
  371. IceMakerState4 = "缺水";
  372. }
  373. else
  374. {
  375. IceMakerState4 = "正常";
  376. }
  377. if ((a >> 4 & 1) == 1)
  378. {
  379. IceMakerState5 = "冰满";
  380. }
  381. else
  382. {
  383. IceMakerState5 = "未定义";
  384. }
  385. }
  386. #endregion
  387. /*
  388. List<int> res = new List<int>();
  389. byte[] receive = new byte[32] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, 0x31, 0x32 };
  390. res.Add(receive.Skip(24).Take(4).ToArray().BytesToInt());
  391. res.Add(receive.Skip(28).Take(4).ToArray().BytesToInt());
  392. int[] am = res.ToArray();
  393. var Juicestate1 = Convert.ToString(am[0], 2);
  394. var Juicestate2 = am[1];
  395. int cd = Juicestate1.IndexOf("0");*/
  396. #region 果汁机
  397. JuicerConnected = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
  398. JuiceState_Heating = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制热").CurrentValue == "True" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
  399. JuiceState_Cooling = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制冷").CurrentValue == "True" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
  400. JuiceState_LackOfWater = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机缺水").CurrentValue == "True" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
  401. JuiceState_ChildLocks = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机童锁").CurrentValue == "True" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
  402. JuiceState_Using = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机使用").CurrentValue == "True" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
  403. #endregion
  404. Thread.Sleep(200);
  405. }
  406. }), "MorkT-状态刷新");
  407. }
  408. }