/// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            service = new PushApplicationService("E90DF-D15E4", "", new List <string>(), "");

            service.Subscribe();

            service.NotificationService.Tags.OnError += (sender, args) =>
            {
                MessageDialog dialog = new MessageDialog("Error while sending the tags: \n" + args.Result);
                dialog.ShowAsync();
            };
            service.NotificationService.Tags.OnSendingComplete += (sender, args) =>
            {
                MessageDialog dialog = new MessageDialog("Tag has been sent!");
                dialog.ShowAsync();
                DisplaySkippedTags(args.Result);
            };

            service.NotificationService.OnPushTokenUpdated += (sender, args) =>
            {
                tbPushToken.Text = args.Result.ToString();
            };

            service.NotificationService.OnPushAccepted += (sender, args) =>
            {
                ContentGet(service.NotificationService.LastPushContent);
            };
            if (service.NotificationService.PushToken != null)
            {
                tbPushToken.Text = service.NotificationService.PushToken;
            }
            ResetMyMainTile();
        }
Example #2
0
        private void Subscribe_Tapped(object sender_, TappedRoutedEventArgs e)
        {
            try
            {
                if (Host.Text.EndsWith("/"))
                {
                    PushSDK.Constants.setHost(Host.Text);
                }
                else
                {
                    PushSDK.Constants.setHost(Host.Text + "/");
                }
                string _PWId = PWID.Text;
                service = new PushApplicationService(_PWId, "", new List <string>(), "");
                service.Subscribe();

                service.NotificationService.Tags.OnError += (sender, args) =>
                {
                    MessageDialog dialog = new MessageDialog("Error while sending the tags: \n" + args.Result);
                    dialog.ShowAsync();
                };
                service.NotificationService.Tags.OnSendingComplete += (sender, args) =>
                {
                    MessageDialog dialog = new MessageDialog("Tag has been sent!");
                    dialog.ShowAsync();
                    DisplaySkippedTags(args.Result);
                };

                service.NotificationService.OnPushTokenUpdated += (sender, args) =>
                {
                    tbPushToken.Text = args.Result.ToString();
                };

                service.NotificationService.OnPushAccepted += (sender, args) =>
                {
                    ContentGet(service.NotificationService.LastPushContent);
                };
                if (service.NotificationService.PushToken != null)
                {
                    tbPushToken.Text = service.NotificationService.PushToken;
                }

                SubButton.IsEnabled   = false;
                UnSubButton.IsEnabled = true;
            }
            catch (Exception ex)
            {
                MessageDialog dialog = new MessageDialog("Host does not exist: \n" + ex.Message);
                dialog.ShowAsync();
            }
        }