终端一体化运控平台
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

77 lines
2.5 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. #endregion
  52. public ScreenSplitMealsControl1ViewModel()
  53. {
  54. TaskManage.GetInstance.StartLong(new Action(() =>
  55. {
  56. System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
  57. {
  58. if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
  59. {
  60. ScreenModelSplitMeals modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelSplitMeals;
  61. if (modelMaxWok != null && modelMaxWok.Alarm != null)
  62. modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
  63. ViewData = modelMaxWok;
  64. OrderCount = modelMaxWok.SplitMeals_CreditCardCount_1 + modelMaxWok.SplitMeals_CreditCardCount_2;
  65. }
  66. }));
  67. Thread.Sleep(100);
  68. }), $"{DateTime.Now}_1,线程服务");
  69. }
  70. }
  71. }