Пример #1
0
 public void UpdateInfo(Tray trayData)
 {
     Application.Current.Dispatcher.Invoke(new Action(() =>
     {
         TrayData = trayData;
         OnPropertyChanged(nameof(TrayData));
     }));
 }
Пример #2
0
        public void TrayIn()
        {
            if (NowTrayId != null)
            {
                TrayOut();
            }
            NowTrayId = Guid.NewGuid().ToString();
            var tray = new Tray(NowTrayId);

            Trays.Add(tray);
        }
Пример #3
0
        public void TrayOut()
        {
            Task.Run(() => {
                //保存计数
                SaveCount();
                //统计数据
                LoadStatistical();
            });
            if (NowTrayId == null)
            {
                return;
            }
            var nowTray = NowTray;

            if (nowTray == null)
            {
                return;
            }
            if (!nowTray.IsComplate || (!nowTray.IsNg && !nowTray.IsPosting))
            {
                Remove();
                if (!nowTray.IsComplate)
                {
                    OnSignalError?.Invoke();
                }
            }
            else
            {
                Task.Run(() =>
                {
                    Tray NgTray = Trays.FirstOrDefault();
                    if (NgTray == null)
                    {
                        Remove(); return;
                    }
                    //计算停机延时
                    double speed = double.Parse(App.Settings.Speed);
                    double delay = App.Config.Tray.StopInterval / speed;
                    Task.Delay((int)delay).Wait();
                    if (nowTray.IsNg || nowTray.IsPosting)
                    {
                        OnNg?.Invoke(NgTray);
                    }
                    Remove();
                });
            }
            NowTrayId = null;
        }