Пример #1
0
        public async Task <TValue> Write(TValue value, CancellationToken cancel = default)
        {
            var result = await _paramSvc.Write(_param, (type, paramValue) => { _param.SetValue(paramValue, value); },
                                               cancel);

            return(_param.GetValue(result));
        }
Пример #2
0
        public static async Task <bool> WriteBool(this IPv2ClientParamsInterface src, Pv2ParamType param, bool value,
                                                  CancellationToken cancel = default)
        {
            if (param is not Pv2BoolParamType type)
            {
                throw new Exception($"Wrong type: want {nameof(Pv2BoolParamType)}. Got {param.GetType().Name}");
            }
            var result = await src.Write(param, (_, val) => type.SetValue(val, value), cancel).ConfigureAwait(false);

            return(type.GetValue(result));
        }