Exemple #1
0
        private void ShowPrivacyPolicy(IUICommand command)
        {
            var flyout = new SettingsFlyout();

            flyout.Title = "Privacy Policy";
            flyout.Show();
        }
Exemple #2
0
        // TODO: Implement own settings views (UserControl based on SettingsFlyout)

        private void ShowHelp(IUICommand command)
        {
            var flyout = new SettingsFlyout();

            flyout.Title = "Help";
            flyout.Show();
        }
Exemple #3
0
        private void SetCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            SettingsCommand cmd = new SettingsCommand(
                "sample",
                "Feedback",
                (x) =>
            {
                // create a new instance of the flyout
                SettingsFlyout settings = new SettingsFlyout();
                settings.Title          = "Provide Feedback";
                BitmapImage bitmap      = new BitmapImage(new Uri("ms-appx:///Assets/SmallLogo.png"));
                settings.IconSource     = bitmap;

                // set the content for the flyout
                var settingsContent           = new FeedbackContent();
                settingsContent.FeedbackSent += (s, e) =>
                {
                    settings.Hide();
                };

                settings.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch;
                settings.Content = settingsContent;

                // open it
                settings.Show();
            });

            args.Request.ApplicationCommands.Add(cmd);
        }
        void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            //Add an About command
            var about = new SettingsCommand("about", "About", (handler) =>
            {
                var settings              = new SettingsFlyout();
                settings.Content          = new AboutUserControl();
                settings.HeaderBackground = new SolidColorBrush(_background);
                settings.Title            = "About";
                settings.Show();
            });

            args.Request.ApplicationCommands.Add(about);

            var preferences = new SettingsCommand("preferences", "Preferences", (handler) =>
            {
                var settings              = new SettingsFlyout();
                settings.Content          = new PreferencesUserControl();
                settings.HeaderBackground = new SolidColorBrush(_background);
                settings.Title            = "Preferences";
                settings.Show();
            });

            args.Request.ApplicationCommands.Add(preferences);
        }
        public void Setup()
        {
            SettingsPane settingsPane = SettingsPane.GetForCurrentView();

            settingsPane.CommandsRequested += (s, e) =>
            {
                SettingsCommand settingsCommand = new SettingsCommand(
                    "CONTRIBUTION_ID",
                    "Contribution",
                    command =>
                {
                    var flyout   = new SettingsFlyout();
                    flyout.Title = "About";

                    flyout.Content = new TextBlock()
                    {
                        Text = "Application uses http://fixer.io/ API for getting the data published by European Central Bank. "
                               + "Thanks to the Fixer API, the application is able to read valid data.",
                        TextAlignment = Windows.UI.Xaml.TextAlignment.Left,
                        TextWrapping  = Windows.UI.Xaml.TextWrapping.Wrap,
                        FontSize      = 14
                    };

                    flyout.HeaderBackground = new SolidColorBrush(Colors.Purple);
                    flyout.HeaderForeground = new SolidColorBrush(Colors.BlanchedAlmond);
                    flyout.Background       = new SolidColorBrush(Colors.Black);
                    flyout.Foreground       = new SolidColorBrush(Colors.White);

                    flyout.Show();
                }
                    );

                e.Request.ApplicationCommands.Add(settingsCommand);
            };
        }
Exemple #6
0
        public void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            // Add an About command
            var about = new SettingsCommand("about", loader.GetString("About"), (handler) =>
            {
                var settings = new SettingsFlyout();

                settings.Content = new AboutUserControl();
                settings.Title   = loader.GetString("About");
                settings.Show();
            });

            args.Request.ApplicationCommands.Add(about);

            // Add a Preferences command
            var preferences = new SettingsCommand("preferences", loader.GetString("Preferences"), (handler) =>
            {
                var settings     = new SettingsFlyout();
                settings.Content = new PreferencesUserControl();
                settings.Title   = loader.GetString("Preferences");
                settings.Show();
            });

            args.Request.ApplicationCommands.Add(preferences);
        }
