예제 #1
0
        public bool GetCurrentTheme(out Guid themeGuid)
        {
            if (VSVersion.VS2013OrLater)
            {
                return(GetThemeViaApi(out themeGuid));
            }
            else
            {
                IAnkhConfigurationService config = GetService <IAnkhConfigurationService>();
                themeGuid = Guid.Empty;

                if (config == null)
                {
                    return(false);
                }

                string currentTheme;

                using (RegistryKey rk = config.OpenVSUserKey("General"))
                {
                    if (rk != null)
                    {
                        currentTheme = rk.GetValue("CurrentTheme") as string;
                    }
                    else
                    {
                        currentTheme = null;
                    }
                }

                try
                {
                    if (!string.IsNullOrEmpty(currentTheme))
                    {
                        themeGuid = new Guid(currentTheme);
                        return(true);
                    }
                }
                catch { }
                {
                    currentTheme = null;
                }

                return(true);
            }
        }
예제 #2
0
        /// <include file='doc\PropertySheet.uex' path='docs/doc[@for="LanguagePreferences.Init"]/*' />
        public virtual void Init()
        {
            IAnkhConfigurationService configService = GetService <IAnkhConfigurationService>();

            if (configService != null)
            {
                using (RegistryKey key = configService.OpenVSInstanceKey(null))
                {
                    if (key != null)
                    {
                        InitMachinePreferences(key, name);
                    }
                }
                using (RegistryKey key = configService.OpenVSUserKey(null))
                {
                    if (key != null)
                    {
                        InitUserPreferences(key, name);
                    }
                }
            }
            Connect();
        }