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

89 regels
2.8 KiB

  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 ScreenSplitMealsControl1ViewModel : 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. /// <summary>
  39. /// 订单总数
  40. /// </summary>
  41. public int OrderCount
  42. {
  43. get { return _OrderCount; }
  44. set
  45. {
  46. _OrderCount = value;
  47. OnPropertyChanged();
  48. }
  49. }
  50. private int _OrderCount = 0;
  51. private DateTime _CurrentTime = DateTime.Now;
  52. /// <summary>
  53. /// 当前时间
  54. /// </summary>
  55. public DateTime CurrentTime
  56. {
  57. get { return _CurrentTime; }
  58. set { _CurrentTime = value; OnPropertyChanged(); }
  59. }
  60. #endregion
  61. public ScreenSplitMealsControl1ViewModel()
  62. {
  63. TaskManage.GetInstance.StartLong(new Action(() =>
  64. {
  65. System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
  66. {
  67. if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
  68. {
  69. ScreenModelSplitMeals modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelSplitMeals;
  70. if (modelMaxWok != null && modelMaxWok.Alarm != null)
  71. modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
  72. ViewData = modelMaxWok;
  73. OrderCount = modelMaxWok.SplitMeals_CreditCardCount_1 + modelMaxWok.SplitMeals_CreditCardCount_2;
  74. }
  75. CurrentTime = DateTime.Now;
  76. }));
  77. Thread.Sleep(100);
  78. }), $"{DateTime.Now}_1,线程服务");
  79. }
  80. }
  81. }