コード例 #1
0
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        public static IList <Fee> Get(this IFeeOperations operations,
                                      string locationId,
                                      bool isContinous = false)
        {
            //return new ActiveList<Fee>
            //{
            //    _Fees = Task
            //    .Factory
            //    .StartNew(s => ((IFeeOperations)s).GetAsync(locationId, beginTime, endTime, listOrder, limit), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default)
            //    .Unwrap()
            //    .GetAwaiter()
            //    .GetResult(),
            //};

            var task = Task.Run(() => operations.GetWithHttpMessagesAsync(locationId, null));

            task.Wait();

            return(new ActiveList <Fee>
            {
                InitialUri = task.Result.Request.RequestUri.AbsoluteUri,
                Collection = task.Result.Body,
                NextUri = task.Result.ToNextUri(),
                Operations = operations,
                IsContinous = isContinous,
            });
        }
コード例 #2
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <Fee> > GetAsync(this IFeeOperations operations,
                                                  string locationId,
                                                  bool isContinous = false,
                                                  CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var result = await operations.GetWithHttpMessagesAsync(locationId, null, cancellationToken).ConfigureAwait(false))
     {
         return(new ActiveList <Fee>
         {
             InitialUri = result.Request.RequestUri.AbsoluteUri,
             Collection = result.Body,
             NextUri = result.ToNextUri(),
             Operations = operations,
             IsContinous = isContinous,
             CancellationToken = cancellationToken,
         });
     }
 }
コード例 #3
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='value'>
 /// </param>
 public static void Post(this IFeeOperations operations, string locationId, Fee value)
 {
     Task.Factory.StartNew(s => ((IFeeOperations)s).PostAsync(locationId, value), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
コード例 #4
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='value'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task PutAsync(this IFeeOperations operations, string locationId, string id, Fee value, CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.PutWithHttpMessagesAsync(locationId, id, value, null, cancellationToken).ConfigureAwait(false);
 }