async void HandleItemImageTap(object sender, System.EventArgs e) { List <Photo> photos; try { photos = await viewModel.GetPhotosForItem(); } catch (Exception ex) { HandleException(ex); return; } if (photos != null) { PhotoBrowser photoBrowser = new PhotoBrowser(); photoBrowser.Photos = photos; photoBrowser.Show(); } else { var message = "An error occured when loading list of images."; Debug.WriteLine(message); await DisplayAlert("Error", message, "OK"); } }
private void OnClickedShowGallery(object sender, EventArgs e) { if (photoBrowser == null) { photoBrowser = new PhotoBrowser(); photoBrowser.EnableGrid = true; List <Photo> Photos = new List <Photo>(); for (int i = 0; i < viewModel.FurnitureProduct.ImageList.Length; i++) { Photo p = new Photo(); p.Title = ""; p.URL = viewModel.FurnitureProduct.ImageList[i]; Photos.Add(p); } photoBrowser.Photos = Photos; } string url = ((sender as Image).GestureRecognizers[0] as TapGestureRecognizer).CommandParameter as string; int index = viewModel.FurnitureProduct.ImageList.ToList().IndexOf(url); photoBrowser.StartIndex = index; photoBrowser.Show(); }
protected void OnClickedShowGallery(object sender, EventArgs e) { var img = sender as Image; string url = (img.GestureRecognizers[0] as TapGestureRecognizer).CommandParameter as string; var image = GetPhotos.Where(x => x.URL == url).SingleOrDefault(); var index = GetPhotos.IndexOf(image); //new PhotoBrowser //{ // Photos = GetPhotos, // EnableGrid = true, // StartIndex = index, //}.Show(); PhotoBrowser.Photos = GetPhotos; PhotoBrowser.StartIndex = index; PhotoBrowser.Show(); }
private async void stk_contracts_tap(object sender, EventArgs e) { using (var cl = new HttpClient()) { var formcontent = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("owner_id", App.owner_ID) }); try { var request = await cl.PostAsync(Constants.SERVER_BASE_URL + "get_agreement_all", formcontent); request.EnsureSuccessStatusCode(); var response = await request.Content.ReadAsStringAsync(); ResponseMsg resultMsg = JsonConvert.DeserializeObject <ResponseMsg>(response); if (resultMsg.resp.Equals("success")) { var photoBrowser = new PhotoBrowser(); var photoList = new List <Photo>(); if (App.owner_license != null) { var licence_photo = new Photo(); licence_photo.URL = Constants.LICENCE_IMAGE_URL_PREFIX + App.owner_license; photoList.Add(licence_photo); } int image_num = resultMsg.agreement_data.Length; if (image_num > 0) { for (int i = 0; i < image_num; i++) { var photo = new Photo(); photo.URL = Constants.AGREEMENT_IMAGE_URL_PREFIX + resultMsg.agreement_data[i].agreement_image; photoList.Add(photo); } photoBrowser.Photos = photoList; photoBrowser.Show(); } else { await DisplayAlert("", "管理委託契約した建物が存在しません。", "はい"); } } else { await DisplayAlert("", resultMsg.resp, "はい"); } } catch { await DisplayAlert("", Constants.NETWORK_ERROR, "はい"); } } }
private void ImageListView_FlowItemTapped(object sender, ItemTappedEventArgs e) { if (PhotoBrowser == null) { PhotoBrowser = new PhotoBrowser { Photos = Photos, EnableGrid = true, }; } var item = e.Item as string; int index = _imageList.ToList().IndexOf(item); PhotoBrowser.StartIndex = index; PhotoBrowser.Show(); }
private void OnShowImage() { try { var browser = new PhotoBrowser(); List <Photo> photos = new List <Photo>(); photos.Add(new Photo { URL = CognitiveRequest.ImageUrl }); browser.Photos = photos; browser.ActionButtonPressed = (x) => { PhotoBrowser.Close(); }; browser.Show(); } catch (Exception ex) { Debug.WriteLine($"ERROR:{ex.Message}"); } }
private void ShowPictures(int index) { var photos = new List <Photo>(); foreach (var information in _dataInformation) { photos.Add(new Photo { URL = $"file://{information.ImageSource}", Title = information.Info }); } PhotoBrowser.Close(); PhotoBrowser = new PhotoBrowser { Photos = photos, //EnableGrid = false, StartIndex = index, }; PhotoBrowser.Show(); PhotoBrowser.EnableGrid = true; }