以下是 WP8 推送通知的代码。
HttpNotificationChannel pushChannel = new HttpNotificationChannel(channelName);
// Register for all the events before attempting to open the channel.
pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
// Register for this notification only if you need to receive the notifications while your application is running.
pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived);
pushChannel.Open();
// Bind this new channel for toast events.
pushChannel.BindToShellToast();
pushChannel.BindToShellTile();
正如您在上面的代码中看到的,我将 pushChannel 绑定到shellToast 以及 shellTile。我想知道它是否有效?因为我在 msdn 上没有关于此的任何文档。如果可能并且服务器发送任何通知,它会正确显示吗? 请就此提出宝贵意见。