public void LoadTheme() { var prop = Settings.LoadSettings().ThemeColor; switch ((ColorThemes)prop) { case ColorThemes.Light: { SetLightTheme(); _appColorThemes = ColorThemes.Light; } break; case ColorThemes.Dark: { SetDarkTheme(); _appColorThemes = ColorThemes.Dark; } break; default: { SetLightTheme(); _appColorThemes = ColorThemes.Light; } break; } }
public SettingsViewModel( IAppSettings appSettings, INavigatorService navigatorService, IUpdateCheck updateCheck, IWindowManager windowManager, IHelpers helpers) : base() { _extensionValidater = new ExtensionValidater(); _navigatorService = navigatorService; _helpers = helpers; _appSettings = appSettings; _windowManager = windowManager; _updateCheck = updateCheck; SetPropeertiesFromAppSettings(); SelectedLanguage = Languages.Where(x => x.Code == _appSettings.Language).FirstOrDefault(); SelectedColorTheme = ColorThemes.Where(x => x.Id == _appSettings.Theme).FirstOrDefault(); CancelSettingsCommand = new RelayCommand(CancelSettings); SaveSettingsCommand = new RelayCommand(SaveSettings); CheckForUpdatesNowCommand = new RelayCommand(CheckForUpdatesNow); RestoreDefaultsCommand = new RelayCommand(RestoreDefaults); RemoveImageExtensionCommand = new RelayParameterizedCommand(item => ImageFileExtensions.Remove((string)item)); OpenAddImageExtensionCommand = new RelayCommand(() => IsAddingImageExtension = true); AddImageEtensionCommand = new RelayCommand(AddImageExtension); CloseImageFileExtensopnPopupCommand = new RelayCommand(() => IsAddingImageExtension = false); }
private void Awake() { EmojiSprites.LoadEmojiSprites(); rewardPanel = FindObjectOfType <RewardPanelScript>(); // If first use if (PlayerPrefs.GetString(FIRST_USE) == "") { ResetPreferences(); PlayerPrefs.SetString(FIRST_USE, "IMDEADINSIDEPLSHELPME"); } expBarScript = FindObjectOfType <ExpBarScript>(); // Color mode currentMode = (ColorMode)Enum.Parse(typeof(ColorMode), PlayerPrefs.GetString(COLOR_MODE)); currentTheme = ColorThemes.GetTheme(PlayerPrefs.GetString(THEME_MODE)); UpdateSignResourceStrgColors(); // Player level playerLevel = PlayerPrefs.GetInt(PLAYER_LEVEL); playerExp = PlayerPrefs.GetInt(PLAYER_EXP); for (int i = 2; i <= maxPlayerLevel; i++) { expNeededForLevel[i] = ExpNeededForLevel(i); } // Unlocks UpdateEmojiUnlocks(); GPAchievements.Init(); }
/// <summary> /// Initializes a new instance of the <see cref="SettingsViewModel"/> class. /// </summary> /// <param name="logger">Logger dependency.</param> /// <param name="localization">Localization provider dependency.</param> /// <param name="options">Surrent settings.</param> /// <param name="settingsService">Settings service dependency.</param> public SettingsViewModel(ILogger logger, ILocalization localization, AppSettings options, SettingsService settingsService) { CultureSelectionChangedCommand = new DelegateCommand(ChangeCulture); this.logger = logger; this.localization = localization; this.options = options; this.settingsService = settingsService; AppThemes = ThemeManager.Current.Themes .GroupBy(x => x.BaseColorScheme) .Select(x => x.First()) .ToList(); ColorThemes = ThemeManager.Current.ColorSchemes.OrderBy(x => x).ToList(); Theme?currentTheme = ThemeManager.Current.DetectTheme(); if (currentTheme != null) { SelectedAppTheme = AppThemes.First(x => x.BaseColorScheme == currentTheme.BaseColorScheme); SelectedColor = ColorThemes.First(x => x == currentTheme.ColorScheme); } ShowLastWeekSuggestion = options.ShowLastWeekSuggestion; }
/// <summary> /// Save the given theme in the settings /// </summary> /// <param name="theme"></param> /// <returns></returns> public bool SaveTheme(ColorThemes theme) { var settingsModel = GetSettings(); settingsModel.Theme = theme; ApplyTheme(); return(SaveSettings(settingsModel)); }
public static void Main() { var appSettings = ConfigurationManager.AppSettings; StaticVariables.Settings.ColorTheme = appSettings.Get("ColorTheme"); StaticVariables.Settings.colors = ColorThemes.GetColors(StaticVariables.Settings.ColorTheme); StaticVariables.Windows.InfinityListen = appSettings.Get("InfnityListen"); StaticVariables.Settings.IgnoreBigLog = Convert.ToBoolean(appSettings.Get("IgnoreBigLog")); }
public static void SaveSettings(ColorThemes colorTheme) { #if JSON MainSettings = AppSettings.Load(); MainSettings.ThemeColor = colorTheme; MainSettings.Save(); #endif #if REGEDIT Regedit.SetValue("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\Continent", "ThemeColor", (int)colorTheme); #endif }
public void ChangeTheme(ColorThemes theme = ColorThemes.NA, bool forceSave = true) { if (theme == ColorThemes.NA) { switch (Settings.LoadSettings().ThemeColor) { case ColorThemes.Light: theme = ColorThemes.Dark; break; case ColorThemes.Dark: theme = ColorThemes.Light; break; } } switch (theme) { case ColorThemes.Light: SetLightTheme(); _appColorThemes = ColorThemes.Light; break; case ColorThemes.Dark: SetDarkTheme(); _appColorThemes = ColorThemes.Dark; break; } //var prop = theme == ColorThemes.NA // ? Settings.LoadSettings().ThemeColor // : theme; //switch ((ColorThemes)prop) //{ // case ColorThemes.Light: // SetDarkTheme(); // _appColorThemes = ColorThemes.Dark; // break; // case ColorThemes.Dark: // SetLightTheme(); // _appColorThemes = ColorThemes.Light; // break; //} if (AppManager != null) { AppManager.ChangeCellsThemes(_appColorThemes); } if (forceSave) { Settings.SaveSettings(_appColorThemes); } }
void Awake() { // We need to do this in awake because in start which lightdark to use will be set // Get the theme currentTheme = ColorThemes.GetTheme(colorThemeName + "Theme"); // Set all children's color which nee dto be set DarkLightColor xDL = transform.GetChild(0).GetComponent <DarkLightColor>(); DarkLightColor oDL = transform.GetChild(1).GetComponent <DarkLightColor>(); xDL.lightModeColor = currentTheme.xColorLight; xDL.darkModeColor = currentTheme.xColorDark; oDL.lightModeColor = currentTheme.oColorLight; oDL.darkModeColor = currentTheme.oColorDark; // Fields image = GetComponent <Image>(); rectTransform = GetComponent <RectTransform>(); eventTrigger = gameObject.AddComponent <EventTrigger>(); colorThemesHandler = transform.parent.GetComponent <ColorThemesUIHandler>(); }
public Settings(Action <ColorThemes> changeTheme, Action <UpdateChannel> changeChannel, ColorThemes themeColor, UpdateChannel updateChannel) { InitializeComponent(); _changeTheme = changeTheme; _changeChannel = changeChannel; //if (themeColor == ColorThemes.Dark) themeBox.SelectedIndex = 1; if (updateChannel == UpdateChannel.Beta) { channelBox.SelectedIndex = 1; } }