|
- using BPA.Helper;
- using BPA.Message.Enum;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using Newtonsoft.Json;
- using BPA.Message;
- using System.Windows;
-
- namespace BPASmartClient.ScreenLib
- {
- public class ScreenMorksControlViewModel : NotifyBase
- {
- #region 变量
- /// <summary>
- /// 广告地址
- /// </summary>
- public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
- private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());
- /// <summary>
- /// 界面数据绑定
- /// </summary>
- public ScreenModelMorkS ViewData
- {
- get { return _ViewData; }
- set
- {
- _ViewData = value;
- OnPropertyChanged();
- }
- }
- private ScreenModelMorkS _ViewData = new ScreenModelMorkS();
-
- /// <summary>
- /// 当前刷新数据类型
- /// </summary>
- public ScreenDeviceType type = ScreenDeviceType.煮面机;
-
- /// <summary>
- /// 正在制作订单数据
- /// </summary>
- public ObservableCollection<OrderMakeFormModel> OrderMakeList
- {
- get { return _OrderMakeList; }
- set
- {
- _OrderMakeList = value;
- OnPropertyChanged();
- }
- }
- private ObservableCollection<OrderMakeFormModel> _OrderMakeList = new ObservableCollection<OrderMakeFormModel>();
-
- /// <summary>
- /// 制作完成订单数据
- /// </summary>
- public ObservableCollection<OrderMakeFormModel> OrderMakeListOver
- {
- get { return _OrderMakeListOver; }
- set
- {
- _OrderMakeListOver = value;
- OnPropertyChanged();
- }
- }
- private ObservableCollection<OrderMakeFormModel> _OrderMakeListOver = new ObservableCollection<OrderMakeFormModel>();
- #endregion
-
- public ScreenMorksControlViewModel()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
- {
- if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
- {
- ScreenModelMorkS modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelMorkS;
- if (modelMaxWok != null && modelMaxWok.Alarm != null)
- modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
- ViewData = modelMaxWok;
- OrderMakeList = JsonConvert.DeserializeObject<ObservableCollection<OrderMakeFormModel>>(JsonConvert.SerializeObject(ViewData.MakeOrder));
- OrderMakeListOver = JsonConvert.DeserializeObject<ObservableCollection<OrderMakeFormModel>>(JsonConvert.SerializeObject(ViewData.MakeOrderOver));
- }
- }));
- Thread.Sleep(100);
- }), $"{DateTime.Now},线程服务");
- }
- }
- }
|