GetForCurrentView() public static method

Gets a SettingsPane object that is associated with the current app.
public static GetForCurrentView ( ) : SettingsPane
return SettingsPane
Exemplo n.º 1
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;
        }
Exemplo n.º 2
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());
                        }
                    }
                }
            }
        }
Exemplo n.º 3
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());
                    }
                }
            }
        }