I have a few pages that I'd like to call like functions. As in, I'd like to show the page modally, then do something with a result.
Because awaiting PushModalAsync doesn't actually block until popped, i'm using messagecenter to subscript for the result. It seems kinda clunky. Is there a more elegant way to do this?
// what I think I have to do: async Task TakePicture() { MessagingCenter.Subscribe<CameraPageViewModel, ImageSource>(this, "CameraImage", async (sender, imageSource) => { ImageSource = imageSource; }); await ViewModelNavigation.PushModalAsync(new CameraPageViewModel()); // This returns right away } // what I wish I could do: async Task TakePicture() { var cameraPage = new CameraPageViewModel(); await ViewModelNavigation.PushModalAsync(cameraPage); // In my imagination, this blocks until Popped ImageSource = cameraPage.Image; }