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); } }
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())); } } } }
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())); } } } }