/// <summary> /// Initializes a new instance of the <see cref="ColorSettingsFlyout"/> class. /// </summary> public ColorSettingsFlyout() { this.InitializeComponent(); this.customTheme = ColorThemesDataSource.GetCustomTheme(); for (int i = 0; i < this.ScreenColorListBox.Items.Count; i++) { ListBoxItem item = (ListBoxItem)this.ScreenColorListBox.Items[i]; int screenColor = i - 4; Color color = this.customTheme.ColorTable[(ScreenColor)screenColor]; item.BorderBrush = new SolidColorBrush(color); item.BorderThickness = new Thickness(50.0d, 0.0d, 0.0d, 0.0d); } this.ScreenColorListBox.SelectedIndex = 0; this.FontFamilyListBox.Items.Clear(); this.FontFamilyListBox.ItemsSource = ScreenDisplay.BaseLogicalFontMetrics.Keys; this.FontFamilyListBox.SelectedItem = this.customTheme.FontFamily; this.FontSizeSlider.Value = this.customTheme.FontSize; }
/// <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 async override 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; await ApplicationData.Current.SetVersionAsync(0, SetVersionHandler); FavoritesDataSource favoritesDataSource = (FavoritesDataSource)App.Current.Resources["favoritesDataSource"]; if (favoritesDataSource != null) { if (favoritesDataSource.Favorites.Count == 0) { favoritesDataSource.GetFavorites(); } } PrivateKeysDataSource privateKeysDataSource = (PrivateKeysDataSource)App.Current.Resources["privateKeysDataSource"]; if (privateKeysDataSource != null) { if (privateKeysDataSource.PrivateKeys.Count == 0) { await privateKeysDataSource.GetPrivateKeys(); } } ColorThemesDataSource colorThemesDataSource = (ColorThemesDataSource)App.Current.Resources["colorThemesDataSource"]; if (colorThemesDataSource != null) { if (colorThemesDataSource.CustomTheme == null) { colorThemesDataSource.GetColorThemes(); } } 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(FavoritesPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }