如何从Android活动导航到Xamarin表单内容页面?
我正在开发一个使用在线支付的应用程序。我在浏览器中使用:如何从Android活动导航到Xamarin表单内容页面?,xamarin,xamarin.forms,content-pages,Xamarin,Xamarin.forms,Content Pages,我正在开发一个使用在线支付的应用程序。我在浏览器中使用:Device.OpenUri(Uri)打开支付链接。用户完成订单付款后,会使用自定义URL方案重定向到Android活动: [Activity(Label = "Urlentryclass", ScreenOrientation = ScreenOrientation.Portrait, Icon = "@drawable/icon", MainLauncher = false, ConfigurationChanges =
Device.OpenUri(Uri)打开支付链接代码>。用户完成订单付款后,会使用自定义URL方案重定向到Android活动:
[Activity(Label = "Urlentryclass", ScreenOrientation = ScreenOrientation.Portrait, Icon = "@drawable/icon",
MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[IntentFilter(new[] {Android.Content.Intent.ActionView},
DataScheme = "test",
Categories = new[] {Android.Content.Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable})]
public class Urlentryclass : FormsAppCompatActivity
...
如何从此活动导航到特定表单内容页?
我尝试使用以下代码示例打开某个页面(通过使用事件处理程序完成)
后跟this.finish()代码>
但是,显示的视图是在浏览器显示之前打开的最后一个视图。
似乎Navigation.PushAsync
不会影响正在显示的视图。我尝试了PopAsync
,PopToRootAsync
,但似乎没有任何效果
对于那些对事件处理程序感兴趣的人,这里是:
public static class PaymentNavigationHelper
{
public delegate void PaymentExecutedHandler(string sisowStatus, string orderStatus);
public static event PaymentExecutedHandler OnPaymentExecuted;
public static void PaymentExecuted(string sisowStatus, string orderStatus)
{
OnPaymentExecuted?.Invoke(sisowStatus, orderStatus);
}
}
我在开始付款的内容页上订阅活动:
PaymentNavigationHelper.OnPaymentExecuted += (sisowStatus, modelStatus) =>
{
Navigation.PushAsync(new NavigationMenu(sisowStatus, modelStatus)).ConfigureAwait(false);
};
在处理支付url的活动中,使用了以下代码:
PaymentNavigationHelper.PaymentExecuted(status, test.Model.FirstOrDefault().Status);
非常感谢您的建议。以下链接回答了问题:
以下链接回答的问题:
PaymentNavigationHelper.PaymentExecuted(status, test.Model.FirstOrDefault().Status);