示例#1
0
        public JToken StartTaskSync(IApiQuery query)
        {
            _concurrentQueue.Enqueue(query);
            byte i = 0;

            do
            {
                _resetEvent.WaitOne();
                if (i == 3)
                {
                    Log.Error("VK API EXECUTE ERROR: long wait");
                    throw new Exception("VK API EXECUTE ERROR: long wait");
                }
                i++;
            } while (query.Responce == null);
            JToken error;

            if (query.Responce.GetType() == typeof(JObject) && ((JObject)query.Responce).TryGetValue("error", out error))
            {
                TryThrowException(error);
            }


            return(query.Responce);
        }
示例#2
0
 public Task <JToken> StartTaskAsync(IApiQuery query)
 {
     return(Task <JToken> .Factory.StartNew(() => StartTaskSync(query)));
 }