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 T TryGetFeature <T>() where T : class, IRUSDeviceFeature { return(_base.TryGetFeature <T>()); }