将Azure Notifications Hub添加到Xamarin Forms Webview移动Blazor绑定 其他信息如果需要

问题描述

背景和说明

我正在关注Microsoft的this tutorial,以将通知添加到我的移动应用中。我正在构建的应用只是Mobile Blazor绑定中的一个Webview。

MyApp / Main.razor:

<ContentView>
    <StackLayout>
        <BlazorWebView ContentRoot="WebUI/wwwroot" VerticalOptions="LayoutOptions.FillAndExpand">
            <MyApp.WebUI.App />
        </BlazorWebView>

    </StackLayout>
</ContentView>

在Firebase和Azure的通知中心中设置项目后,我正在实现Xamarin Forms功能,并且出现错误。

Here in this code snippet会覆盖onNewIntent:

protected override void OnNewIntent(Intent intent)
    {
        if (intent.Extras != null)
        {
            var message = intent.GetStringExtra("message");
            (App.Current.MainPage as MainPage)?.AddMessage(message);
        }

        base.OnNewIntent(intent);
    }

问题

MainPage中的

(App.Current.MainPage as MainPage)?.AddMessage(message);是示例Xamarin Forms Project中共享客户端项目中xaml文件的名称。但是在我的项目中,将MainPage更改为MyApp.Main后,出现此错误:

Cannot convert type 'Xamarin.Forms.Page' to 'MyApp.Main' via a reference conversion,boxing conversion,unboxing conversion,wrapping conversion,or null type conversion

我该如何解决?我的理解是,我应该指向我的主页,因此在单击通知后,我应该导航到我的主页。

我可以在WebView中使用通知吗?

其他信息(如果需要)

项目结构:

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)