private Task<string> GetResponse (PostRequest request) { return Task.Run(() => { string result = request.SimplePOST(); return result; }); }
private async void GetQueue( int max) { RandomOrgAPIRequest RequestToRandom = new RandomOrgAPIRequest(max); string jsonContent = JsonConvert.SerializeObject(RequestToRandom); string url = " https://api.random.org/json-rpc/1/invoke"; PostRequest request = new PostRequest(url, jsonContent); string result = await GetResponse(request); if (result != "404") { RandomOrgAPIResponse responseRandomOrg = JsonConvert.DeserializeObject<RandomOrgAPIResponse>(result); randQueue = new Queue<int>(responseRandomOrg.GetNumbers()); } else { randOrgIsAvailable = false; } }