/// <summary> /// Define Settings Pages for the application once the OnCommandsRequested event is raised. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { var travelerInfo = new SettingsCommand("TravelerInfo", ResourceHelper.ResourceLoader.GetString("TravelerInfo"), (handler) => { var settings = new SettingsFlyout(); settings.ShowFlyout(new TravelerInfoControl()); }); args.Request.ApplicationCommands.Add(travelerInfo); var about = new SettingsCommand("About", ResourceHelper.ResourceLoader.GetString("About"), (handler) => { var settings = new SettingsFlyout(); settings.ShowFlyout(new AboutControl()); }); args.Request.ApplicationCommands.Add(about); var options = new SettingsCommand("Options", ResourceHelper.ResourceLoader.GetString("Options"), (handler) => { var settings = new SettingsFlyout(); settings.ShowFlyout(new OptionsControl()); }); args.Request.ApplicationCommands.Add(options); }
void LatticePage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { SettingsCommand cmd = new SettingsCommand("Lattice", "Layout", (x) => { // create a new instance of the flyout SettingsFlyout settings = new SettingsFlyout(); // set the desired width. If you leave this out, you will get Narrow (346px) settings.FlyoutWidth = Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth.Narrow; // optionally change header and content background colors away from defaults (recommended) // if using Callisto's AppManifestHelper you can grab the element from some member var you held it in // settings.HeaderBrush = new SolidColorBrush(App.VisualElements.BackgroundColor); settings.HeaderBrush = new SolidColorBrush(Colors.Orange); settings.HeaderText = "Layout Values"; // string.Format("{0}", App.VisualElements.DisplayName); // provide some logo (preferrably the smallogo the app uses) BitmapImage bmp = new BitmapImage(App.VisualElements.SmallLogoUri); settings.SmallLogoImageSource = bmp; // set the content for the flyout LatticeRimLayoutSettingsContent c = new LatticeRimLayoutSettingsContent(); c.DataContext = viewModel.CurrentPathData; settings.Content = c; // open it settings.IsOpen = true; }); args.Request.ApplicationCommands.Add(cmd); }
private void BlankPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { SettingsCommand cmd = new SettingsCommand("sample", "Sample Custom Setting", (x) => { // create a new instance of the flyout SettingsFlyout settings = new SettingsFlyout(); // set the desired width. If you leave this out, you will get Narrow (346px) settings.FlyoutWidth = (Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth)Enum.Parse(typeof(Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth), settingswidth.SelectionBoxItem.ToString()); // optionally change header and content background colors away from defaults (recommended) // if using Callisto's AppManifestHelper you can grab the element from some member var you held it in // settings.HeaderBrush = new SolidColorBrush(App.VisualElements.BackgroundColor); settings.HeaderBrush = new SolidColorBrush(Colors.Orange); settings.HeaderText = string.Format("{0} Custom Settings", App.VisualElements.DisplayName); // provide some logo (preferrably the smallogo the app uses) BitmapImage bmp = new BitmapImage(App.VisualElements.SmallLogoUri); settings.SmallLogoImageSource = bmp; // set the content for the flyout settings.Content = new SettingsContent(); // open it settings.IsOpen = true; // this is only for the test app and not needed // you would not use this code in your real app ObjectTracker.Track(settings); }); args.Request.ApplicationCommands.Add(cmd); }
/// <summary> /// This the event handler for the "Defaults" button added to the settings charm. This method /// is responsible for creating the Popup window will use as the container for our settings Flyout. /// The reason we use a Popup is that it gives us the "light dismiss" behavior that when a user clicks away /// from our custom UI it just dismisses. This is a principle in the Settings experience and you see the /// same behavior in other experiences like AppBar. /// </summary> /// <param name="command"></param> void onSettingsCommand(IUICommand command) { // Create a SettingsFlyout the same dimensions as the Popup. SettingsFlyout mypane = new SettingsFlyout(); CreateFlyout(mypane); }
private void ShowLayoutSettings() { SettingsFlyout settings = new SettingsFlyout(); // set the desired width. If you leave this out, you will get Narrow (346px) settings.FlyoutWidth = Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth.Narrow; // optionally change header and content background colors away from defaults (recommended) // if using Callisto's AppManifestHelper you can grab the element from some member var you held it in // settings.HeaderBrush = new SolidColorBrush(App.VisualElements.BackgroundColor); settings.HeaderBrush = new SolidColorBrush(Colors.Orange); settings.HeaderText = "Layout Values"; // string.Format("{0}", App.VisualElements.DisplayName); settings.ContentBackgroundBrush = LatticePathDisplay.CanvasBackgroundBrush; // provide some logo (preferrably the smallogo the app uses) BitmapImage bmp = new BitmapImage(App.VisualElements.SmallLogoUri); settings.SmallLogoImageSource = bmp; // set the content for the flyout LatticeFaceLayoutSettingsContent c = new LatticeFaceLayoutSettingsContent(); c.DataContext = viewModel.CurrentPathData; settings.Content = c; // open it settings.IsOpen = true; }
void Settings_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { try { var viewAboutPage = new SettingsCommand("", "Об авторе", cmd => { //(Window.Current.Content as Frame).Navigate(typeof(AboutPage)); var settingsFlyout = new SettingsFlyout(); settingsFlyout.Content = new About(); settingsFlyout.HeaderText = "Об авторе"; settingsFlyout.IsOpen = true; }); args.Request.ApplicationCommands.Add(viewAboutPage); var viewAboutMalukahPage = new SettingsCommand("", "Политика конфиденциальности", cmd => { var settingsFlyout = new SettingsFlyout(); settingsFlyout.Content = new Privacy(); settingsFlyout.HeaderText = "Политика конфиденциальности"; settingsFlyout.IsOpen = true; }); args.Request.ApplicationCommands.Add(viewAboutMalukahPage); var refreshDatabase = new SettingsCommand("", "Обновить базу данных", cmd => { ViewModelLocator.MainStatic.LoadTouristQuery(); }); args.Request.ApplicationCommands.Add(refreshDatabase); } catch { }; }
public static void ChangeLanguageResources(string targetLanguage, SettingsFlyout targtControl) { CultureInfo cul = new CultureInfo(targetLanguage); RegionInfo reg = new RegionInfo(targetLanguage); if (cul == CultureInfo.InvariantCulture) { return; } var qualifierValues = ResourceContext.GetForCurrentView().Clone().QualifierValues; Task t = new Task(() => { string text = ""; if (targtControl != null) { text = GetResourceString(targtControl.Name + ".Title"); if (string.IsNullOrEmpty(text)) { text = GetResourceString(targtControl.Name + "Title"); } targtControl.Title = text; setChildrenResource(targtControl); } }); qualifierValues.MapChanged += (s, e) => { t.RunSynchronously(); }; ApplicationLanguages.PrimaryLanguageOverride = targetLanguage; }
void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { if (args.Request.ApplicationCommands.Count == 0) { // Add an About command var about = new SettingsCommand("about", _resourceLoader.GetString("AppBarAboutTitle"), (handler) => { var settings = new SettingsFlyout(); settings.ShowFlyout(new AboutUserControl()); }); args.Request.ApplicationCommands.Add(about); // Add an settings command var settingsCommand = new SettingsCommand("settings", _resourceLoader.GetString("AppBarSettingsTitle"), (handler) => { var settingsFlyout = new SettingsFlyout(); settingsFlyout.ShowFlyout(new SettingsUserControl()); }); args.Request.ApplicationCommands.Add(settingsCommand); // Add an privacy policy command var privacyCommand = new SettingsCommand("privacy", "Privacy Policy", (handler) => { var settingsFlyout = new SettingsFlyout(); settingsFlyout.ShowFlyout(new PrivacyPolicyControl()); }); args.Request.ApplicationCommands.Add(privacyCommand); } }
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); }
/// <summary> /// Define Settings Pages for the application once the OnCommandsRequested event is raised. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void Settings_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { Color _background = Color.FromArgb(255, 178, 34, 34); // Add an About command var About = new SettingsCommand("About", "About", (handler) => { var settings = new SettingsFlyout(); settings.Content = new AboutPage(); settings.HeaderBrush = new SolidColorBrush(_background); settings.Background = new SolidColorBrush(_background); settings.HeaderText = "About"; settings.IsOpen = true; }); var Settings = new SettingsCommand("Settings", "Settings", (handler) => { var settings = new SettingsFlyout(); settings.Content = new SettingsPage(); settings.HeaderBrush = new SolidColorBrush(_background); settings.Background = new SolidColorBrush(_background); settings.HeaderText = "Settings"; settings.IsOpen = true; }); args.Request.ApplicationCommands.Add(About); //args.Request.ApplicationCommands.Add(Settings); }
public MapPageDirections() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += navigationHelper_LoadState; this.navigationHelper.SaveState += navigationHelper_SaveState; this.Waypoints = new List <string>(); var directionsManager = MyMap.DirectionsManager; var directionsInput = directionsManager.DirectionsInputView; directionsInput.Width = 340; directionsInput.HorizontalAlignment = HorizontalAlignment.Center; directionsInputFlyout = new SettingsFlyout() { Background = new SolidColorBrush(Colors.DimGray), Content = directionsInput, Title = "Directions" }; // Add the route summary to the instructions panel. Instructions.Content = directionsManager.RouteSummaryView; // Attach an event to show the instructions panel when the route changes. directionsManager.ActiveRouteChanged += DirectionsManager_ActiveRouteChanged; }
private void Points_Click(object sender, RoutedEventArgs e) { if (LatticePathDisplay.CurrentPath == null) { return; } SettingsFlyout settings = new SettingsFlyout(); // set the desired width. If you leave this out, you will get Narrow (346px) settings.FlyoutWidth = Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth.Wide; // optionally change header and content background colors away from defaults (recommended) // if using Callisto's AppManifestHelper you can grab the element from some member var you held it in settings.HeaderBrush = new SolidColorBrush(App.VisualElements.BackgroundColor); //settings.HeaderBrush = new SolidColorBrush(Colors.Orange); settings.HeaderText = "Points"; // string.Format("{0}", App.VisualElements.DisplayName); settings.ContentBackgroundBrush = LatticePathDisplay.CanvasBackgroundBrush; // provide some logo (preferrably the smallogo the app uses) BitmapImage bmp = new BitmapImage(App.VisualElements.SmallLogoUri); settings.SmallLogoImageSource = bmp; PointsControl pc = new PointsControl(); pc.DataContext = LatticePathDisplay.CurrentPath.AllPoints; //pc.SelectedPath = 0; settings.Content = pc; // open it settings.IsOpen = true; }
/// <summary> /// This the event handler for the "Server Settings" button added to the settings charm. This method /// is responsible for creating the Popup window will use as the container for our settings Flyout. /// The reason we use a Popup is that it gives us the "light dismiss" behavior that when a user clicks away /// from our custom UI it just dismisses. This is a principle in the Settings experience and you see the /// same behavior in other experiences like AppBar. /// </summary> /// <param name="command"></param> private void onSettingsCommand(IUICommand command) { // Create a Popup window which will contain our flyout. settingsPopup = new Popup(); settingsPopup.Closed += OnPopupClosed; Window.Current.Activated += OnWindowActivated; settingsPopup.IsLightDismissEnabled = true; settingsPopup.Width = settingsWidth; settingsPopup.Height = windowBounds.Height; // Add the proper animation for the panel. settingsPopup.ChildTransitions = new TransitionCollection(); settingsPopup.ChildTransitions.Add(new PaneThemeTransition() { Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left }); // Create a SettingsFlyout the same dimenssions as the Popup. SettingsFlyout mypane = new SettingsFlyout(); mypane.Width = settingsWidth; mypane.Height = windowBounds.Height; // Place the SettingsFlyout inside our Popup window. settingsPopup.Child = mypane; // Let's define the location of our Popup. settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0); settingsPopup.SetValue(Canvas.TopProperty, 0); settingsPopup.IsOpen = true; }
private void appSettings_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { //设置面板打开就会进,所以外面做按钮调用删除,也不起作用, //除非在App设置跳转内部写(CommandsRequested)里实现. settingsPaneCommands = args; cmd = new SettingsCommand("Mat", "Mat", (x) => { SettingsFlyout settings = new SettingsFlyout(); settings.FlyoutWidth = SettingsFlyout.SettingsFlyoutWidth.Narrow; settings.HeaderBrush = new SolidColorBrush(Colors.Orange); settings.HeaderText = string.Format("{0} Mat", App.VisualElements.DisplayName); BitmapImage bmp = new BitmapImage(App.VisualElements.SmallLogoUri); settings.SmallLogoImageSource = bmp; settings.Content = new SettingsContent(); settings.IsOpen = true; }); settingsPaneCommands.Request.ApplicationCommands.Add(cmd); cmd1 = new SettingsCommand("Matong", "Matong", (x) => { SettingsFlyout settings = new SettingsFlyout(); settings.FlyoutWidth = SettingsFlyout.SettingsFlyoutWidth.Narrow; settings.HeaderBrush = new SolidColorBrush(Colors.Blue); settings.HeaderText = string.Format("{0} Matong", App.VisualElements.DisplayName); BitmapImage bmp = new BitmapImage(App.VisualElements.SmallLogoUri); settings.SmallLogoImageSource = bmp; settings.Content = new SettingsContent(); settings.IsOpen = true; }); settingsPaneCommands.Request.ApplicationCommands.Add(cmd1); }
void Settings_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { try { var viewAboutPage = new SettingsCommand("", "About", cmd => { //(Window.Current.Content as Frame).Navigate(typeof(AboutPage)); var settingsFlyout = new SettingsFlyout(); settingsFlyout.Content = new About(); settingsFlyout.HeaderText = "About"; settingsFlyout.IsOpen = true; }); args.Request.ApplicationCommands.Add(viewAboutPage); /*var viewAboutMalukahPage = new SettingsCommand("", "About Malukah", cmd => * { * var settingsFlyout = new SettingsFlyout(); * settingsFlyout.Content = new AboutMalukah(); * settingsFlyout.HeaderText = "About Malukah"; * * settingsFlyout.IsOpen = true; * }); * args.Request.ApplicationCommands.Add(viewAboutMalukahPage);*/ } catch { }; }
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); }
private void BlankPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { SettingsCommand cmd = new SettingsCommand("sample", "Sample Custom Setting", (x) => { // create a new instance of the flyout SettingsFlyout settings = new SettingsFlyout(); // set the desired width. If you leave this out, you will get Narrow (346px) settings.FlyoutWidth = (Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth)Enum.Parse(typeof(Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth), settingswidth.SelectionBoxItem.ToString()); // optionally change header and content background colors away from defaults (recommended) //settings.Background = new SolidColorBrush(Colors.Red); settings.HeaderBrush = new SolidColorBrush(Colors.Orange); settings.HeaderText = "Foo Bar Custom Settings"; // provide some logo (preferrably the smallogo the app uses) BitmapImage bmp = new BitmapImage(new Uri("ms-appx:///Assets/SmallLogo.png")); settings.SmallLogoImageSource = bmp; // set the content for the flyout settings.Content = new SettingsContent(); // open it settings.IsOpen = true; // this is only for the test app and not needed // you would not use this code in your real app ObjectTracker.Track(settings); }); args.Request.ApplicationCommands.Add(cmd); }
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); }
public void Flyout(Type source, object parameter = null) { var view = (Control)Activator.CreateInstance(source); view.DataContext = parameter; _flyout = new SettingsFlyout { Title = view.Name, Content = view, Width = view.Width, Foreground = view.Foreground, Background = view.Background, HeaderBackground = view.BorderBrush, BorderBrush = view.BorderBrush, RequestedTheme = _frame.RequestedTheme, VerticalAlignment = VerticalAlignment.Stretch, Padding = new Thickness(0), }; ScrollViewer.SetVerticalScrollBarVisibility(_flyout, ScrollBarVisibility.Disabled); ScrollViewer.SetVerticalScrollMode(_flyout, ScrollMode.Disabled); _flyout.BackClick += OnFlyoutBack; _flyout.ShowIndependent(); }
private void liveChannelGridView_ItemClick(object sender, ItemClickEventArgs e) { var item = e.ClickedItem as LiveListItem; if (item == null) { return; } if (LiveCenterFactoryBase.IsDirectPlay(item.ChannelInfo.LiveType)) { if (IsStart(item)) { this.Frame.Navigate(typeof(PlayPage), item); } } else { if (_settingsFlyout == null) { _settingsFlyout = new SettingsFlyout(); _settingsFlyout.CloseAction += liveDetailClose; _liveDetailControl = new LiveDetailControl(); _liveDetailControl.CloseAction += liveDetailClose; _liveDetailControl.HttpTimeOutOrFail += http_FailorTimeOut; _settingsFlyout.ShowFlyout(_liveDetailControl, 510, false); emptyGrid.Width = 510; } _liveDetailControl.SetSource(item); } }
/// <summary> /// Show a settings flyout using the Callisto toolkit (http://callistotoolkit.com/) /// </summary> /// <param name="title">Name of flyout</param> /// <param name="content">UserControl containing the content to be displayed in the flyout</param> /// <param name="width">Flyout width (narrow or wide)</param> private async void ShowFlyout(string title, Windows.UI.Xaml.Controls.UserControl content, SettingsFlyout.SettingsFlyoutWidth width = SettingsFlyout.SettingsFlyoutWidth.Narrow) { // grab app theme color from resources (optional) SolidColorBrush color = null; if (App.Current.Resources.Keys.Contains("AppThemeBrush")) { color = App.Current.Resources["AppThemeBrush"] as SolidColorBrush; } // create the flyout var flyout = new SettingsFlyout(); if (color != null) { flyout.HeaderBrush = color; } flyout.HeaderText = title; flyout.FlyoutWidth = width; // access the small logo from the manifest flyout.SmallLogoImageSource = new BitmapImage((await AppManifestHelper.GetManifestVisualElementsAsync()).SmallLogoUri); // assign content and show flyout.Content = content; flyout.IsOpen = true; }
private void ShowPrivacyPolicy(IUICommand command) { var flyout = new SettingsFlyout(); flyout.Title = "Privacy Policy"; flyout.Show(); }
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); }; }
// TODO: Implement own settings views (UserControl based on SettingsFlyout) private void ShowHelp(IUICommand command) { var flyout = new SettingsFlyout(); flyout.Title = "Help"; flyout.Show(); }
void Settings_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { try { var viewAboutPage = new SettingsCommand("", "Об авторе", cmd => { //(Window.Current.Content as Frame).Navigate(typeof(AboutPage)); var settingsFlyout = new SettingsFlyout(); settingsFlyout.Content = new About(); settingsFlyout.HeaderText = "Об авторе"; settingsFlyout.IsOpen = true; }); args.Request.ApplicationCommands.Add(viewAboutPage); var viewAboutMalukahPage = new SettingsCommand("", "Политика конфиденциальности", cmd => { var settingsFlyout = new SettingsFlyout(); settingsFlyout.Content = new Privacy(); settingsFlyout.HeaderText = "Политика конфиденциальности"; settingsFlyout.IsOpen = true; }); args.Request.ApplicationCommands.Add(viewAboutMalukahPage); } catch { }; }
/// <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 dialog /// </summary> /// <typeparam name="T">View model's type, inherited from Screen</typeparam> /// <param name="onInitialize">Method which is executed before the dialog is shown</param> /// <param name="onClosed">Method which is executed after the dialog has been closed</param> /// <param name="headerBrush">Setting pane's header color</param> /// <param name="backgroundBrush">Setting pane's backgruond color</param> public void ShowSettings <T>( Action <T> onInitialize = null, Action <T, UIElement> onClosed = null, SolidColorBrush headerBrush = null, SolidColorBrush backgroundBrush = null) where T : Screen { var viewModelAndView = CreateViewModelAndView(onInitialize); var vm = viewModelAndView.Item1; var view = viewModelAndView.Item2; var f = new SettingsFlyout { HeaderText = vm.DisplayName, Content = view, }; if (headerBrush != null) { f.HeaderBrush = headerBrush; } if (backgroundBrush != null) { f.Background = backgroundBrush; } f.IsOpen = true; if (onClosed != null) { f.Closed += (sender, o) => onClosed(vm, view); } }
private void BlankPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { //设置面板打开就会进,所以外面做按钮调用删除,也不起作用, //除非在App设置跳转内部写(CommandsRequested)里实现. settingsPaneCommands = args; cmd = new SettingsCommand("第三项", "第三项", (x) => { SettingsFlyout settings = new SettingsFlyout(); settings.FlyoutWidth = (SettingsFlyout.SettingsFlyoutWidth)Enum.Parse(typeof(SettingsFlyout.SettingsFlyoutWidth), settingswidth.SelectionBoxItem.ToString()); settings.HeaderBrush = new SolidColorBrush(Colors.Orange); settings.HeaderText = string.Format("{0} 第三项", App.VisualElements.DisplayName); BitmapImage bmp = new BitmapImage(App.VisualElements.SmallLogoUri); settings.SmallLogoImageSource = bmp; settings.Content = new SettingsContent(); settings.IsOpen = true; settings.Closed -= settings_Closed; settings.Closed += settings_Closed; }); settingsPaneCommands.Request.ApplicationCommands.Add(cmd); cmd1 = new SettingsCommand("第四项", "第四项", (x) => { SettingsFlyout settings = new SettingsFlyout(); settings.FlyoutWidth = (SettingsFlyout.SettingsFlyoutWidth)Enum.Parse(typeof(SettingsFlyout.SettingsFlyoutWidth), settingswidth.SelectionBoxItem.ToString()); settings.HeaderBrush = new SolidColorBrush(Colors.Blue); settings.HeaderText = string.Format("{0} 第四项", App.VisualElements.DisplayName); BitmapImage bmp = new BitmapImage(App.VisualElements.SmallLogoUri); settings.SmallLogoImageSource = bmp; settings.Content = new SettingsContent(); settings.IsOpen = true; }); settingsPaneCommands.Request.ApplicationCommands.Add(cmd1); }
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); }; }
private void Grid_Click(object sender, RoutedEventArgs e) { GridControl gc = new GridControl(); gc.DataContext = LatticePathDisplay.Grid; gc.Background = LatticePathDisplay.CanvasBackgroundBrush; SettingsFlyout settings = new SettingsFlyout(); // set the desired width. If you leave this out, you will get Narrow (346px) settings.FlyoutWidth = Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth.Narrow; // optionally change header and content background colors away from defaults (recommended) // if using Callisto's AppManifestHelper you can grab the element from some member var you held it in // settings.HeaderBrush = new SolidColorBrush(App.VisualElements.BackgroundColor); settings.HeaderBrush = new SolidColorBrush(LatticePathDisplay.Grid.Foreground); settings.HeaderText = "Grid Size"; // string.Format("{0}", App.VisualElements.DisplayName); settings.ContentBackgroundBrush = LatticePathDisplay.CanvasBackgroundBrush; // provide some logo (preferrably the smallogo the app uses) BitmapImage bmp = new BitmapImage(App.VisualElements.SmallLogoUri); settings.SmallLogoImageSource = bmp; settings.Content = gc; // open it settings.IsOpen = true; }
/// <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 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(); }
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(); }
public MainWindow() { InitializeComponent(); // Load everything !! //Loaded += delegate { Test(); }; //Loaded += delegate { new Thread(StartUp).Start(); }; Loaded += MainWindow_Loaded; Factions.UsTile.Click += delegate { TabControl.SelectedItem = USTab; }; Factions.CartelTile.Click += delegate { TabControl.SelectedItem = CartelTab; }; Factions.ChimeraTile.Click += delegate { TabControl.SelectedItem = ChimeraTab; }; _flyout = new SettingsFlyout(); _flyout.OnRequestReloading += _flyout_OnRequestReloading; FlyoutControl.Items.Add(_flyout); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; }
private void Button_Click_1(object sender, RoutedEventArgs e) { SettingsFlyout flyout = new SettingsFlyout(); flyout.ShowFlyout(new FlyoutContentUserControl()); }
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(); }
void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { // Add an About command var about = new SettingsCommand("about", "About", (handler) => { var settings = new SettingsFlyout(); settings.Content = new AboutUserControl(); settings.HeaderBrush = new SolidColorBrush(_background); settings.Background = new SolidColorBrush(_background); settings.HeaderText = "About"; settings.IsOpen = true; }); args.Request.ApplicationCommands.Add(about); // Add a Preferences command var preferences = new SettingsCommand("preferences", "Preferences", (handler) => { var settings = new SettingsFlyout(); settings.Content = new PreferencesUserControl(); settings.HeaderBrush = new SolidColorBrush(_background); settings.Background = new SolidColorBrush(_background); settings.HeaderText = "Preferences"; settings.IsOpen = true; }); args.Request.ApplicationCommands.Add(preferences); }
/*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(); }
public SendRequestComand(SettingsFlyout flyout) { this.flyout = flyout; }
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); }
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); }
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(); }
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); }
protected override void ShowSettingsFlyout(SettingsFlyout settingsFlyout) { ShowSettingsFlyoutCalls.Add(settingsFlyout); }
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(); }
public void DisplayPage_WithSettingsFlyout_SetsSettingsFlyoutHostContent() { TestableSettingsPaneManager settingsPaneManager = CreateSettingsPaneManager(); SettingsFlyout page = new SettingsFlyout(); settingsPaneManager.CallDisplayPage(page); SettingsFlyout flyout = settingsPaneManager.ShowSettingsFlyoutCalls.First(); Assert.Equal(page, flyout.Content); }
public void DisplayPage_WithSettingsFlyout_SetsSettingsFlyoutHostWidth() { TestableSettingsPaneManager settingsPaneManager = CreateSettingsPaneManager(); UserControl page1 = new UserControl(); SettingsPaneInfo.SetWidth(page1, 420); settingsPaneManager.CallDisplayPage(page1); SettingsFlyout page2 = new SettingsFlyout() { Width = 500 }; settingsPaneManager.CallDisplayPage(page2); SettingsFlyout flyout = settingsPaneManager.ShowSettingsFlyoutCalls.First(); Assert.Equal(500, flyout.Width); }
public SettingsFlyoutEvents(SettingsFlyout This) : base(This) { this.This = This; }
public SettingsFlyoutWrapper(SettingsFlyout flyout) { _flyout = flyout; _flyout.BackClick += FlyoutOnBackClick; _flyout.Unloaded += FlyoutOnUnloaded; }
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 DisplayPage_WithSettingsFlyout_UsesCustomTemplate() { TestableSettingsPaneManager settingsPaneManager = CreateSettingsPaneManager(); SettingsFlyout page = new SettingsFlyout(); settingsPaneManager.CallDisplayPage(new UserControl()); settingsPaneManager.CallDisplayPage(page); SettingsFlyout flyout = settingsPaneManager.ShowSettingsFlyoutCalls.First(); Assert.NotNull(flyout.Template); }
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 CallShowSettingsFlyoutDirect(SettingsFlyout settingsFlyout) { base.ShowSettingsFlyout(settingsFlyout); }
protected virtual void ShowSettingsFlyout(SettingsFlyout settingsFlyout) { if (settingsFlyout == null) throw new ArgumentNullException(nameof(settingsFlyout)); // Show the settings flyout // NB: Call 'ShowIndependent()' rather than 'Show()' as we handle displaying the system settings pane as required settingsFlyout.ShowIndependent(); }