Rg.Plugins.Popup过时弹窗导航方法的替代方案咨询
官方已将PopupNavigation的静态PushAsync和PopAsync方法标记为过时,需通过PopupNavigation.Instance获取IPopupNavigation实例来调用对应方法,具体替换如下:
1. PushAsync 方法替换
原过时代码:
PopupNavigation.PushAsync(new myPopupPage());
新写法(需添加await关键字保证异步操作正常执行):
await PopupNavigation.Instance.PushAsync(new myPopupPage());
2. PopAsync 方法替换
原过时代码:
await PopupNavigation.PopAsync(true);
新写法:
await PopupNavigation.Instance.PopAsync(true);
注意:如果调用代码所在方法未标记
async,需先为方法添加async修饰符,避免同步阻塞引发异常。
内容的提问来源于stack exchange,提问作者Costas
相关产品推荐
相关产品推荐

