Ejemplo n.º 1
0
        public void OnSystemStatusChange(RunStatusChangeEventArgs args)
        {
            CurrentContext.Status = args.SysStatus;

            if (CurrentContext.SysCache != null)
            {
                CurrentContext.SysCache.SystemRealTimeStatus.CurrStatus = args.SysStatus;
            }

            if (args.SysStatus == SysStatusEnum.Starting)
            {
                foreach (var ctrl in Controllers.Where(each => each.Device.DeviceType == TargetDeviceTypeEnum.Pump))
                {
                    var pumpCtrl = ctrl as PumpController;
                    if (pumpCtrl == null)
                    {
                        continue;
                    }

                    var ftime = pumpCtrl.PumpCultivation.Schedules.FirstOrDefault();
                    var ltime = pumpCtrl.PumpCultivation.Schedules.LastOrDefault();
                    var stime = DateTime.MinValue;
                    var etime = DateTime.MinValue;
                    var ntime = pumpCtrl.PumpCultivation.Schedules.FirstOrDefault(each => each > DateTime.Now);

                    CurrentContext.SysCache?.SystemRealTimeStatus.Update(pumpCtrl.Device.DeviceId, false, pumpCtrl.Volume, 0,
                                                                         pumpCtrl.AlreadyRunTimes, pumpCtrl.PumpCultivation.Schedules.Count, ftime, ltime, stime, etime, ntime);
                }
            }



            SystemStatusChangeEvent?.Invoke(this, args);
        }
Ejemplo n.º 2
0
 public void Handle(SystemStatusChangeEvent message)
 {
     IsBusy = message.State != SystemState.Idle;
 }