【发布时间】:2015-07-16 23:56:45
【问题描述】:
您好,我希望我的应用在收到推送通知时导航到某个页面。我的代码如下:-
ParsePush.ToastNotificationReceived += OnPushNotification;
这是处理push的事件
private async void OnPushNotification(object sender, Windows.Networking.PushNotifications.PushNotificationReceivedEventArgs e)
{
var AdFrame = Window.Current.Content as Frame;
var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
if (localSettings.Values.ContainsKey("Suspended"))
{
String value = localSettings.Values["Suspended"].ToString();
if (value != null)
{
if (value == "false")
{
AdFrame.Navigate(typeof(Ad));
}
}
}
}
我在var AdFrame = Window.Current.Content as Frame; 收到空引用错误
我已在 App.xaml.cs 中添加了此代码。我只想从当前页面导航到广告页面,无论页面可能处于活动状态。我对 windows 很陌生,任何帮助将不胜感激。
【问题讨论】:
标签: c# windows-phone-8.1