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;
namespace BPASmartClient.ScreenLib
{
public class ScreenSplitMealsControl1ViewModel : NotifyBase
{
#region 变量
///
/// 柱状图显示集合
///
public IEnumerable> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } }
private IEnumerable> _Histogram = new List>();
///
/// 设备是否运行
///
public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
private DevIsRun _DevIsRun = DevIsRun.停止;
///
/// 设备状态
///
public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
private DevRunStatus _RunStatus = DevRunStatus.正常;
///
/// 订单数
///
public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } }
private int _DdCount = 0;
///
/// 异常订单数
///
public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
private int _YCDdCount = 0;
///
/// 广告地址
///
public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());
///
/// 告警数据
///
public ObservableCollection AlarmList
{
get { return _AlarmList; }
set
{
_AlarmList = value;
OnPropertyChanged();
}
}
private ObservableCollection _AlarmList = new ObservableCollection();
///
/// 菜品类型-左
///
public ObservableCollection CookTypeListLeft
{
get { return _CookTypeListLeft; }
set
{
_CookTypeListLeft = value;
OnPropertyChanged();
}
}
private ObservableCollection _CookTypeListLeft = new ObservableCollection();
///
/// 菜品类型-右边
///
public ObservableCollection CookTypeListReit
{
get { return _CookTypeListReit; }
set
{
_CookTypeListReit = value;
OnPropertyChanged();
}
}
private ObservableCollection _CookTypeListReit = new ObservableCollection();
#endregion
public ScreenSplitMealsControl1ViewModel()
{
Init();
}
///
/// 初始化
///
public void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
RunStatus = RunStatus == DevRunStatus.正常 ? DevRunStatus.异常 : DevRunStatus.正常;
DevIsRun = DevIsRun == DevIsRun.运行 ? DevIsRun.停止 : DevIsRun.运行;
DdCount = new Random().Next(0, 400);
YCDdCount = new Random().Next(0, 400);
List oRDER_s = new List() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING };
List oRDER_s1 = new List() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE };
List name_s = new List() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭", "炒茄子" };
CookTypeListReit = new ObservableCollection();
CookTypeListReit.Add(new CookType { Name = name_s[0],Name1= name_s[1] });
CookTypeListReit.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
CookTypeListReit.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });
CookTypeListLeft = new ObservableCollection();
CookTypeListLeft.Add(new CookType { Name = name_s[0], Name1 = name_s[1] });
CookTypeListLeft.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
CookTypeListLeft.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });
AlarmList = new ObservableCollection();
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
Histogram = new[] {
new KeyValuePair(name_s[0], new Random().Next(0,400)),
new KeyValuePair(name_s[1], new Random().Next(0,400)),
new KeyValuePair(name_s[2], new Random().Next(0,400)),
new KeyValuePair(name_s[3], new Random().Next(0,400)),
new KeyValuePair(name_s[4], new Random().Next(0,400))};
}));
Thread.Sleep(5000);
}), $"{DateTime.Now}_1,线程服务");
}
}
}