public async void OnNavigatedTo(NavigationParameters parameters) { if (!parameters.ContainsKey("Images")) { return; } IsLoading = true; ObservableCollection <AlbumItem> albumItems = (ObservableCollection <AlbumItem>)parameters["Images"]; foreach (AlbumItem t in albumItems) { ImagesWithComments temp = new ImagesWithComments(); temp.Items.Add(new Comment { CurrentType = GalleryType.Image, Image = t }); foreach (Comment c in await _azure.GetComments(t.ID)) { temp.Items.Add(c); } temp.Items.Add(new Comment { CurrentType = GalleryType.AddComment }); temp.AddCommentText = ""; Images.Add(temp); } if (albumItems.Count != Images.Count) { Debug.WriteLine("what?"); } try { if (!parameters.ContainsKey("Current")) { SelectedImage = Images.First(); return; } int index = albumItems.IndexOf((AlbumItem)parameters["Current"]); if (index != -1) { SelectedImage = Images[index]; } } catch (Exception ex) { Debug.WriteLine(ex.Message); } Title = SelectedImage.Items.First().Image.IsReceipt ? "Receipts" : "Goods"; IsLoading = false; }
public async void RefreshComments(string id) { Comments.Clear(); var result = await _azure.GetComments(id); foreach (Comment c in result) { Comments.Add(c); } }