示例#1
0
        private async void OnDeviceValuesUpdated()

        {
            StarterViewModels.ForEach(model => model?.Update());
            DefectStateViewModel.Update();
            DeviceSignature = (_model as IRuntimeDevice).DeviceSignature;
            _outgoingLinesViewModel?.Update();
            _customItemsViewModel?.Update();
            if (StarterViewModels.Any((model => model.IsInRepairState == true)))
            {
                StateWidget = WidgetState.Repair;
            }
            //TODO: check widget going into repair mode
            else if (DefectStateViewModel.HasAnyDefect)
            {
                StateWidget = WidgetState.Crash;
            }
            else
            {
                StateWidget = WidgetState.Norm;
            }

            try
            {
                await _deviceCommandService.TryExecuteCommandOnDevice(this);
            }
            catch (Exception e)
            {
                //
            }
        }
示例#2
0
 private async void OnConnectionLost()
 {
     if (StateWidget == WidgetState.NoConnection)
     {
         return;
     }
     await Task.Run((() =>
     {
         StateWidget = WidgetState.NoConnection;
         StarterViewModels.ForEach((model => model?.SetLostConnection()));
         DefectStateViewModel.SetLostConnection();
         OutgoingLinesViewModel?.SetConnectionLost();
         CustomItemsViewModel?.SetLostConnection();
     }));
 }