A static class that enables the app to control the Settings page. The app can add or remove commands, receive a notification when the user opens the pane, or open the page programmatically.
PlatformVersion supported AndroidAndroid 4.4 and later iOSiOS 9.0 and later tvOStvOS 9.0 and later Windows UWPWindows 10 Windows StoreWindows 8.1 or later Windows Phone StoreWindows Phone 8.1 or later Windows Phone SilverlightWindows Phone 8.0 or later
Esempio n. 1
0
        /// <summary>
        /// Gets a <see cref="SettingsPane"/> object that is associated with the current app.
        /// </summary>
        /// <returns></returns>
        public static SettingsPane GetForCurrentView()
        {
            if (instance == null)
            {
#if WINDOWS_UWP
                hasSettingsPane = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.UI.ApplicationSettings.ApplicationsSettingsContract", 1);
#endif
                instance = new SettingsPane();
            }

            return instance;
        }
Esempio n. 2
0
        void AboutPage_Loaded(object sender, RoutedEventArgs e)
        {
            AppIcon.Source   = new BitmapImage(InTheHand.ApplicationModel.Package.Current.Logo);
            AppNameText.Text = InTheHand.ApplicationModel.Package.Current.DisplayName;
            Version.Text     = "Version " + InTheHand.ApplicationModel.Package.Current.Id.Version.ToString();
            if (SettingsPane.GetForCurrentView().showPublisher)
            {
                AuthorText.Text = string.Format("By {0}", InTheHand.ApplicationModel.Package.Current.PublisherDisplayName);
            }
            else
            {
                AuthorText.Visibility = Visibility.Collapsed;
            }

            Description.Text = InTheHand.ApplicationModel.Package.Current.Description;
        }
Esempio n. 3
0
        void PermissionsPage_Loaded(object sender, RoutedEventArgs e)
        {
            this.AppNameHeader.Text     = InTheHand.ApplicationModel.Package.Current.DisplayName.ToUpper();
            this.PermissionsHeader.Text = InTheHand.UI.ApplicationSettings.Resources.Resources.Permissions.ToLower();

            this.ProductName.Text = InTheHand.ApplicationModel.Package.Current.DisplayName;

            if (SettingsPane.GetForCurrentView().showPublisher)
            {
                this.AuthorName.Text = string.Format(InTheHand.UI.ApplicationSettings.Resources.Resources.ByAuthor, InTheHand.ApplicationModel.Package.Current.PublisherDisplayName);
            }
            else
            {
                this.AuthorName.Visibility = System.Windows.Visibility.Collapsed;
            }

            this.Version.Text = string.Format(InTheHand.UI.ApplicationSettings.Resources.Resources.Version, InTheHand.ApplicationModel.Package.Current.Id.Version.ToString());
            this.PermissionsSubHeading.Text   = InTheHand.UI.ApplicationSettings.Resources.Resources.PermissionsSubHeading;
            this.NotificationToggle.IsChecked = UserPermission.Instance.AllowToastNotifications;

            foreach (InTheHand.ApplicationModel.Capability cap in Enum.GetValues(typeof(InTheHand.ApplicationModel.Capability)))
            {
                if (InTheHand.ApplicationModel.Package.Current.Capabilities.HasFlag(cap))
                {
                    if (cap == Capability.PushNotification)
                    {
                        // show required toast notification toggle
                        NotificationSubHeading.Text       = InTheHand.UI.ApplicationSettings.Resources.Resources.Notifications;
                        NotificationSubHeading.Visibility = System.Windows.Visibility.Visible;
                        NotificationToggle.Header         = InTheHand.UI.ApplicationSettings.Resources.Resources.ToastNotifications;
                        NotificationToggle.Visibility     = System.Windows.Visibility.Visible;
                        NotificationToggle.Checked       += NotificationToggle_Checked;
                        NotificationToggle.Unchecked     += NotificationToggle_Unchecked;
                    }
                    else
                    {
                        System.Reflection.PropertyInfo pi = typeof(InTheHand.UI.ApplicationSettings.Resources.Resources).GetProperty("Capability" + cap.ToString(), System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
                        if (pi != null)
                        {
                            CapabilitiesList.Items.Add(pi.GetValue(null).ToString());
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        void PermissionsPage_Loaded(object sender, RoutedEventArgs e)
        {
            ResourceLoader res = ResourceLoader.GetForCurrentView("InTheHand.UI.ApplicationSettings/Resources");

            this.AppNameText.Text = InTheHand.ApplicationModel.Package.Current.DisplayName;

            if (SettingsPane.GetForCurrentView().showPublisher)
            {
                this.AuthorName.Text = string.Format(res.GetString("ByAuthor"), InTheHand.ApplicationModel.Package.Current.PublisherDisplayName);
            }
            else
            {
                this.AuthorName.Visibility = Visibility.Collapsed;
            }

            PackageVersion ver = Windows.ApplicationModel.Package.Current.Id.Version;

            this.Version.Text = string.Format(res.GetString("Version"), ver.Major, ver.Minor, ver.Build, ver.Revision);
            //this.PermissionsSubHeading.Text = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView().GetString("PermissionsSubHeading");
            // show required toast notification toggle
            //NotificationSubHeading.Text = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView().GetString("Notifications");
            //NotificationButton.Header = "Allow toast notifications";// InTheHand.UI.ApplicationSettings.Resources.Resources.ToastNotifications;

            if (InTheHand.ApplicationModel.Package.Current.Capabilities.HasFlag(InTheHand.ApplicationModel.Capability.PushNotification))
            {
                NotificationPanel.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }

            foreach (InTheHand.ApplicationModel.Capability cap in Enum.GetValues(typeof(InTheHand.ApplicationModel.Capability)))
            {
                if (InTheHand.ApplicationModel.Package.Current.Capabilities.HasFlag(cap))
                {
                    string s = res.GetString("Capability" + cap.ToString());
                    if (!string.IsNullOrEmpty(s))
                    {
                        CapabilitiesList.Items.Add(s);
                    }
                    else
                    {
                        CapabilitiesList.Items.Add(cap.ToString());
                    }
                }
            }
        }