コード例 #1
0
        public void ChangeTheme(string themeName)
        {
            string themePath = GetThemePath(themeName);

            if (string.IsNullOrEmpty(themePath))
            {
                themePath = GetThemePath("Dark");
                if (string.IsNullOrEmpty(themePath))
                {
                    throw new System.Exception("Change theme failed");
                }
            }

            UserSettingStorage.Instance.Theme = themeName;
            UserSettingStorage.Instance.Save();

            ResourceMerger.ApplyResources();
        }
コード例 #2
0
        public void ChangeLanguage(Language language)
        {
            if (language == null)
            {
                throw new WoxI18nException("language can't be null");
            }

            string path = GetLanguagePath(language);

            if (string.IsNullOrEmpty(path))
            {
                path = GetLanguagePath(AvailableLanguages.English);
                if (string.IsNullOrEmpty(path))
                {
                    throw new System.Exception("Change Language failed");
                }
            }

            UserSettingStorage.Instance.Language = language.LanguageCode;
            UserSettingStorage.Instance.Save();
            ResourceMerger.ApplyResources();
            UpdateAllPluginMetadataTranslations();
        }