public override void OnApplyTemplate() { base.OnApplyTemplate(); this.settingsPane = this.GetTemplateChild("settingsPane") as SettingsPane; this.addRemove = this.GetTemplateChild("addRemoveButtons") as FrameworkElement; if (this.ContextItem != null) this.OnContextItemChanged(this.ContextItem, null); }
private void AppCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { if (args.Request.ApplicationCommands.Count == 0) { var aboutCommand = new SettingsCommand("About", "About", new UICommandInvokedHandler(OnAboutSettingsCommand)); args.Request.ApplicationCommands.Add(aboutCommand); var privacyCommand = new SettingsCommand("Privacy", "Privacy", new UICommandInvokedHandler(OnPrivacySettingsCommand)); args.Request.ApplicationCommands.Add(privacyCommand); var helpCommand = new SettingsCommand("Help", "Help", new UICommandInvokedHandler(OnHelpSettingsCommand)); args.Request.ApplicationCommands.Add(helpCommand); } }
protected override void OnWindowCreated(WindowCreatedEventArgs args) { base.OnWindowCreated(args); SettingsPane.GetForCurrentView().CommandsRequested += (sender, eventArgs) => { var credentialsSetting = new SettingsCommand("AppUpdateCredentials", "Credentials", handler => { var flyout = new CredentialsFlyout(); flyout.Show(); }); eventArgs.Request.ApplicationCommands.Add(credentialsSetting); }; }
public virtual void RefreshScreen() { ErrorView = null; STClient.ResetData(); Top.Clear(); HostPane.Clear(); ClassListView.Clear(); LeftPane.Clear(); SettingsPane.Clear(); Setup(); Application.Refresh(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs args) { SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested; SettingsPane.GetForCurrentView().CommandsRequested += DisplayAbout; SettingsPane.GetForCurrentView().CommandsRequested += DisplayPrivacyPolicy; SettingsPane.GetForCurrentView().CommandsRequested += DisplayMail; 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"); if (args.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 if (!rootFrame.Navigate(typeof(MainPage), "AllGroups")) { throw new Exception("Failed to create initial page"); } } // Ensure the current window is active Window.Current.Activate(); }
private void OnBackButton(object sender, RoutedEventArgs e) { var parent = (Popup)Parent; if (parent != null) { parent.IsOpen = false; } if (ApplicationView.Value != ApplicationViewState.Snapped) { SettingsPane.Show(); } }
protected override void OnActivate() { base.OnActivate(); SettingsPane.GetForCurrentView().CommandsRequested += CharmsData.SettingCharmManager_HubCommandsRequested; //To insure the data shown is fetched if coming from the hub page to a new game //But that it doesn't fetch the data again if coming back from the video page. gameSelected = Parameter.season.games.FirstOrDefault(); if (this.gameSelected.opponent.ToLower().Contains("practice") || this.gameSelected.opponent.ToLower().Contains("scrimmage") || this.gameSelected.opponent.ToLower().Contains("camp")) { ScheduleEntryName = this.gameSelected.opponent; } else { ScheduleEntryName = "vs " + this.gameSelected.opponent; } PageIsEnabled = true; ProgressRingVisibility = Visibility.Collapsed; ProgressRingIsActive = false; //Categories count is checked against one due to us putting an empty category in. if (Categories.Count == 1 && (NoPlaylistText == "" || NoPlaylistText == null)) { ProgressRingVisibility = Visibility.Visible; ProgressRingIsActive = true; } if (gameSelected.gameId != _gameId) { _gameId = gameSelected.gameId; GetGameCategories(_gameId); } DeleteButton_Visibility = Visibility.Collapsed; DownloadButton_Visibility = Visibility.Collapsed; Downloading_Visibility = Visibility.Collapsed; MarkDownloadedPlaylists(); LoadActiveDownloadsAsync(); UpdateDiskInformation(); if (DownloadAccessor.Instance.Downloading) { Downloading_Visibility = Visibility.Visible; AppBarOpen = true; } }
void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { var privacyPolicy = new SettingsCommand("privacyPolicy", "Privacy Policy", (handler) => { var settings = new SettingsFlyout(); settings.Content = new PrivacyPolicy(); settings.HeaderBrush = new SolidColorBrush(background); settings.Background = new SolidColorBrush(background); settings.HeaderText = "Privacy Policy"; settings.IsOpen = true; }); args.Request.ApplicationCommands.Add(privacyPolicy); }
/// <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 await ShowWindow(e); this.ShowDisclaimer(); // Settings Flyouts SettingsPane.GetForCurrentView().CommandsRequested += App_CommandsRequested; }
private void MySettingsBackClicked(object sender, RoutedEventArgs e) { var parent = Parent as Popup; if (parent != null) { parent.IsOpen = false; } if (Windows.UI.ViewManagement.ApplicationView.Value != Windows.UI.ViewManagement.ApplicationViewState.Snapped) { SettingsPane.Show(); } }
/// <summary> /// Handler for Clos button actions /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CloseButton_Click(object sender, RoutedEventArgs e) { //Referenciar el Popup que es el control padre de este user control var pop = this.Parent as Popup; //Si el padre es en efecto un Popup cerrarlo if (pop != null) { pop.IsOpen = false; } //Mostrar el SettingsPane SettingsPane.Show(); }
private void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { args.Request.ApplicationCommands.Add(new SettingsCommand("Help", "帮助", (handler) => ShowHelpFlyout())); // args.Request.ApplicationCommands.Add(new SettingsCommand("FeedBack", "反馈", (handler) => ShowFeedBackFlyout())); // args.Request.ApplicationCommands.Add(new SettingsCommand("Assess", "好评", (handler) => ShowAssessFlyout())); args.Request.ApplicationCommands.Add(new SettingsCommand("Privacy", "隐私", (handler) => ShowPrivacyFlyout())); args.Request.ApplicationCommands.Add(new SettingsCommand("About", "关于", (handler) => ShowAboutFlyout())); // args.Request.ApplicationCommands.Add(new SettingsCommand("More", "更多软件", (handler) => ShowAboutSettingFlyout())); }
public ItemDetailPage() { this.InitializeComponent(); apiInvokePreview = new APIMASHInvoke(); apiInvokeReviews = new APIMASHInvoke(); apiInvokePreview.OnResponse += apiInvokePreviews_OnResponse; apiInvokeReviews.OnResponse += apiInvokeReviews_OnResponse; var settingsPane = SettingsPane.GetForCurrentView(); settingsPane.CommandsRequested += settingsPane_CommandsRequested; }
/// <summary> /// This event is generated when the user opens the settings pane. During this event, append your /// SettingsCommand objects to the available ApplicationCommands vector to make them available to the /// SettingsPange UI. /// </summary> /// <param name="settingsPane">Instance that triggered the event.</param> /// <param name="eventArgs">Event data describing the conditions that led to the event.</param> void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand aboutCommand = new SettingsCommand("AboutAppId", "Rakenduse kirjeldus", handler); eventArgs.Request.ApplicationCommands.Add(aboutCommand); SettingsCommand privacyCommand = new SettingsCommand("PrivacyPolicyId", "Privaatsuspoliitika", handler); eventArgs.Request.ApplicationCommands.Add(privacyCommand); SettingsCommand termsofuseCommand = new SettingsCommand("TermsOfUseId", "Kasutajatingimused", handler); eventArgs.Request.ApplicationCommands.Add(termsofuseCommand); }
/// <summary> /// Invoked when the navigation is about to change to a different page. You can use this function for cleanup. /// </summary> /// <param name="e">Event data describing the conditions that led to the event.</param> protected override void OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e); // Added to make sure the event handler for CommandsRequested is cleaned up before other scenarios. if (this.isEventRegistered) { SettingsPane.GetForCurrentView().CommandsRequested -= onCommandsRequested; this.isEventRegistered = false; } // Unregister the event that listens for events when the window size is updated. Window.Current.SizeChanged -= OnWindowSizeChanged; }
private void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { args.Request.ApplicationCommands.Add(new SettingsCommand( "General Settings", "General", (handler) => ShowCustomSettingFlyoutGeneral())); args.Request.ApplicationCommands.Add(new SettingsCommand( "Server Settings", "Server", (handler) => ShowCustomSettingFlyoutMain())); args.Request.ApplicationCommands.Add(new SettingsCommand( "Streaming Settings", "Streaming", (handler) => ShowCustomSettingFlyoutStreaming())); args.Request.ApplicationCommands.Add(new SettingsCommand( "Privacy Policy", "Privacy statment (online)", (handler) => ShowPrivacyPolicy())); }
// In most cases, it is a good idea to pause the game while the // settings pane is open. You can do this by adding the following code // to the top of the OnCommandsRequested method. This code is not // used by Reversi because the display settings are simple, and because // changing the settings results in animated changes to the game board // that would not be visible if the game were paused. //if (SettingsViewModel.GameViewModel != null && // SettingsViewModel.IsClockShowing) // SettingsViewModel.GameViewModel.Clock.Stop(); /// <summary> /// Provides app commands to populate the settings flyout. /// </summary> /// <param name="sender">The source of the command request.</param> /// <param name="args">Details about the command request</param> private void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { args.Request.ApplicationCommands.Add(new SettingsCommand("Display", "Display options", _ => (new DisplaySettings() { DataContext = SettingsViewModel }).Show())); args.Request.ApplicationCommands.Add(new SettingsCommand("NewGame", "New game options", _ => (new NewGameSettings() { DataContext = SettingsViewModel }).Show())); }
/// <summary> /// Initializes a new instance of the <see cref="LayoutAwarePage"/> class. /// </summary> public LayoutAwarePage() { if (Windows.ApplicationModel.DesignMode.DesignModeEnabled) { return; } // Create an empty default view model this.DefaultViewModel = new ObservableDictionary <String, Object>(); // When this page is part of the visual tree make two changes: // 1) Map application view state to visual state for the page // 2) Handle keyboard and mouse navigation requests this.Loaded += (sender, e) => { this.StartLayoutUpdates(sender, e); // Keyboard and mouse navigation only apply when occupying the entire window if (this.ActualHeight == Window.Current.Bounds.Height && this.ActualWidth == Window.Current.Bounds.Width) { // Listen to the window directly so focus isn't required Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated += CoreDispatcher_AcceleratorKeyActivated; Window.Current.CoreWindow.PointerPressed += this.CoreWindow_PointerPressed; } SettingsPane.GetForCurrentView().CommandsRequested += (s, args) => { var privacyStatement = new SettingsCommand("privacy", "Privacy Statement", x => Launcher.LaunchUriAsync( new Uri("http://statera.com/privacy.aspx"))); args.Request.ApplicationCommands.Clear(); args.Request.ApplicationCommands.Add(privacyStatement); }; }; // Undo the same changes when the page is no longer visible this.Unloaded += (sender, e) => { this.StopLayoutUpdates(sender, e); Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated -= CoreDispatcher_AcceleratorKeyActivated; Window.Current.CoreWindow.PointerPressed -= this.CoreWindow_PointerPressed; }; }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { if (!String.IsNullOrEmpty(args.Arguments)) { ((Frame)Window.Current.Content).Navigate(typeof(SprudelDetailPage), args.Arguments); } Window.Current.Activate(); return; } // Register handler for CommandsRequested events from the settings pane SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested; // Create a Frame to act navigation context and navigate to the first page var rootFrame = new Frame(); NavigationService.Initialize(rootFrame); SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); // Secondary Tile Activation if (!String.IsNullOrEmpty(args.Arguments)) { rootFrame.Navigate(typeof(SprudelDetailPage), args.Arguments); Window.Current.Content = rootFrame; Window.Current.Activate(); return; } if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { await SuspensionManager.RestoreAsync(); } if (rootFrame.Content == null) { if (!rootFrame.Navigate(typeof(MainPage))) { throw new Exception("Failed to create initial page"); } } // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); }
void AppCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { SettingsCommand cmd = new SettingsCommand("account", "Account", (x) => { _settingsPopup = new Popup(); _settingsPopup.Closed += OnPopupClosed; Window.Current.Activated += OnWindowActivated; _settingsPopup.IsLightDismissEnabled = true; _settingsPopup.Width = _settingsWidth; _settingsPopup.Height = _windowBounds.Height; AccFly mypane = new AccFly(); mypane.Width = _settingsWidth; mypane.Height = _windowBounds.Height; _settingsPopup.Child = mypane; _settingsPopup.SetValue(Canvas.LeftProperty, _windowBounds.Width - _settingsWidth); _settingsPopup.SetValue(Canvas.TopProperty, 0); _settingsPopup.IsOpen = true; }); args.Request.ApplicationCommands.Add(cmd); var about = new SettingsCommand("about", "About the App", OpenAbout); args.Request.ApplicationCommands.Add(about); var features = new SettingsCommand("features", "Features of the App", OpenFeatures); args.Request.ApplicationCommands.Add(features); // Privacy settings command. cmd = new SettingsCommand("privacy", "Privacy", (x) => { _settingsPopup = new Popup(); _settingsPopup.Closed += OnPopupClosed; Window.Current.Activated += OnWindowActivated; _settingsPopup.IsLightDismissEnabled = true; _settingsPopup.Width = _settingsWidth; _settingsPopup.Height = _windowBounds.Height; fly mypane = new fly(); mypane.Width = _settingsWidth; mypane.Height = _windowBounds.Height; _settingsPopup.Child = mypane; _settingsPopup.SetValue(Canvas.LeftProperty, _windowBounds.Width - _settingsWidth); _settingsPopup.SetValue(Canvas.TopProperty, 0); _settingsPopup.IsOpen = true; }); args.Request.ApplicationCommands.Add(cmd); }
protected override void OnWindowCreated(WindowCreatedEventArgs args) { SettingsPane.GetForCurrentView().CommandsRequested += (s, e) => { SettingsCommand defaultsCommand = new SettingsCommand("general", "خصائص عامة", (handler) => { var sf = new SettingsFlyout1(); sf.Show(); }); e.Request.ApplicationCommands.Add(defaultsCommand); }; base.OnWindowCreated(args); }
void settings_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { args.Request.ApplicationCommands.Add(new SettingsCommand("PrivacyStatement", "Privacy statement", async(e) => { await SettingsInteractionHelper.ShowPrivacyStatementAsync(); })); args.Request.ApplicationCommands.Add(new SettingsCommand("MySettings", "My Settings", (e) => { var flyout = new MySettingsFlyout(new MySettingsPane()); flyout.Show(); })); args.Request.ApplicationCommands.Add(new SettingsCommand("Help", "Help", (e) => { ShowHelp(); })); }
void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { var optionsCharmCmd = new SettingsCommand("options", "Options", handler => { var flyout = Flyouts.Build("Options", new Settings()); flyout.Show(); }); var privacyPolicyCharmCmd = new SettingsCommand("privacy", "Privacy policy", handler => { var flyout = Flyouts.Build("Privacy policy", new PrivacyPolicy()); flyout.Show(); }); var appCommands = args.Request.ApplicationCommands; appCommands.Add(optionsCharmCmd); appCommands.Add(privacyPolicyCharmCmd); }
private void settingsPane_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { var ConfigHandler = new UICommandInvokedHandler(onConfigCommand); var LogoutHandler = new UICommandInvokedHandler(onLogoutCommand); var loader = new ResourceLoader(); var configurationCommand = new SettingsCommand(loader.GetString("Settings"), loader.GetString("Settings"), ConfigHandler); args.Request.ApplicationCommands.Add(configurationCommand); if (!string.IsNullOrEmpty(ConnectedService.LoggedInUser)) { var logoutCommand = new SettingsCommand(loader.GetString("Logout"), loader.GetString("Logout"), onLogoutCommand); args.Request.ApplicationCommands.Add(logoutCommand); } }
private void GoBack(object sender, RoutedEventArgs e) { var parent = this.Parent as Popup; if (parent != null) { parent.IsOpen = false; } // If the app is not snapped, then the back button shows the Settings pane again. if (ApplicationView.Value != ApplicationViewState.Snapped) { SettingsPane.Show(); } }
// Wird am Anfang der Seite geladen public MainPage() { // Componenten laden this.InitializeComponent(); // Seperator erstellen SetSeparator.Text = "<X>"; // Copy Buttons erstellen ToTranslateCopy.Content = "<c>"; TranslatedCopy.Content = "<c>"; // Flyouts erstellen SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested; }
private void OnBackButtonTapped(object sender, object e) { // BUG #47: need to map back button to custom and ability to disable if (_hostPopup != null) { _hostPopup.IsOpen = false; } // TEMP: wrapping this to ensure back button doesn't happen in snap/portrait if (ApplicationView.Value != ApplicationViewState.Snapped) { SettingsPane.Show(); } }
private void MySettingsBackClicked(object sender, RoutedEventArgs e) { Popup parent = this.Parent as Popup; if (parent != null) { parent.IsOpen = false; } // If the app is not snapped, then the back button shows the Settings pane again. if (Windows.UI.ViewManagement.ApplicationView.Value != Windows.UI.ViewManagement.ApplicationViewState.Snapped) { SettingsPane.Show(); } }
void LayoutAwarePage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { string label = "Privacy Policy"; if (!args.Request.ApplicationCommands.Any(c => c.Id == label)) { SettingsCommand cmd = new SettingsCommand(label, label, async(x) => { await Launcher.LaunchUriAsync(new Uri("http://codecube.net/khanacademy/privacy/")); }); args.Request.ApplicationCommands.Add(cmd); } }
/// <summary> /// Called when the Settings charm is invoked, this handler populates the Settings charm with the charm items returned by the GetSettingsCommands function. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="SettingsPaneCommandsRequestedEventArgs"/> instance containing the event data.</param> private void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { if (args == null || args.Request == null || args.Request.ApplicationCommands == null) { return; } var applicationCommands = args.Request.ApplicationCommands; var settingsCommands = GetSettingsCommands(); foreach (var settingsCommand in settingsCommands) { applicationCommands.Add(settingsCommand); } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { sbLoadView.Completed += (obj, ea) => { }; sbLoadView.Begin(); try { SettingsPane.GetForCurrentView().CommandsRequested += _vm.onCommandsRequested; //SearchPane.GetForCurrentView().QuerySubmitted += _vm.onQuerySubmitted; } catch { } }
private void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { var setting = new SettingsCommand("MySetting", "MySetting", handler => new MySettingsFlyout().Show()); args.Request.ApplicationCommands.Add(setting); }