Example #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter is TrapNotification)
            {
                trapNotification = (TrapNotification)e.Parameter;

                imgOtherUserProfile.ImageSource = new BitmapImage(new Uri(trapNotification.OtherUserImg));

                if (trapNotification.IsOwner)
                {
                    string msg = "You caught {0} and won {1} points!";

                    msg = string.Format(msg, trapNotification.OtherUserName, trapNotification.Points);

                    lblNotificationMsg.Text = msg;
                }
                else
                {
                    string msg = "You were caught by {0}!";

                    msg = string.Format(msg, trapNotification.OtherUserName);

                    lblNotificationMsg.Text = msg;
                }
            }
        }
Example #2
0
        private async void OnPushNotification(PushNotificationChannel sender, PushNotificationReceivedEventArgs e)
        {
            switch (e.NotificationType)
            {
            case PushNotificationType.Raw:

                TrapNotification trapNotification = JsonConvert.DeserializeObject <TrapNotification>(e.RawNotification.Content);

                if (trapNotification.ShowNotification)
                {
                    await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                                () =>
                    {
                        AppShell.Current.AppFrame.Navigate(typeof(NotificationPage), trapNotification);
                    });
                }

                break;
            }

            e.Cancel = true;
        }