예제 #1
0
        private void LoadFromRegistry(RegistryKey reg)
        {
            Debug.Assert(reg != null, "reg cannot be null");

            lock (_Themes) {
                _Themes.Clear();
                DefaultTheme = new IndentTheme();
                foreach (var themeName in reg.GetSubKeyNames())
                {
                    if (CARETHANDLERS_SUBKEY_NAME.Equals(themeName, StringComparison.InvariantCulture))
                    {
                        continue;
                    }
                    var theme = IndentTheme.Load(reg, themeName);
                    if (theme.IsDefault)
                    {
                        DefaultTheme = theme;
                    }
                    else
                    {
                        _Themes[theme.ContentType] = theme;
                    }
                }

                Visible = (int)reg.GetValue("Visible", 1) != 0;
            }

            OnThemesChanged();
        }
예제 #2
0
        public void Load(IVsSettingsReader reader)
        {
            lock (_Themes) {
                _Themes.Clear();
                DefaultTheme = new IndentTheme();

                string themeKeysString;
                reader.ReadSettingString("Themes", out themeKeysString);

                foreach (var key in themeKeysString.Split(';'))
                {
                    if (string.IsNullOrWhiteSpace(key))
                    {
                        continue;
                    }

                    try {
                        var theme = IndentTheme.Load(reader, key);
                        if (theme.IsDefault)
                        {
                            DefaultTheme = theme;
                        }
                        else
                        {
                            _Themes[theme.ContentType] = theme;
                        }
                    } catch (Exception ex) {
                        Trace.WriteLine(string.Format("IndentGuide::LoadSettingsFromXML: {0}", ex));
                    }
                }

                int tempInt;
                reader.ReadSettingLong("Visible", out tempInt);
                Visible = (tempInt != 0);
            }

            OnThemesChanged();
        }