/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <DeviceType> > GetDeviceTypesAsync(this IDeviceTypes operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetDeviceTypesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Registers the given device-type handlers. /// </summary> /// <param name="handler">The device-type handler to register.</param> public void RegisterDeviceTypes(IDeviceTypes handler) { if (handler == null) { throw new ArgumentNullException(nameof(handler)); } deviceTypes.Add(handler); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> public static IList <DeviceType> GetDeviceTypes(this IDeviceTypes operations) { return(Task.Factory.StartNew(s => ((IDeviceTypes)s).GetDeviceTypesAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }