Наследование: global::Java.Lang.Object, IOuyaResponseListener
Пример #1
0
        /// <summary>
        /// Requests the current receipts from the Store. If the Store is not available, the cached
        /// receipts from a previous call are returned.
        /// </summary>
        /// <returns>The list of Receipt objects.</returns>
        public async Task <IList <Receipt> > RequestReceiptsAsync()
        {
            // We need the gamer UUID for the encryption of the cached receipts, so if the dev
            // hasn't retrieved the gamer UUID yet, we'll grab it now.
            var task = Task <IList <Receipt> > .Factory.StartNew(() =>
            {
                if (_gamerInfo == null)
                {
                    _gamerInfo = RequestGamerInfoAsync().Result;
                }
                // No gamerInfo means no receipts
                if (_gamerInfo == null)
                {
                    return(null);
                }
                var tcs      = new TaskCompletionSource <IList <Receipt> >();
                var listener = new ReceiptsListener(tcs, _publicKey, _gamerInfo.Uuid);
                RequestReceipts(listener);
                return(tcs.Task.TimeoutAfter(timeout).Result);
            });

            try
            {
                return(await task);
            }
            catch (Exception e)
            {
                Log(e.GetType().Name + ": " + e.Message);
            }
            return(_gamerInfo != null?ReceiptsListener.FromCache(_gamerInfo.Uuid) : null);
        }
Пример #2
0
        /// <summary>
        /// Requests the current receipts from the Store. If the Store is not available, the cached
        /// receipts from a previous call are returned.
        /// </summary>
        /// <returns>The list of Receipt objects.</returns>
        public async Task <IList <Receipt> > RequestReceiptsAsync()
        {
            // We need the gamer UUID for the encryption of the cached receipts, so if the dev
            // hasn't retrieved the gamer UUID yet, we'll grab it now.
            var task = Task <IList <Receipt> > .Factory.StartNew(() =>
            {
                if (string.IsNullOrEmpty(_gamerUuid))
                {
                    _gamerUuid = RequestGamerUuidAsync().Result;
                }
                var tcs      = new TaskCompletionSource <IList <Receipt> >();
                var listener = new ReceiptsListener(tcs, _publicKey, _gamerUuid);
                RequestReceipts(listener);
                return(tcs.Task.Result);
            });

            return(await task);
        }
Пример #3
0
 /// <summary>
 /// Requests the current receipts from the Store. If the Store is not available, the cached
 /// receipts from a previous call are returned.
 /// </summary>
 /// <returns>The list of Receipt objects.</returns>
 public async Task<IList<Receipt>> RequestReceiptsAsync()
 {
     // We need the gamer UUID for the encryption of the cached receipts, so if the dev
     // hasn't retrieved the gamer UUID yet, we'll grab it now.
     var task = Task<IList<Receipt>>.Factory.StartNew(() =>
         {
             if (_gamerInfo == null)
                 _gamerInfo = RequestGamerInfoAsync().Result;
             // No gamerInfo means no receipts
             if (_gamerInfo == null)
                 return null;
             var tcs = new TaskCompletionSource<IList<Receipt>>();
             var listener = new ReceiptsListener(tcs, _publicKey, _gamerInfo.Uuid);
             RequestReceipts(listener);
             return tcs.Task.TimeoutAfter(timeout).Result;
         });
     try
     {
         return await task;
     }
     catch (Exception e)
     {
         Log(e.GetType().Name + ": " + e.Message);
     }
     return _gamerInfo != null ? ReceiptsListener.FromCache(_gamerInfo.Uuid) : null;
 }
Пример #4
0
 /// <summary>
 /// Requests the current receipts from the Store. If the Store is not available, the cached
 /// receipts from a previous call are returned.
 /// </summary>
 /// <returns>The list of Receipt objects.</returns>
 public async Task<IList<Receipt>> RequestReceiptsAsync()
 {
     // We need the gamer UUID for the encryption of the cached receipts, so if the dev
     // hasn't retrieved the gamer UUID yet, we'll grab it now.
     var task = Task<IList<Receipt>>.Factory.StartNew(() =>
         {
             if (string.IsNullOrEmpty(_gamerUuid))
                 _gamerUuid = RequestGamerUuidAsync().Result;
             var tcs = new TaskCompletionSource<IList<Receipt>>();
             var listener = new ReceiptsListener(tcs, _publicKey, _gamerUuid);
             RequestReceipts(listener);
             return tcs.Task.Result;
         });
     return await task;
 }