private async Task GetUrlsAsync()
        {
            var requestUri = BuildTrendingGifRequestUri();

            try
            {
                var getURL  = await new HttpClient().GetAsync(requestUri);
                var content = await getURL.Content.ReadAsStringAsync();

                JObject json       = JObject.Parse(content);
                int     statusCode = GiphyUtils.GetStatusCodeFromJsonObject(json);
                if (statusCode != (int)EGiphyResponseStatusCodes.OK)
                {
                    return;
                }

                lock (_lock)
                {
                    _urlsList = GiphyUtils.GetUrlListFromJsonObject(json);
                    //GiphyUtils.PrintList(_urlsList);
                }
            }
            catch (Exception ex)
            {
                Logger.Logger.Instance.WriteToLog($"Exception occured: {ex.Message}");
            }
        }
Пример #2
0
        private async Task GetUrlsAsync()
        {
            var requestUri = BuildSearchGifRequestUri();
            var getURL     = await new HttpClient().GetAsync(requestUri);
            var content    = await getURL.Content.ReadAsStringAsync();

            JObject json = JObject.Parse(content);

            lock (_lock)
            {
                _urlsList = GiphyUtils.GetUrlListFromJsonObject(json);
                //GiphyUtils.PrintList(_urlsList);
            }
        }