private async void PopulateTagSamplesAsync(Guid projectId, TrainingApi trainingEndPoint, ObservableCollection <TagSampleViewModel> collection) { foreach (var tag in (await trainingEndPoint.GetTagsAsync(projectId)).Tags.OrderBy(t => t.Name)) { if (tag.ImageCount > 0) { var imageModelSample = await trainingEndPoint.GetImagesByTagsAsync(projectId, null, new string[] { tag.Id.ToString() }, null, 1); collection.Add(new TagSampleViewModel { TagName = tag.Name, TagSampleImage = imageModelSample.First().ThumbnailUri }); } } }
private async Task LoadTagImagesFromService() { this.progressControl.IsActive = true; this.SelectedTagImages.Clear(); try { IEnumerable <ImageModel> images = await trainingApi.GetImagesByTagsAsync(this.CurrentProject.Id, null, new string[] { this.SelectedTag.Id.ToString() }, null, 200); this.SelectedTagImages.AddRange(images); } catch (Exception e) { await Util.GenericApiCallExceptionHandler(e, "Failure loading images for this tag"); } this.progressControl.IsActive = false; }