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

62 rivejä
2.0 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 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. }