コード例 #1
0
        private void OnAcceptButtonClick(object sender, RoutedEventArgs args)
        {
            UserSettings settings = new UserSettings();
            settings.AcceptedEula = true;
            settings.Save();

            Visibility = Visibility.Collapsed;
        }
コード例 #2
0
        public void checkPushNotificationsUserPermissions()
        {
            //The app must ask the user for explicit permission to receive toast notifications.
            UserSettings settings = new UserSettings();
            if (!settings.AskedPermissionForToastPushNotifications)
            {
                StringTable _localizedStrings = App.Current.Resources["StringTable"] as StringTable;
                MessageBoxResult result = MessageBox.Show(_localizedStrings.Prompts.AllowToastPushNotification, _localizedStrings.ControlsText.PushNotifications, MessageBoxButton.OKCancel);
                if (MessageBoxResult.OK == result)
                {
                    settings.EnableToastPushNotifications = true;
                }
                else
                {
                    settings.EnableToastPushNotifications = false;
                }
                settings.AskedPermissionForToastPushNotifications = true;
                settings.Save();

                if (settings.EnableToastPushNotifications == true)
                {
                    Double fontSize = (Double) Application.Current.Resources["ControlFontSize"];
                    var messagePrompt = new MessagePrompt
                    {
                        Title = _localizedStrings.ControlsText.PushNotifications,
                        Body = new TextBlock { Text = _localizedStrings.Prompts.PinToStartPushNotification, FontSize= fontSize, TextWrapping = TextWrapping.Wrap },
                        IsCancelVisible = false
                    };
                    messagePrompt.Show();
                }
            }
        }