Esempio n. 1
0
 /// <summary>
 /// Executes a manual state change action on the Alarm with the Id provided
 /// (Alarm must have an Unrestricted TransitionModel).  The result will
 /// generate a new AlarmEvent based on the information contained in the
 /// newEvent parameter.
 /// Restrictions apply based on the TransitionModel of the Alarm.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Id of the Alarm to be Acknowledged.  Must be double URL encoded.
 /// </param>
 /// <param name='newEvent'>
 /// Information to describe the generated AlarmEvent.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <AlarmModel> ChangeStateAsync(this IAlarms operations, string id, AlarmEventStateChangeInfo newEvent, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ChangeStateWithHttpMessagesAsync(id, newEvent, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Executes a manual state change action on the Alarm with the Id provided
 /// (Alarm must have an Unrestricted TransitionModel).  The result will
 /// generate a new AlarmEvent based on the information contained in the
 /// newEvent parameter.
 /// Restrictions apply based on the TransitionModel of the Alarm.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Id of the Alarm to be Acknowledged.  Must be double URL encoded.
 /// </param>
 /// <param name='newEvent'>
 /// Information to describe the generated AlarmEvent.
 /// </param>
 public static AlarmModel ChangeState(this IAlarms operations, string id, AlarmEventStateChangeInfo newEvent)
 {
     return(Task.Factory.StartNew(s => ((IAlarms)s).ChangeStateAsync(id, newEvent), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }