示例#1
0
        public static AppSettings LoadSettings()
        {
#if JSON
            MainSettings = AppSettings.Load();
            Properties.Settings.Default["DefaulAppTheme"] = MainSettings.ThemeColor;
            Properties.Settings.Default.Save();
            return(MainSettings);
#endif
#if REGEDIT
            var colorTheme    = (ColorThemes)Regedit.GetInt32("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\Continent", "ThemeColor", 2);
            var updateChannel = (UpdateChannel)Regedit.GetInt32("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\Continent", "UpdateChannel", 1);
            var doNotShow     = Regedit.GetInt32("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\Continent", "DoNotShow", 0);
            var version       = Regedit.GetString("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\Continent", "LastVersion", Constants.AppVersion);

            MainSettings.ThemeColor    = colorTheme != 0 ? colorTheme : ColorThemes.Light;
            MainSettings.UpdateChannel = updateChannel != 0 ? updateChannel : UpdateChannel.Stable;
            MainSettings.DoNotShow     = doNotShow != 0;
            MainSettings.LastVersion   = version;

            Properties.Settings.Default["DefaulAppTheme"] = MainSettings.ThemeColor;
            Properties.Settings.Default.Save();

            return(MainSettings);
#endif
        }