Exemple #7
0
        private void SetCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            SettingsCommand cmd = new SettingsCommand(
                 "sample",
                 "Feedback",
                 (x) =>
                 {
                     // create a new instance of the flyout
                     SettingsFlyout settings = new SettingsFlyout();
                     settings.Title = "Provide Feedback";
                     BitmapImage bitmap = new BitmapImage(new Uri("ms-appx:///Assets/SmallLogo.png"));
                     settings.IconSource = bitmap;

                     // set the content for the flyout
                     var settingsContent = new FeedbackContent();
                     settingsContent.FeedbackSent += (s, e) =>
                     {
                         settings.Hide();
                     };

                     settings.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch;
                     settings.Content = settingsContent;

                     // open it
                     settings.Show();
                 });

            args.Request.ApplicationCommands.Add(cmd);
        }
        public static void Initialise()
        {
            SettingsPane settingsPane = SettingsPane.GetForCurrentView();

            settingsPane.CommandsRequested += (s, e) =>
            {
                var settingsCommand = new SettingsCommand(
                    "SETTINGS_ID",
                    "Settings", command =>
                {
                    var view = new SettingsView();

                    var flyout = new SettingsFlyout
                    {
                        Title   = "Settings",
                        Content = view
                    };

                    ((SettingsViewModel)(view.DataContext)).Init();

                    flyout.Show();
                }
                    );
                e.Request.ApplicationCommands.Add(settingsCommand);
            };
        }
Exemple #9
0
        /// <summary>
        /// Occurs when the user opens the settings pane.
        /// Listening for this event lets the app initialize the setting commands and pause its UI until the user closes the pane.
        /// </summary>
        /// <param name="settingsPane">The event source.</param>
        /// <param name="eventArgs">The event data. If there is no event data, this parameter will be null.</param>
        private static void SettingsCommandsRequestedEventHandler(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs)
        {
            if (settingsPane == null)
            {
                throw new ArgumentNullException("settingsPane");
            }
            if (eventArgs == null)
            {
                throw new ArgumentNullException("eventArgs");
            }
            var configurationCommand = new SettingsCommand("configuration", Resource.GetText(Text.Configuration), eventHandler =>
            {
                var settingsFlyout = new SettingsFlyout
                {
                    Title            = Resource.GetText(Text.Configuration),
                    HeaderBackground = new SolidColorBrush(Colors.DarkBlue),
                    Content          = new ConfigurationUserControl()
                };
                settingsFlyout.Show();
            });
            var privacyPolicyCommand = new SettingsCommand("privacyPolicy", Resource.GetText(Text.PrivacyPolicyHeader), eventHandler =>
            {
                var settingsFlyout = new SettingsFlyout
                {
                    Title            = Resource.GetText(Text.PrivacyPolicyHeader),
                    HeaderBackground = new SolidColorBrush(Colors.DarkBlue),
                    Content          = new PrivacyPolicyUserControl()
                };
                settingsFlyout.Show();
            });

            eventArgs.Request.ApplicationCommands.Add(configurationCommand);
            eventArgs.Request.ApplicationCommands.Add(privacyPolicyCommand);
        }
        /// <summary>
        /// Shows a settings flyout panel for the specified model.
        /// </summary>
        /// <param name="viewModel">The settings view model.</param>
        /// <param name="commandLabel">The settings command label.</param>
        /// <param name="viewSettings">The optional dialog settings.</param>
        /// <param name="independent">Show settings independent from <seealso cref="Windows.UI.ApplicationSettings.SettingsPane"/>.</param>
        public async void ShowSettingsFlyout(object viewModel, string commandLabel,
            IDictionary<string, object> viewSettings = null, bool independent = false) {
            var view = ViewLocator.LocateForModel(viewModel, null, null);
            ViewModelBinder.Bind(viewModel, view, null);

            viewSettings = viewSettings ?? new Dictionary<string, object>();

            var settingsFlyout = new SettingsFlyout
            {
                Title = commandLabel,
                Content = view,
                HorizontalContentAlignment = HorizontalAlignment.Stretch
            };

            // extract the header color/logo from the appmanifest.xml
            var visualElements = await AppManifestHelper.GetManifestVisualElementsAsync();

            // enable the overriding of these, but default to manifest
            var headerBackground = viewSettings.ContainsKey("headerbackground")
                ? (SolidColorBrush) viewSettings["headerbackground"]
                : new SolidColorBrush(visualElements.BackgroundColor);

            var smallLogoUri = viewSettings.ContainsKey("smalllogouri")
                ? (Uri) viewSettings["smalllogouri"]
                : visualElements.SmallLogoUri;

            var smallLogo = new BitmapImage(smallLogoUri);

            // use real property names for ApplySettings
            if (!viewSettings.ContainsKey("HeaderBackground"))
                viewSettings["HeaderBackground"] = headerBackground;

            if (!viewSettings.ContainsKey("IconSource"))
                viewSettings["IconSource"] = smallLogo;

            ApplySettings(settingsFlyout, viewSettings);

            var deactivator = viewModel as IDeactivate;
            if (deactivator != null) {
                RoutedEventHandler closed = null;
                closed = (s, e) => {
                    settingsFlyout.Unloaded -= closed;
                    deactivator.Deactivate(true);
                };

                settingsFlyout.Unloaded += closed;
            }

            var activator = viewModel as IActivate;
            if (activator != null) {
                activator.Activate();
            }

            if (independent)
                settingsFlyout.ShowIndependent();
            else
                settingsFlyout.Show();
        }
Exemple #11
0
        private void btnInfo_Click(object sender, RoutedEventArgs e)
        {
            SettingsFlyout settings = new SettingsFlyout();

            settings.Content    = new About();
            settings.Background = new SolidColorBrush(Colors.White);
            settings.Title      = "Support";
            settings.Show();
        }
 public void Show(SettingsFlyout flyout, object parameter = null)
 {
     if (flyout == null)
         throw new ArgumentNullException("flyout");
     var viewmodel = flyout.DataContext as Common.ViewModelBase;
     if (viewmodel != null)
         viewmodel.OnNavigatedTo(parameter, NavigationMode.New, null);
     flyout.Show();
 }
Exemple #13
0
        private static void ShowSettings()
        {
            SettingsFlyout settings = new SettingsFlyout();

            settings.Content    = new Settings();
            settings.Background = new SolidColorBrush(Colors.White);
            settings.Title      = "Options";
            settings.Show();
        }
Exemple #14
0
        public void Show(SettingsFlyout flyout, object parameter = null)
        {
            if (flyout == null)
            {
                throw new ArgumentNullException(nameof(flyout));
            }
            var dataContext = flyout.DataContext as INavigatable;

            dataContext?.OnNavigatedTo(parameter, NavigationMode.New, null);
            flyout.Show();
        }
Exemple #15
0
        /// <summary>
        /// Helper for dealing with SettingsFlyouts.
        /// </summary>
        /// <param name="flyout"></param>
        private void OpenFlyout(SettingsFlyout flyout)
        {
            // Default BackClick behavior brings up the legacy Settings Pane, which is undesirable.
            flyout.BackClick += (s, e) =>
            {
                flyout.Hide();
                e.Handled = true;
            };

            flyout.Show();
        }
