示例#1
0
        private async Task <Entity> LoadBalanceAsync(string keyWord, int distance)
        {
            RestClient c = new RestClient();

            c.BaseUrl = new Uri(_Strategy.BalanceUrl()); //new Uri(Urls[urlIndex % 2]);
            urlIndex += 1;

            if (urlIndex == 2)
            {
                urlIndex = 1;
            }

            var request = new RestRequest(Method.GET);

            request.AddParameter("keyWord", keyWord);
            request.AddParameter("distance", distance.ToString());

            Entity entity = new Entity
            {
                Words = Summaries
            };

            request.AddJsonBody(entity);

            var response = await c.ExecuteAsync <Entity>(request);

            return(response.Data);
        }
示例#2
0
        private async Task <Entity> LoadBalanceAsyncPrimes(int startInt, int endInt)
        {
            //Set up the client
            RestClient c = new RestClient();

            c.BaseUrl = new Uri(_Strategy.BalanceUrl() + "/getPrimes");

            //Create the request
            var request = new RestRequest(Method.GET);

            request.AddParameter("startInt", startInt);
            request.AddParameter("endInt", endInt);

            //Wait for the response
            var response = await c.ExecuteAsync <Entity>(request);

            return(response.Data);
        }