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