1 回答

TA貢獻1840條經驗 獲得超5個贊
首先,為什么要使用如此復雜的語法而不是利用異步等待?
public async void EndAppointement()
{
try
{
await App.ArdaBusinessLogic.AppointmentEnd(_appointment);
_appointmentDetailPage.IsDirty = true;
await App.MasterNavigationPage.Navigation.PopModalAsync();
}
catch (Exception exception)
{
await App.MasterNavigationPage.Navigation.PopModalAsync();
await App.ShowErrorPageAsync(exception);
}
}
二、看XF源碼:
protected override async Task<Page> OnPopModal(bool animated)
{
Page modal = ModalStack[ModalStack.Count - 1];
if (_owner.OnModalPopping(modal))
{
_owner.OnPopCanceled();
return null;
}
Page result = await base.OnPopModal(animated);
result.Parent = null;
_owner.OnModalPopped(result);
return result;
}
您的模態堆棧似乎混亂了:這意味著您正在嘗試彈出不在堆棧上的頁面。您確定您處于模態頁面嗎?也許使用PopAsync而不是PopModalAsync.
- 1 回答
- 0 關注
- 98 瀏覽
添加回答
舉報