Exemple #16
0
        /*void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
         * {
         *  args.Request.ApplicationCommands.Clear();
         *
         *  args.Request.ApplicationCommands.Add(new SettingsCommand("CloudConnection", "Cloud connection", (x) => ShowCloudSettings()));
         *  args.Request.ApplicationCommands.Add(new SettingsCommand("OpenSite", "DeviceHive.com", (x) =>
         *  {
         *      Windows.System.Launcher.LaunchUriAsync(new Uri("http://devicehive.com"));
         *  }));
         *  args.Request.ApplicationCommands.Add(new SettingsCommand("PrivacyPolicy", "Privacy Policy", (x) =>
         *  {
         *      Windows.System.Launcher.LaunchUriAsync(new Uri("http://apps.dataart.com/PrivacyPolicy.htm"));
         *  }));
         * }*/

        public static void ShowCloudSettings()
        {
            SettingsFlyout settings = new SettingsFlyout();

            settings.Title                      = "Cloud connection";
            settings.HeaderBackground           = new SolidColorBrush(Color.FromArgb(255, 26, 160, 255));
            settings.HorizontalContentAlignment = HorizontalAlignment.Stretch;

            settings.Content = new CloudConnectionSettings();
            settings.Show();
        }
Exemple #17
0
        private void OpenSettingView(string msg)
        {
            if (msg != "OpenSettingView")
            {
                return;
            }
            SettingsFlyout settings = new SettingsFlyout();

            settings.HeaderBackground = new SolidColorBrush(Colors.Orange);
            settings.Content          = new SettingControl();
            //显示设置面板
            settings.Show();
        }
Exemple #18
0
        public async void Show(SettingsFlyout flyout, string parameter = null)
        {
            if (flyout == null)
            {
                throw new ArgumentNullException(nameof(flyout));
            }
            var dataContext = flyout.DataContext as INavigatable;

            if (dataContext != null)
            {
                await dataContext.OnNavigatedToAsync(parameter, NavigationMode.New);
            }
            flyout.Show();
        }
Exemple #19
0
        private void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            var about = new SettingsCommand("about", "About", (handler) =>
            {
                SettingsFlyout settings = new SettingsFlyout();
                settings.Content        = new AboutUserControl();
                //settings.Background = new SolidColorBrush(_background);
                //settings.HeaderBackground = new SolidColorBrush(_background);
                //settings.Title = "About";
                settings.Show();
            });

            args.Request.ApplicationCommands.Add(about);
        }
        /// <summary>
        /// Define Settings Pages for the application once the OnCommandsRequested event is raised.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            Color _background = Color.FromArgb(255, 130, 45, 70);

            // Add an About command
            var about = new SettingsCommand("About", "About", (handler) =>
            {
                var settings              = new SettingsFlyout();
                settings.Content          = new AboutPage();
                settings.HeaderBackground = new SolidColorBrush(_background);
                settings.HeaderForeground = new SolidColorBrush(Colors.White);
                settings.Title            = "About";
                settings.Show();
            });

            args.Request.ApplicationCommands.Add(about);
        }
