public object Convert(object value, Type targetType, object parameter, string language) { bool isEnabled = (bool)value; GeneralSettings generalSettings = settingsUtils.GetSettings <GeneralSettings>(string.Empty); var defaultTheme = new Windows.UI.ViewManagement.UISettings(); var uiTheme = defaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString(); string selectedTheme = generalSettings.Theme.ToLower(); if (selectedTheme == "dark" || (selectedTheme == "system" && uiTheme == "#FF000000")) { // DARK if (isEnabled) { return((SolidColorBrush)Application.Current.Resources["DarkForegroundBrush"]); } else { return((SolidColorBrush)Application.Current.Resources["DarkForegroundDisabledBrush"]); } } else { // LIGHT if (isEnabled) { return((SolidColorBrush)Application.Current.Resources["LightForegroundBrush"]); } else { return((SolidColorBrush)Application.Current.Resources["LightForegroundDisabledBrush"]); } } }
public static void InitializeTheme() { // Get system theme. var defaultTheme = new Windows.UI.ViewManagement.UISettings(); var uiTheme = defaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString(); // Set app settings accordingly. if (uiTheme == "#FF000000") { Windows.Storage.ApplicationData.Current.LocalSettings.Values["systemThemeSetting"] = 1; } else if (uiTheme == "#FFFFFFFF") { Windows.Storage.ApplicationData.Current.LocalSettings.Values["systemThemeSetting"] = 0; } // Check if user has set a theme pref in the app object userThemeValue = Windows.Storage.ApplicationData.Current.LocalSettings.Values["userThemeSetting"]; if (userThemeValue != null) { // If so, apply theme choice. Application.Current.RequestedTheme = (ApplicationTheme)(int)userThemeValue; } else { // Otherwise, use system theme. object sysThemeValue = Windows.Storage.ApplicationData.Current.LocalSettings.Values["systemThemeSetting"]; Application.Current.RequestedTheme = (ApplicationTheme)(int)sysThemeValue; } }
public static bool IsAccentColorDark() { var uiSettings = new Windows.UI.ViewManagement.UISettings(); var c = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Accent); var isDark = (5 * c.G + 2 * c.R + c.B) <= 8 * 128; return(isDark); }
private void ViewModelOnOpenWebView(string html, int id) { _currentId = id; var uiSettings = new Windows.UI.ViewManagement.UISettings(); var color = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Accent); var color1 = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.AccentDark2); var color2 = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.AccentLight2); var css = Css.Replace("AccentColourBase", "#" + color.ToString().Substring(3)). Replace("AccentColourLight", "#" + color2.ToString().Substring(3)). Replace("AccentColourDark", "#" + color1.ToString().Substring(3)) .Replace("BodyBackgroundThemeColor", Settings.SelectedTheme == ApplicationTheme.Dark ? "#2d2d2d" : "#e6e6e6") .Replace("BodyForegroundThemeColor", Settings.SelectedTheme == ApplicationTheme.Dark ? "white" : "black").Replace( "HorizontalSeparatorColor", Settings.SelectedTheme == ApplicationTheme.Dark ? "#0d0d0d" : "#b3b3b3"); ArticleWebView.NavigateToString(css + Begin + html + "</div></body></html>"); }
public static bool IsDarkTheme() { var selectedTheme = SettingsRepository <GeneralSettings> .GetInstance(settingsUtils).SettingsConfig.Theme.ToUpper(CultureInfo.InvariantCulture); var defaultTheme = new Windows.UI.ViewManagement.UISettings(); var uiTheme = defaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString(System.Globalization.CultureInfo.InvariantCulture); return(selectedTheme == "DARK" || (selectedTheme == "SYSTEM" && uiTheme == "#FF000000")); }
/// <summary> /// Check wat is the current system theme and set it to the opposite /// </summary> private void SystemTheme() { var DefaultTheme = new Windows.UI.ViewManagement.UISettings(); var uiTheme = DefaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString(); ElementTheme systemTheme = (uiTheme != "FF000000") ? ElementTheme.Light : ElementTheme.Dark; GlobalSettings.appTheme = systemTheme; themeDefaultRadio.IsChecked = true; SetTheme(GlobalSettings.appTheme); }
public App() { this.InitializeComponent(); exceptionDialog = new Dialogs.ExceptionDialog(); this.Suspending += OnSuspending; this.UnhandledException += App_UnhandledException; AppCenter.Start("682666d1-51d3-4e4a-93d0-d028d43baaa0", typeof(Analytics), typeof(Crashes)); Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; if (localSettings.Values["theme"] == null) { localSettings.Values["theme"] = "Default"; } if (localSettings.Values["datetimeformat"] == null) { localSettings.Values["datetimeformat"] = "Application"; } if (localSettings.Values["theme"] != null) { if (localSettings.Values["theme"].ToString() == "Light") { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Light; //Debug.WriteLine("Theme Requested as Light"); } else if (localSettings.Values["theme"].ToString() == "Dark") { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Dark; //Debug.WriteLine("Theme Requested as Dark"); } else { var uiSettings = new Windows.UI.ViewManagement.UISettings(); var color = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background); if (color == Colors.White) { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Light; // Debug.WriteLine("Theme Requested as Default (Light)"); } else { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Dark; //Debug.WriteLine("Theme Requested as Default (Dark)"); } } } this.RequestedTheme = SettingsPages.Personalization.TV.ThemeValue; //Debug.WriteLine("!!Requested Theme!!" + RequestedTheme.ToString()); }
private void ViewModelOnOpenWebView(string html, MalNewsUnitModel item) { //BackNav ViewModelLocator.NavMgr.RegisterBackNav(PageIndex.PageArticles, item.Type == MalNewsType.Article ? MalArticlesPageNavigationArgs.Articles : MalArticlesPageNavigationArgs.News); // _currentId = ViewModel.Articles.IndexOf(item); var uiSettings = new Windows.UI.ViewManagement.UISettings(); var color = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Accent); var color1 = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.AccentDark2); var color2 = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.AccentLight2); var css = Css.Replace("AccentColourBase", "#" + color.ToString().Substring(3)). Replace("AccentColourLight", "#" + color2.ToString().Substring(3)). Replace("AccentColourDark", "#" + color1.ToString().Substring(3)) .Replace("BodyBackgroundThemeColor", Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "#2d2d2d" : "#e6e6e6") .Replace("BodyForegroundThemeColor", Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "white" : "black").Replace( "HorizontalSeparatorColor", Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "#0d0d0d" : "#b3b3b3"); ArticleWebView.NavigateToString(css + Begin + html + "</div></body></html>"); }
public object Convert(object value, Type targetType, object parameter, string language) { bool t = (bool)value; if (t) //return new SolidColorBrush(Windows.UI.ViewManagement.UIColorType.Accent); { Windows.UI.ViewManagement.UISettings uISettings = new Windows.UI.ViewManagement.UISettings(); return(new SolidColorBrush(uISettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Accent))); } else { return(new SolidColorBrush(Colors.White)); } }
private static string GetDefaulTheme() { string defaultWinTheme = string.Empty; var DefaultTheme = new Windows.UI.ViewManagement.UISettings(); var uiTheme = DefaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString(); if (uiTheme == "#FF000000") { defaultWinTheme = "Dark"; } else if (uiTheme == "#FFFFFFFF") { defaultWinTheme = "Light"; } return(defaultWinTheme); }
public App() { this.InitializeComponent(); this.Suspending += OnSuspending; this.UnhandledException += App_UnhandledException; Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; if (localSettings.Values["theme"] == null) { localSettings.Values["theme"] = "Default"; } if (localSettings.Values["theme"] != null) { if (localSettings.Values["theme"].ToString() == "Light") { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Light; Debug.WriteLine("Theme Requested as Light"); } else if (localSettings.Values["theme"].ToString() == "Dark") { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Dark; Debug.WriteLine("Theme Requested as Dark"); } else { var uiSettings = new Windows.UI.ViewManagement.UISettings(); var color = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background); if (color == Colors.White) { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Light; Debug.WriteLine("Theme Requested as Default (Light)"); } else { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Dark; Debug.WriteLine("Theme Requested as Default (Dark)"); } } } this.RequestedTheme = SettingsPages.Personalization.TV.ThemeValue; Debug.WriteLine("!!Requested Theme!!" + RequestedTheme.ToString()); }
/// <summary> /// Инициализирует одноэлементный объект приложения. Это первая выполняемая строка разрабатываемого /// кода; поэтому она является логическим эквивалентом main() или WinMain(). /// </summary> public App() { var uiSettings = new Windows.UI.ViewManagement.UISettings(); Color color = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background); //System.Diagnostics.Debug.WriteLine("color:" + color.ToString()); if (color.ToString() == "#FF000000") { this.RequestedTheme = ApplicationTheme.Dark; } else { this.RequestedTheme = ApplicationTheme.Light; } //ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; //localSettings.Values.Clear(); this.InitializeComponent(); this.Suspending += OnSuspending; }
private Windows.UI.Xaml.ElementTheme GetAppTheme() { var appTheme = Windows.UI.Xaml.ElementTheme.Default; var savedTheme = Windows.Storage.ApplicationData.Current.LocalSettings.Values["theme"]?.ToString(); if (!string.IsNullOrEmpty(savedTheme)) { Enum.TryParse(savedTheme, out appTheme); } if (appTheme == Windows.UI.Xaml.ElementTheme.Default) { var settings = new Windows.UI.ViewManagement.UISettings(); appTheme = settings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString() switch { "#FFFFFFFF" => Windows.UI.Xaml.ElementTheme.Light, "#FF000000" => Windows.UI.Xaml.ElementTheme.Dark, _ => Windows.UI.Xaml.ElementTheme.Default // Unknown theme }; } return(appTheme); }
private void SetPropertiesFromLocalSettings() { if (localSettings.Values["theme"] == null) { localSettings.Values["theme"] = "Default"; } if (localSettings.Values["datetimeformat"] == null) { localSettings.Values["datetimeformat"] = "Application"; } if (localSettings.Values["theme"] != null) { if (localSettings.Values["theme"].ToString() == "Light") { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Light; } else if (localSettings.Values["theme"].ToString() == "Dark") { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Dark; } else { var uiSettings = new Windows.UI.ViewManagement.UISettings(); var color = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background); if (color == Colors.White) { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Light; } else { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Dark; } } } this.RequestedTheme = SettingsPages.Personalization.TV.ThemeValue; }
public object Convert(object value, Type targetType, object parameter, string language) { bool isEnabled = (bool)value; var defaultTheme = new Windows.UI.ViewManagement.UISettings(); // Using InvariantCulture as this is an internal string and expected to be in hexadecimal var uiTheme = defaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString(CultureInfo.InvariantCulture); // Normalize strings to uppercase according to Fxcop selectedTheme = SettingsRepository <GeneralSettings> .GetInstance(settingsUtils).SettingsConfig.Theme.ToUpperInvariant(); if (selectedTheme == "DARK" || (selectedTheme == "SYSTEM" && uiTheme == "#FF000000")) { // DARK if (isEnabled) { return((SolidColorBrush)Application.Current.Resources["DarkForegroundBrush"]); } else { return((SolidColorBrush)Application.Current.Resources["DarkForegroundDisabledBrush"]); } } else { // LIGHT if (isEnabled) { return((SolidColorBrush)Application.Current.Resources["LightForegroundBrush"]); } else { return((SolidColorBrush)Application.Current.Resources["LightForegroundDisabledBrush"]); } } }
private void ViewModelOnOpenWebView(string html,int id) { //BackNav ViewModelLocator.NavMgr.RegisterBackNav(PageIndex.PageArticles, ViewModel.Articles[id].Type == MalNewsType.Article ? MalArticlesPageNavigationArgs.Articles : MalArticlesPageNavigationArgs.News); // _currentId = id; var uiSettings = new Windows.UI.ViewManagement.UISettings(); var color = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Accent); var color1 = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.AccentDark2); var color2 = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.AccentLight2); var css = Css.Replace("AccentColourBase", "#" + color.ToString().Substring(3)). Replace("AccentColourLight", "#" + color2.ToString().Substring(3)). Replace("AccentColourDark", "#" + color1.ToString().Substring(3)) .Replace("BodyBackgroundThemeColor", Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "#2d2d2d" : "#e6e6e6") .Replace("BodyForegroundThemeColor", Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "white" : "black").Replace( "HorizontalSeparatorColor", Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "#0d0d0d" : "#b3b3b3"); ArticleWebView.NavigateToString(css + Begin + html + "</div></body></html>"); }
private void GetTheme() { _systemTheme = new Windows.UI.ViewManagement.UISettings(); _uiTheme = _systemTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString(); _appTheme = ThemeSelectorService.Theme; }
public App() { this.InitializeComponent(); exceptionDialog = new Dialogs.ExceptionDialog(); this.Suspending += OnSuspending; this.UnhandledException += App_UnhandledException; AppCenter.Start("682666d1-51d3-4e4a-93d0-d028d43baaa0", typeof(Analytics), typeof(Crashes)); Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; if (localSettings.Values["theme"] == null) { localSettings.Values["theme"] = "Default"; } if (localSettings.Values["datetimeformat"] == null) { localSettings.Values["datetimeformat"] = "Application"; } if (localSettings.Values["theme"] != null) { if (localSettings.Values["theme"].ToString() == "Light") { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Light; } else if (localSettings.Values["theme"].ToString() == "Dark") { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Dark; } else { var uiSettings = new Windows.UI.ViewManagement.UISettings(); var color = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background); if (color == Colors.White) { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Light; } else { SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Dark; } } } this.RequestedTheme = SettingsPages.Personalization.TV.ThemeValue; if (localSettings.Values["FavoritesDisplayed_Start"] == null) { localSettings.Values["FavoritesDisplayed_Start"] = true; } if (localSettings.Values["RecentsDisplayed_Start"] == null) { localSettings.Values["RecentsDisplayed_Start"] = true; } if (localSettings.Values["DrivesDisplayed_Start"] == null) { localSettings.Values["DrivesDisplayed_Start"] = false; } if (localSettings.Values["FavoritesDisplayed_NewTab"] == null) { localSettings.Values["FavoritesDisplayed_NewTab"] = true; } if (localSettings.Values["RecentsDisplayed_NewTab"] == null) { localSettings.Values["RecentsDisplayed_NewTab"] = true; } if (localSettings.Values["DrivesDisplayed_NewTab"] == null) { localSettings.Values["DrivesDisplayed_NewTab"] = false; } PopulatePinnedSidebarItems(); }
private void LoadUI() { //主题 cbTheme.SelectedIndex = SettingHelper.GetValue <int>(SettingHelper.UI.THEME, 0); cbTheme.Loaded += new RoutedEventHandler((sender, e) => { cbTheme.SelectionChanged += new SelectionChangedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.THEME, cbTheme.SelectedIndex); Frame rootFrame = Window.Current.Content as Frame; switch (cbTheme.SelectedIndex) { case 1: rootFrame.RequestedTheme = ElementTheme.Light; break; case 2: rootFrame.RequestedTheme = ElementTheme.Dark; break; default: rootFrame.RequestedTheme = ElementTheme.Default; break; } App.ExtendAcrylicIntoTitleBar(); }); }); cbColor.SelectedIndex = SettingHelper.GetValue <int>(SettingHelper.UI.THEME_COLOR, 0); cbColor.Loaded += new RoutedEventHandler((sender, e) => { cbColor.SelectionChanged += new SelectionChangedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.THEME_COLOR, cbColor.SelectedIndex); Color color = new Color(); if (cbColor.SelectedIndex == 0) { var uiSettings = new Windows.UI.ViewManagement.UISettings(); color = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Accent); } else { color = Utils.ToColor((cbColor.SelectedItem as AppThemeColor).color); } (Application.Current.Resources["SystemControlHighlightAltAccentBrush"] as SolidColorBrush).Color = color; (Application.Current.Resources["SystemControlHighlightAccentBrush"] as SolidColorBrush).Color = color; //(App.Current.Resources.ThemeDictionaries["Light"] as ResourceDictionary)["SystemAccentColor"] = Utils.ToColor(item.color); }); }); //显示模式 cbDisplayMode.SelectedIndex = SettingHelper.GetValue <int>(SettingHelper.UI.DISPLAY_MODE, 0); cbDisplayMode.Loaded += new RoutedEventHandler((sender, e) => { cbDisplayMode.SelectionChanged += new SelectionChangedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.DISPLAY_MODE, cbDisplayMode.SelectedIndex); if (cbDisplayMode.SelectedIndex == 2) { Utils.ShowMessageToast("多窗口模式正在开发测试阶段,可能会有一堆问题"); } else { Utils.ShowMessageToast("重启生效"); } }); }); //加载原图 swPictureQuality.IsOn = SettingHelper.GetValue <bool>(SettingHelper.UI.ORTGINAL_IMAGE, false); swPictureQuality.Loaded += new RoutedEventHandler((sender, e) => { swPictureQuality.Toggled += new RoutedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.ORTGINAL_IMAGE, swPictureQuality.IsOn); SettingHelper.UI._loadOriginalImage = null; }); }); //缓存页面 swHomeCache.IsOn = SettingHelper.GetValue <bool>(SettingHelper.UI.CACHE_HOME, true); swHomeCache.Loaded += new RoutedEventHandler((sender, e) => { swHomeCache.Toggled += new RoutedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.CACHE_HOME, swHomeCache.IsOn); }); }); //右侧详情宽度 numRightWidth.Value = SettingHelper.GetValue <double>(SettingHelper.UI.RIGHT_DETAIL_WIDTH, 320); numRightWidth.Loaded += new RoutedEventHandler((sender, e) => { numRightWidth.ValueChanged += new TypedEventHandler <NumberBox, NumberBoxValueChangedEventArgs>((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.RIGHT_DETAIL_WIDTH, args.NewValue); }); }); //图片圆角半径 numImageCornerRadius.Value = SettingHelper.GetValue <double>(SettingHelper.UI.IMAGE_CORNER_RADIUS, 0); ImageCornerRadiusExample.CornerRadius = new CornerRadius(numImageCornerRadius.Value); numImageCornerRadius.Loaded += new RoutedEventHandler((sender, e) => { numImageCornerRadius.ValueChanged += new TypedEventHandler <NumberBox, NumberBoxValueChangedEventArgs>((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.IMAGE_CORNER_RADIUS, args.NewValue); ImageCornerRadiusExample.CornerRadius = new CornerRadius(args.NewValue); App.Current.Resources["ImageCornerRadius"] = new CornerRadius(args.NewValue); }); }); //显示视频封面 swVideoDetailShowCover.IsOn = SettingHelper.GetValue <bool>(SettingHelper.UI.SHOW_DETAIL_COVER, true); swVideoDetailShowCover.Loaded += new RoutedEventHandler((sender, e) => { swVideoDetailShowCover.Toggled += new RoutedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.SHOW_DETAIL_COVER, swVideoDetailShowCover.IsOn); }); }); //新窗口浏览图片 swPreviewImageOpenNewWindow.IsOn = SettingHelper.GetValue <bool>(SettingHelper.UI.NEW_WINDOW_PREVIEW_IMAGE, false); swPreviewImageOpenNewWindow.Loaded += new RoutedEventHandler((sender, e) => { swPreviewImageOpenNewWindow.Toggled += new RoutedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.NEW_WINDOW_PREVIEW_IMAGE, swPreviewImageOpenNewWindow.IsOn); }); }); //鼠标侧键返回 swMouseClosePage.IsOn = SettingHelper.GetValue <bool>(SettingHelper.UI.MOUSE_BACK, true); swMouseClosePage.Loaded += new RoutedEventHandler((sender, e) => { swMouseClosePage.Toggled += new RoutedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.MOUSE_BACK, swMouseClosePage.IsOn); }); }); //隐藏赞助图标 swHideSponsor.IsOn = SettingHelper.GetValue <bool>(SettingHelper.UI.HIDE_SPONSOR, false); swHideSponsor.Loaded += new RoutedEventHandler((sender, e) => { swHideSponsor.Toggled += new RoutedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.HIDE_SPONSOR, swHideSponsor.IsOn); }); }); //动态显示 cbDetailDisplay.SelectedIndex = SettingHelper.GetValue <int>(SettingHelper.UI.DETAIL_DISPLAY, 0); cbDetailDisplay.Loaded += new RoutedEventHandler((sender, e) => { cbDetailDisplay.SelectionChanged += new SelectionChangedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.DETAIL_DISPLAY, cbDetailDisplay.SelectedIndex); }); }); //动态显示 cbDynamicDisplayMode.SelectedIndex = SettingHelper.GetValue <int>(SettingHelper.UI.DYNAMIC_DISPLAY_MODE, 0); cbDynamicDisplayMode.Loaded += new RoutedEventHandler((sender, e) => { cbDynamicDisplayMode.SelectionChanged += new SelectionChangedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.DYNAMIC_DISPLAY_MODE, cbDynamicDisplayMode.SelectedIndex); }); }); //推荐显示 cbRecommendDisplayMode.SelectedIndex = SettingHelper.GetValue <int>(SettingHelper.UI.RECMEND_DISPLAY_MODE, 0); cbRecommendDisplayMode.Loaded += new RoutedEventHandler((sender, e) => { cbRecommendDisplayMode.SelectionChanged += new SelectionChangedEventHandler((obj, args) => { SettingHelper.SetValue(SettingHelper.UI.RECMEND_DISPLAY_MODE, cbRecommendDisplayMode.SelectedIndex); }); }); gridHomeCustom.ItemsSource = SettingHelper.GetValue <ObservableCollection <HomeNavItem> >(SettingHelper.UI.HOEM_ORDER, HomeVM.GetAllNavItems()); ExceptHomeNavItems(); }