终端一体化运控平台
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

ScreenSplitMealsControl3ViewModel.cs 2.0 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using BPA.Helper;
  2. using BPA.Message;
  3. using BPA.Message.Enum;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Collections.ObjectModel;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading;
  10. using System.Threading.Tasks;
  11. namespace BPASmartClient.ScreenLib
  12. {
  13. public class ScreenSplitMealsControl3ViewModel : NotifyBase
  14. {
  15. #region 变量
  16. /// <summary>
  17. /// 广告地址
  18. /// </summary>
  19. public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
  20. private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());
  21. /// <summary>
  22. /// 界面数据绑定
  23. /// </summary>
  24. public ScreenModelSplitMeals ViewData
  25. {
  26. get { return _ViewData; }
  27. set
  28. {
  29. _ViewData = value;
  30. OnPropertyChanged();
  31. }
  32. }
  33. private ScreenModelSplitMeals _ViewData = new ScreenModelSplitMeals();
  34. /// <summary>
  35. /// 当前刷新数据类型
  36. /// </summary>
  37. public ScreenDeviceType type = ScreenDeviceType.分餐机;
  38. #endregion
  39. public ScreenSplitMealsControl3ViewModel()
  40. {
  41. ThreadManage.GetInstance().StartLong(new Action(() =>
  42. {
  43. System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
  44. {
  45. if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
  46. {
  47. ScreenModelSplitMeals modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelSplitMeals;
  48. if (modelMaxWok != null && modelMaxWok.Alarm != null)
  49. modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
  50. ViewData = modelMaxWok;
  51. }
  52. }));
  53. Thread.Sleep(1000);
  54. }), $"{DateTime.Now}_3,线程服务");
  55. }
  56. }
  57. }