Exemple #21
0
        private void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            if (AppBase.Current.User == null)
            {
                var aboutsc = new SettingsCommand("LoginW", International.Translation.Login, x =>
                {
                    var settings = new SettingsFlyout
                    {
                        Width            = 500,
                        HeaderBackground = new SolidColorBrush(Color.FromArgb(255, 0, 113, 206)),
                        HeaderForeground = new SolidColorBrush(Colors.White),
                        Title            = International.Translation.Login,
                        Content          = new Views.UC.Login()
                    };
                    settings.Show();
                });

                args.Request.ApplicationCommands.Add(aboutsc);
            }
            else
            {
                var aboutsc = new SettingsCommand("ProfileFlyout", International.Translation.Profile, x =>
                {
                    var settings = new SettingsFlyout
                    {
                        Width            = 500,
                        HeaderBackground = new SolidColorBrush(Color.FromArgb(255, 0, 113, 206)),
                        HeaderForeground = new SolidColorBrush(Colors.White),
                        Title            = International.Translation.Profile,
                        Content          = new Views.UC.Profile()
                    };
                    settings.Show();
                });

                args.Request.ApplicationCommands.Add(aboutsc);


                var newsCommand = new SettingsCommand("logout", International.Translation.Logout
                                                      , uiCommand => { Logout(); });
                args.Request.ApplicationCommands.Add(newsCommand);
            }
            var privacyPolicyCommand = new SettingsCommand("privacyPolicy", "Privacy Policy", uiCommand => { LaunchPrivacyPolicyUrl("http://www.ifixit.com/Info/Privacy"); });

            args.Request.ApplicationCommands.Add(privacyPolicyCommand);
        }
        private void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            args.Request.ApplicationCommands.Clear();
            var settingsCmd = new SettingsCommand("Settings", "Settings", (x) =>
            {
                var settings                        = new SettingsFlyout();
                settings.Width                      = 345;
                settings.HeaderBackground           = Application.Current.Resources["AppAccentBrush"] as Brush;
                settings.HeaderForeground           = new SolidColorBrush(Colors.White);
                settings.Title                      = "Settings";
                settings.HorizontalContentAlignment = HorizontalAlignment.Stretch;
                settings.IconSource                 = new BitmapImage(new Uri("ms-appx:///Assets/SmallLogo.png"));
                settings.Content                    = new SettingsControl();
                settings.Show();
            });

            args.Request.ApplicationCommands.Add(settingsCmd);
        }
        public void Setup()
        {
            SettingsPane settingsPane = SettingsPane.GetForCurrentView();

            settingsPane.CommandsRequested += (s, e) =>
            {
                SettingsCommand settingsCommand = new SettingsCommand(
                    "ABOUT_ID",
                    "About",
                    command =>
                {
                    var flyout   = new SettingsFlyout();
                    flyout.Title = "About";

                    var version       = Package.Current.Id.Version;
                    var versionstring = string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);

                    flyout.Content = new TextBlock()
                    {
                        Text = "Developed by Zbigniew Marszolik\r\nVersion " + versionstring +
                               "\r\n\r\nThis is an Windows 8.1 application showing up-to-date currency exchange rates published by European Central Bank.",
                        TextAlignment = Windows.UI.Xaml.TextAlignment.Left,
                        TextWrapping  = Windows.UI.Xaml.TextWrapping.Wrap,
                        FontSize      = 14
                    };

                    flyout.HeaderBackground = new SolidColorBrush(Colors.Purple);
                    flyout.HeaderForeground = new SolidColorBrush(Colors.BlanchedAlmond);
                    flyout.Background       = new SolidColorBrush(Colors.Black);
                    flyout.Foreground       = new SolidColorBrush(Colors.White);

                    flyout.Show();
                }
                    );

                e.Request.ApplicationCommands.Add(settingsCommand);
            };
        }
 public void Show(SettingsFlyout flyout, string parameter = null)
 {
     if (flyout == null)
         throw new ArgumentNullException(nameof(flyout));
     var dataContext = flyout.DataContext;
     if (dataContext != null)
     {
         // navigationService will not depend on Mvvm namespace
         var method = dataContext.GetType()
             .GetRuntimeMethod(OnNavigatedTo, new[] {
                 typeof(string),
                 typeof(NavigationMode),
                 typeof(Dictionary<string, object>)
             });
         if (method != null)
         {
             // TODO: get existing state
             method.Invoke(dataContext, new object[] { parameter, NavigationMode.New, null });
         }
     }
     flyout.Show();
 }
 public async void Show(SettingsFlyout flyout, string parameter = null)
 {
     if (flyout == null)
         throw new ArgumentNullException(nameof(flyout));
     var dataContext = flyout.DataContext as INavigatable;
     if (dataContext != null)
     {
         await dataContext.OnNavigatedToAsync(parameter, NavigationMode.New, null);
     }
     flyout.Show();
 }
        // TODO: Implement own settings views (UserControl based on SettingsFlyout) 

        private void ShowHelp(IUICommand command)
        {
            var flyout = new SettingsFlyout();
            flyout.Title = "Help";
            flyout.Show();
        }
        void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            SettingsCommand cmd =
                new SettingsCommand("queue-options", "Queue Options",
                (x) =>
                {
                    SettingsFlyout settings = new SettingsFlyout();
                    settings.HeaderBackground = new SolidColorBrush(Colors.Black);
                    settings.Background = new SolidColorBrush(Color.FromArgb(255, 102, 0, 0));
                    settings.Foreground = new SolidColorBrush(Colors.White);
                   /// settings.Width = SettingsFlyout.SettingsFlyoutWidth.Narrow;
                    settings.Width = 500;
                    settings.Title = "Settings";
                    settings.Content = new SettingsView();
                    settings.Show();
                    SIUC311.SettingsView.SetAutoSubmitSetting(SIUC311.SettingsView.GetAutoSubmitSetting());
                });

            args.Request.ApplicationCommands.Add(cmd);

            SettingsCommand privacyStatement = 
                new SettingsCommand("privacy", "Privacy Statement", 
                async (x) =>
                {
                    await Launcher.LaunchUriAsync(new Uri("http://policies.siu.edu/policies/webprivacy.html"));
                });

            args.Request.ApplicationCommands.Add(privacyStatement);
        }
 private void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
 {
     args.Request.ApplicationCommands.Clear();
     var settingsCmd = new SettingsCommand("Settings", "Settings", (x) =>
     {
         var settings = new SettingsFlyout(); 
         settings.Width = 345;
         settings.HeaderBackground = Application.Current.Resources["AppAccentBrush"] as Brush;
         settings.HeaderForeground = new SolidColorBrush(Colors.White);
         settings.Title = "Settings";
         settings.HorizontalContentAlignment = HorizontalAlignment.Stretch;
         settings.IconSource = new BitmapImage(new Uri("ms-appx:///Assets/SmallLogo.png"));
         settings.Content = new SettingsControl();
         settings.Show();
     });
     args.Request.ApplicationCommands.Add(settingsCmd);
 }
