We're a little confused as to how to mix Xamarin.Forms
page functions like DisplayAlert
and the OnBackButtonPressed
override since one is async and the other is not.
We tried this, but the DisplayAlert
doesn't appear since there is no await
in front of it, but if we add it, it doesn't compile because the overridden event expects the return parameter to be bool
, not Task<bool>
.
protected override bool OnBackButtonPressed (){
if (this.Detail.GetType().ToString() == "Klaim.HomePage") {
Task<bool> action = DisplayAlert ("Quitter?", "Voulez-vous quitter l'application?", "Oui", "Non");
if (action.Result)
DisplayAlert("debugvalue", "TRUE", "ok");
} else {
ViewModel.NavigateTo (new HomePage(new HomeViewModel()));
}
}