Exemplo n.º 1
0
        public DeviceStatusVM(IRUSDevice device, BusyObject isBusy)
        {
            _device = device ?? throw new ArgumentNullException(nameof(device));
            _isBusy = isBusy ?? throw new ArgumentNullException(nameof(isBusy));

            _device.TryGetFeature <StatusFeature>().StatusAcquired += DeviceStatusVM_StatusAcquired;

            Update = new ActionCommand(update, () => !_isBusy, _isBusy);

            async Task update()
            {
                using (_isBusy.BusyMode)
                {
                    var statusReadResult = await _device.TryReadStatusAsync(DeviceOperationScope.DEFAULT, CancellationToken.None);

                    if (statusReadResult.Status != ReadStatus.OK)
                    {
                        Info.Clear();
                        Flags.Clear();
                    }
                    else
                    {
                        Logger.LogOKEverywhere("Статус обновлен");
                    }
                }
            }
        }
Exemplo n.º 2
0
 public virtual T TryGetFeature <T>() where T : class, IRUSDeviceFeature
 {
     return(_base.TryGetFeature <T>());
 }