Exemple #29
0
        /// <summary>
        /// Shows a settings flyout panel for the specified model.
        /// </summary>
        /// <param name="viewModel">The settings view model.</param>
        /// <param name="commandLabel">The settings command label.</param>
        /// <param name="viewSettings">The optional dialog settings.</param>
        /// <param name="independent">Show settings independent from <seealso cref="Windows.UI.ApplicationSettings.SettingsPane"/>.</param>
        public async void ShowSettingsFlyout(object viewModel, string commandLabel,
                                             IDictionary <string, object> viewSettings = null, bool independent = false)
        {
            var view = ViewLocator.LocateForModel(viewModel, null, null);

            ViewModelBinder.Bind(viewModel, view, null);

            viewSettings = viewSettings ?? new Dictionary <string, object>();

            var settingsFlyout = new SettingsFlyout
            {
                Title   = commandLabel,
                Content = view,
                HorizontalContentAlignment = HorizontalAlignment.Stretch
            };

            // extract the header color/logo from the appmanifest.xml
            var visualElements = await AppManifestHelper.GetManifestVisualElementsAsync();

            // enable the overriding of these, but default to manifest
            var headerBackground = viewSettings.ContainsKey("headerbackground")
                ? (SolidColorBrush)viewSettings["headerbackground"]
                : new SolidColorBrush(visualElements.BackgroundColor);

            var smallLogoUri = viewSettings.ContainsKey("smalllogouri")
                ? (Uri)viewSettings["smalllogouri"]
                : visualElements.SmallLogoUri;

            var smallLogo = new BitmapImage(smallLogoUri);

            // use real property names for ApplySettings
            if (!viewSettings.ContainsKey("HeaderBackground"))
            {
                viewSettings["HeaderBackground"] = headerBackground;
            }

            if (!viewSettings.ContainsKey("IconSource"))
            {
                viewSettings["IconSource"] = smallLogo;
            }

            ApplySettings(settingsFlyout, viewSettings);

            var deactivator = viewModel as IDeactivate;

            if (deactivator != null)
            {
                RoutedEventHandler closed = null;
                closed = (s, e) => {
                    settingsFlyout.Unloaded -= closed;
                    deactivator.Deactivate(true);
                };

                settingsFlyout.Unloaded += closed;
            }

            var activator = viewModel as IActivate;

            if (activator != null)
            {
                activator.Activate();
            }

            if (independent)
            {
                settingsFlyout.ShowIndependent();
            }
            else
            {
                settingsFlyout.Show();
            }
        }
        public static void Initialise()
        {
            SettingsPane settingsPane = SettingsPane.GetForCurrentView();

            settingsPane.CommandsRequested += (s, e) =>
            {
                SettingsCommand settingsCommand = new SettingsCommand(
                  "ABOUT_ID",
                  "About",
                  command =>
                  {
                      var flyout = new SettingsFlyout();
                      flyout.Title = "About";

                      flyout.Content = new TextBlock()
                      {
                          Text = "Created by Vladyslav Koshyl\r\nVersion 0.0.0.1 \r\n\r\nThis app helps you to create #hashtags for your events",
                          TextAlignment = Windows.UI.Xaml.TextAlignment.Left,
                          TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap,
                          FontSize = 14
                      };

                      flyout.Show();
                  }
                );
                e.Request.ApplicationCommands.Add(settingsCommand);
            };
        }
 public void Show()
 {
     _flyout.Show();
 }
        public static void Initialise()
        {
            SettingsPane settingsPane = SettingsPane.GetForCurrentView();

            settingsPane.CommandsRequested += (s, e) =>
            {
                SettingsCommand settingsCommand = new SettingsCommand(
                  "SKINS_ID",
                  "Skins",
                  command =>
                  {
                      var flyout = new SettingsFlyout();
                      flyout.Title = "Select skin";

                      flyout.Content = new TextBlock()
                      {
                          Text = "Chose skin for your app",
                          TextAlignment = Windows.UI.Xaml.TextAlignment.Left,
                          TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap,
                          FontSize = 14
                      };

                      flyout.Show();
                  }
                );
                e.Request.ApplicationCommands.Add(settingsCommand);
            };
        }
 public void Show(SettingsFlyout flyout, string parameter = null)
 {
     if (flyout == null)
         throw new ArgumentNullException(nameof(flyout));
     var dataContext = flyout.DataContext as INavigationAware;
     if (dataContext != null)
     {
         dataContext.OnNavigated(this, new NavigationEventArgsEx());
     }
     flyout.Show();
 }
        private void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {



            if (AppBase.Current.User == null)
            {

                var aboutsc = new SettingsCommand("LoginW", International.Translation.Login, x =>
                {



                    var settings = new SettingsFlyout
                    {
                        Width = 500,
                        HeaderBackground = new SolidColorBrush(Color.FromArgb(255, 0, 113, 206)),
                        HeaderForeground = new SolidColorBrush(Colors.White),
                        Title = International.Translation.Login,
                        Content = new Views.UC.Login()
                    };
                    settings.Show();
                    

                });

                args.Request.ApplicationCommands.Add(aboutsc);
            }
            else
            {

                var aboutsc = new SettingsCommand("ProfileFlyout", International.Translation.Profile, x =>
                {

                    var settings = new SettingsFlyout
                    {
                        Width = 500,
                        HeaderBackground = new SolidColorBrush(Color.FromArgb(255, 0, 113, 206)),
                        HeaderForeground = new SolidColorBrush(Colors.White),
                        Title = International.Translation.Profile,
                        Content = new Views.UC.Profile()
                    };
                    settings.Show();





                });

                args.Request.ApplicationCommands.Add(aboutsc);


                var newsCommand = new SettingsCommand("logout", International.Translation.Logout
                    , uiCommand => { Logout(); });
                args.Request.ApplicationCommands.Add(newsCommand);



            }
            var privacyPolicyCommand = new SettingsCommand("privacyPolicy", "Privacy Policy", uiCommand => { LaunchPrivacyPolicyUrl("http://www.ifixit.com/Info/Privacy"); });
            args.Request.ApplicationCommands.Add(privacyPolicyCommand);
        }
 public void Show(SettingsFlyout flyout, object parameter = null)
 {
     if (flyout == null)
         throw new ArgumentNullException(nameof(flyout));
     var dataContext = flyout.DataContext as INavigatable;
     dataContext?.OnNavigatedTo(parameter, NavigationMode.New, null);
     flyout.Show();
 }
        /*void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            args.Request.ApplicationCommands.Clear();

            args.Request.ApplicationCommands.Add(new SettingsCommand("CloudConnection", "Cloud connection", (x) => ShowCloudSettings()));
            args.Request.ApplicationCommands.Add(new SettingsCommand("OpenSite", "DeviceHive.com", (x) =>
            {
                Windows.System.Launcher.LaunchUriAsync(new Uri("http://devicehive.com"));
            }));
            args.Request.ApplicationCommands.Add(new SettingsCommand("PrivacyPolicy", "Privacy Policy", (x) =>
            {
                Windows.System.Launcher.LaunchUriAsync(new Uri("http://apps.dataart.com/PrivacyPolicy.htm"));
            }));
        }*/

        public static void ShowCloudSettings()
        {
            SettingsFlyout settings = new SettingsFlyout();
            settings.Title = "Cloud connection";
            settings.HeaderBackground = new SolidColorBrush(Color.FromArgb(255, 26, 160, 255));
            settings.HorizontalContentAlignment = HorizontalAlignment.Stretch;
            
            settings.Content = new CloudConnectionSettings();
            settings.Show();
        }
