private async void Configure() { _visualElement = await AppManifestHelper.GetManifestVisualElementsAsync(); _headerBrush = new SolidColorBrush(_visualElement.BackgroundColor); _smallLogoImageSource = new BitmapImage(_visualElement.SmallLogoUri); SettingsPane.GetForCurrentView().CommandsRequested += Current.CommandsRequested; }
private async void Configure() { appSettings = SettingsPane.GetForCurrentView(); _visualElement = await AppManifestHelper.GetManifestVisualElementsAsync(); _smallLogoImageSource = new BitmapImage(_visualElement.SmallLogoUri); appSettings.CommandsRequested -= Current.CommandsRequested; appSettings.CommandsRequested += Current.CommandsRequested; //SettingsPane.GetForCurrentView().CommandsRequested += Current.CommandsRequested; }
/// <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 async override void OnLaunched(LaunchActivatedEventArgs args) { AppSettings.Current.AddCommand <SettingsContent>("第一项", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Gray), new SolidColorBrush(Colors.Blue), SettingsFlyout.SettingsFlyoutWidth.Wide); AppSettings.Current.AddCommand <SettingsContent>("第二项", SettingsFlyout.SettingsFlyoutWidth.Wide); AppSettings.Current.AddCommand <SettingsContent>("第五项", new SolidColorBrush(Colors.Green), SettingsFlyout.SettingsFlyoutWidth.Wide); //AppSettings.Current.ResetConfigureSettings(); //测试放在一起一个时机 SystemSettingHelper.Instance.Init(); VisualElements = await AppManifestHelper.GetManifestVisualElementsAsync(); // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } //添加注册后台任务,更新主屏Tile var localsettings = ApplicationData.Current.LocalSettings; var tile = new NotificationTileUpdateTaskRegistration(); tile.CreateTileUpdateTasks(localsettings.CreateContainer(NotificationTileConstants.TaskSettingsContainer, ApplicationDataCreateDisposition.Always)); // Create a Frame to act navigation context and navigate to the first page var rootFrame = new Frame(); if (!rootFrame.Navigate(typeof(BlankPage))) { 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(); }
/// <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) { // get the name of the app from the mainfest DisplayName = (await AppManifestHelper.GetManifestVisualElementsAsync()).DisplayName; // provide types used in page state to the SuspensionManager SuspensionManager.KnownTypes.Add(typeof(BoundingBox)); SuspensionManager.KnownTypes.Add(typeof(LatLong)); SuspensionManager.KnownTypes.Add(typeof(MainPage.MainPageState)); 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(); SuspensionManager.RegisterFrame(rootFrame, "appFrame"); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { await SuspensionManager.RestoreAsync(); } // 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), args.Arguments)) { throw new Exception("Failed to create initial page"); } } // Ensure the current window is active Window.Current.Activate(); }
/// <summary> /// Invoked when the application is activated to display search results. /// </summary> /// <param name="args">Details about the activation request.</param> protected async override void OnSearchActivated(Windows.ApplicationModel.Activation.SearchActivatedEventArgs args) { // get the name of the app from the mainfest DisplayName = (await AppManifestHelper.GetManifestVisualElementsAsync()).DisplayName; // If the Window isn't already using Frame navigation, insert our own Frame var previousContent = Window.Current.Content; var frame = previousContent as Frame; // If the app does not contain a top-level frame, it is possible that this // is the initial launch of the app. Typically this method and OnLaunched // in App.xaml.cs can call a common method. if (frame == null) { // Create a Frame to act as the navigation context and associate it with // a SuspensionManager key frame = new Frame(); SuspensionManager.RegisterFrame(frame, "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 } } } frame.Navigate(typeof(LocationSearchResultsPage), args.QueryText); Window.Current.Content = frame; // Ensure the current window is active Window.Current.Activate(); }