async void doPhotoLibrary(PhotoListData pld) { #if __ANDROID__ MediaPicker picker = new MediaPicker(Forms.Context); #else MediaPicker picker = new MediaPicker(); #endif if (picker.IsPhotoGalleryAvailable == false) { var page = new ContentPage(); var result = page.DisplayAlert("Warning", "Photo is not available", "OK"); return; } else { try { var resultfile = await picker.PickPhoto(); #if __ANDROID__ //showDrawingView(pld); #else //showDrawingView(pld); #endif } catch (Exception e) { } } }
async void doCameraPhoto(PhotoListData pld) { #if __ANDROID__ MediaPicker picker = new MediaPicker(Forms.Context); #else MediaPicker picker = new MediaPicker(); #endif if (picker.IsCameraAvailable == false) { var page = new ContentPage(); var result = page.DisplayAlert("Warning", "Camera is not available", "OK"); return; } else { try { var resultfile = await picker.TakePhoto(null); #if __ANDROID__ showDrawingView(pld); #else showDrawingView(pld); #endif } catch (Exception ex) { } } }
async void showDrawingView(PhotoListData pld) { /*var pv = new DrawingPhotoView(); pv.PhotoList = pld; await Navigation.PushAsync(pv); pld = pv.PhotoList;*/ }
async private Task doPhotoAction(PhotoListData pld) { #if __ANDROID__ var action = await DisplayActionSheet("Select Source","Cancel",null,"Camera","Photo Library"); if (action == "Camera") { doCameraPhoto(pld); } else if (action == "Photo Library") { doPhotoLibrary(pld); } #else var action = await DisplayActionSheet("Select Source", "Cancel", null, "Camera", "Photo Library"); if (action == "Camera") { doCameraPhoto(pld); } else if (action == "Photo Library") { doPhotoLibrary(pld); } //doPhotoLibrary(pld); #endif }