Exemple #37
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active

            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                //Associate the frame with a SuspensionManager key
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        //Something went wrong restoring state.
                        //Assume there is no state and continue
                    }
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }
            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(SplitPage), e.Arguments);
            }


            var dataAccess = Platform.DataAccess as DataAccess;

            if (NetworkInterface.GetIsNetworkAvailable())
            {
                try
                {
                    var  localSettings = ApplicationData.Current.LocalSettings;
                    long?last          = localSettings.Values["lastUpdate"] as long?;
                    await(new OeventsLoader()).LoadEvents(last != null ? (long)last : 0);
                    localSettings.Values["lastUpdate"] = Helper.GetTimestamp(DateTime.Now);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }

            await App.RootViewModel.LoadItems();

            // Ensure the current window is active
            Window.Current.Activate();

            SettingsPane settingsPane = SettingsPane.GetForCurrentView();

            settingsPane.CommandsRequested += (s, settingsEvent) =>
            {
                SettingsCommand settingsCommand = new SettingsCommand(
                    "ABOUT_ID",
                    "Datenschutz",
                    command =>
                {
                    var flyout   = new SettingsFlyout();
                    flyout.Title = "Datenschutz";


                    flyout.Content = new TextBlock()
                    {
                        Text          = "MyOApp sammelt oder sendet keine persönlichen identifizierbaren Daten. Die Dienste welche MyOApp verwendet speichern oder verwenden keine persönlichen Informationen.",
                        TextAlignment = Windows.UI.Xaml.TextAlignment.Left,
                        TextWrapping  = Windows.UI.Xaml.TextWrapping.Wrap,
                        FontSize      = 14
                    };

                    flyout.Show();
                }
                    );
                settingsEvent.Request.ApplicationCommands.Add(settingsCommand);
            };
        }
 private void ShowPrivacyPolicy(IUICommand command)
 {
     var flyout = new SettingsFlyout();
     flyout.Title = "Privacy Policy";
     flyout.Show();
 }