Beispiel #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("Статус обновлен");
                    }
                }
            }
        }
Beispiel #2
0
 public virtual Task <DeviceStatusInfo> TryReadStatusAsync(AsyncOperationInfo operationInfo = null)
 => _base.TryReadStatusAsync(operationInfo);
Beispiel #3
0
 public virtual Task <StatusReadResult> TryReadStatusAsync(DeviceOperationScope scope, AsyncOperationInfo cancellation)
 {
     return(_base.TryReadStatusAsync(scope, cancellation));
 }