private async void BuddyPushSetup()
        {
            Microsoft.Phone.Notification.HttpNotificationChannel channel;
            channel = Microsoft.Phone.Notification.HttpNotificationChannel.Find(App.PushChannelName);
            if (channel == null)
            {
                channel = new Microsoft.Phone.Notification.HttpNotificationChannel(App.PushChannelName);
                channel.Open();
            }
            channel.ChannelUriUpdated += (object sender, NotificationChannelUriEventArgs args) =>
            {
                PlatformAccess.Current.SetPushToken(channel.ChannelUri.AbsoluteUri);
            };
            channel.ErrorOccurred += (object sender, NotificationChannelErrorEventArgs args) =>
            {
                MessageBox.Show(args.Message);
            };
            if (!channel.IsShellTileBound)
            {
                channel.BindToShellTile();
            }
            if (!channel.IsShellToastBound)
            {
                channel.BindToShellToast();
            }

            channel.ShellToastNotificationReceived += (object sender, NotificationEventArgs args) => {
                string message = null;
                if (args.Collection.TryGetValue("wp:Text1", out message))
                {
                    Dispatcher.BeginInvoke(() => MessageBox.Show(message.ToString()));
                }
            };
        }
        private void BuddyPushSetup()
        {
            Microsoft.Phone.Notification.HttpNotificationChannel channel;
            channel = Microsoft.Phone.Notification.HttpNotificationChannel.Find(App.PushChannelName);
            if (channel == null)
            {
                channel = new Microsoft.Phone.Notification.HttpNotificationChannel(App.PushChannelName);
            }
            if (channel.ChannelUri != null)
            {
                Buddy.Instance.SetPushToken(channel.ChannelUri.AbsoluteUri);
            }
            channel.ChannelUriUpdated += (object sender, NotificationChannelUriEventArgs args) =>
            {
                Buddy.Instance.SetPushToken(channel.ChannelUri.AbsoluteUri);
            };
            channel.ErrorOccurred += (object sender, NotificationChannelErrorEventArgs args) =>
            {
                MessageBox.Show(args.Message);
            };
            if (!channel.IsShellTileBound)
            {
                channel.BindToShellTile();
            }
            if (!channel.IsShellToastBound)
            {
                channel.BindToShellToast();
            }
            channel.Open();



            channel.ShellToastNotificationReceived += (object sender, NotificationEventArgs args) =>
            {
                string message = null;
                if (args.Collection.TryGetValue("wp:Text1", out message))
                {
                    MessageBox.Show(String.Format(message));
                }
            };
        }
Example #3
0
        private void BuddyPushSetup()
        {
            Microsoft.Phone.Notification.HttpNotificationChannel channel;
            channel = Microsoft.Phone.Notification.HttpNotificationChannel.Find(App.PushChannelName);
            if (channel == null)
            {
                channel = new Microsoft.Phone.Notification.HttpNotificationChannel(App.PushChannelName);
            }
            if (channel.ChannelUri != null)
            {
                Buddy.Instance.SetPushToken(channel.ChannelUri.AbsoluteUri);
            }
            channel.ChannelUriUpdated += (object sender, NotificationChannelUriEventArgs args) =>
            {
                Buddy.Instance.SetPushToken(channel.ChannelUri.AbsoluteUri);
            };
            channel.ErrorOccurred += (object sender, NotificationChannelErrorEventArgs args) =>
            {
                MessageBox.Show(args.Message);
            };
            if (!channel.IsShellTileBound)
            {
                channel.BindToShellTile();
            }
            if (!channel.IsShellToastBound)
            {
                channel.BindToShellToast();
            }
            channel.Open();



            channel.ShellToastNotificationReceived += (object sender, NotificationEventArgs args) =>
            {
                string message = null;
                if (args.Collection.TryGetValue("wp:Text1", out message))
                {
                    MessageBox.Show(String.Format(message));
                }
            };
        }