Пример #1
0
        public async Task GetImage()
        {
            try
            {
                var endpoint = new ImageEndpoint(client);
                var image    = await endpoint.GetImageAsync("  ");

                CurrentSearch.Clear();
                CurrentSearch.Add(fillPicture(image));
                Debug.Write("Image retrieved. Image Url: " + image.Link);
            }
            catch (ImgurException imgurEx)
            {
                Debug.Write("An error occurred getting an image from Imgur.");
                Debug.Write(imgurEx.Message);
            }
        }
Пример #2
0
        public async Task GetRandomGalleryAsync()
        {
            var endpoint = new GalleryEndpoint(client);
            var images   = await endpoint.GetRandomGalleryAsync();

            CurrentSearch.Clear();
            foreach (IGalleryItem item in images)
            {
                if (item is IGalleryImage)
                {
                    CurrentSearch.Add(fillPicture(item as IGalleryImage));
                }
                else if (item is IGalleryAlbum)
                {
                    if ((item as IGalleryAlbum).Images.First() != null)
                    {
                        CurrentSearch.Add(fillPicture((item as IGalleryAlbum).Images.First()));
                    }
                }
            }
        }
Пример #3
0
        public async Task GetGalleryTagAsync(string tagName)
        {
            var endpoint = new GalleryEndpoint(client);
            var tag      = await endpoint.GetGalleryTagAsync(tagName);

            CurrentSearch.Clear();
            foreach (IGalleryItem item in tag.Items)
            {
                if (item is IGalleryImage)
                {
                    CurrentSearch.Add(fillPicture(item as IGalleryImage));
                }
                else if (item is IGalleryAlbum)
                {
                    if ((item as IGalleryAlbum).Images.First() != null)
                    {
                        CurrentSearch.Add(fillPicture((item as IGalleryAlbum).Images.First()));
                    }
                }
            }
        }