Esempio n. 1
0
        private void BindSettings()
        {
            _FilenameColor = settings.FilenameColor;
            _FoldersColor  = settings.FoldersColor;
            _ProjectColor  = settings.ProjectColor;

            _FilenameSize = settings.FilenameSize;
            _FoldersSize  = settings.FoldersSize;
            _ProjectSize  = settings.ProjectSize;

            _ViewFilename = settings.ViewFilename;
            _ViewFolders  = settings.ViewFolders;
            _ViewProject  = settings.ViewProject;

            _Position = settings.Position;
            _Opacity  = settings.Opacity;
        }
Esempio n. 2
0
        private void LoadSettings()
        {
            // Default values
            var lightTheme = WhereAmISettings.LightThemeDefaults();

            FilenameSize = lightTheme.FilenameSize;
            FoldersSize  = ProjectSize = lightTheme.FoldersSize;

            FilenameColor = lightTheme.FilenameColor;
            FoldersColor  = ProjectColor = lightTheme.FoldersColor;

            Position = lightTheme.Position;

            Opacity      = lightTheme.Opacity;
            ViewFilename = ViewFolders = ViewProject = lightTheme.ViewFilename;
            Theme        = lightTheme.Theme;

            try
            {
                // Retrieve the Id of the current theme used in VS from user's settings, this is changed a lot in VS2015
                string visualStudioThemeId = VSRegistry.RegistryRoot(Microsoft.VisualStudio.Shell.Interop.__VsLocalRegistryType.RegType_UserSettings).OpenSubKey("ApplicationPrivateSettings").OpenSubKey("Microsoft").OpenSubKey("VisualStudio").GetValue("ColorTheme", "de3dbbcd-f642-433c-8353-8f1df4370aba", Microsoft.Win32.RegistryValueOptions.DoNotExpandEnvironmentNames).ToString();

                string parsedThemeId = "";
                if (visualStudioThemeId.Contains("*"))
                {
                    parsedThemeId = Guid.Parse(visualStudioThemeId.Split('*')[2]).ToString();
                }
                else
                {
                    parsedThemeId = Guid.Parse(visualStudioThemeId).ToString();
                }

                switch (parsedThemeId)
                {
                case Constants.VisualStudioLightThemeId:    // Light
                case Constants.VisualStudioBlueThemeId:     // Blue
                default:
                    // Just use the defaults
                    break;

                case Constants.VisualStudioDarkThemeId:     // Dark
                    var darkTheme = WhereAmISettings.DarkThemeDefaults();
                    FilenameSize = darkTheme.FilenameSize;
                    FoldersSize  = ProjectSize = darkTheme.FoldersSize;

                    FilenameColor = darkTheme.FilenameColor;
                    FoldersColor  = ProjectColor = darkTheme.FoldersColor;

                    Position = darkTheme.Position;

                    Opacity      = darkTheme.Opacity;
                    ViewFilename = ViewFolders = ViewProject = darkTheme.ViewFilename;
                    Theme        = darkTheme.Theme;
                    break;
                }

                // Tries to retrieve the configurations if previously saved
                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "FilenameColor"))
                {
                    this.FilenameColor = Color.FromArgb(writableSettingsStore.GetInt32(Constants.SettingsCollectionPath, "FilenameColor", this.FilenameColor.ToArgb()));
                }

                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "FoldersColor"))
                {
                    this.FoldersColor = Color.FromArgb(writableSettingsStore.GetInt32(Constants.SettingsCollectionPath, "FoldersColor", this.FoldersColor.ToArgb()));
                }

                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "ProjectColor"))
                {
                    this.ProjectColor = Color.FromArgb(writableSettingsStore.GetInt32(Constants.SettingsCollectionPath, "ProjectColor", this.ProjectColor.ToArgb()));
                }

                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "ViewFilename"))
                {
                    bool b = this.ViewFilename;
                    if (Boolean.TryParse(writableSettingsStore.GetString(Constants.SettingsCollectionPath, "ViewFilename"), out b))
                    {
                        this.ViewFilename = b;
                    }
                }

                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "ViewFolders"))
                {
                    bool b = this.ViewFolders;
                    if (Boolean.TryParse(writableSettingsStore.GetString(Constants.SettingsCollectionPath, "ViewFolders"), out b))
                    {
                        this.ViewFolders = b;
                    }
                }

                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "ViewProject"))
                {
                    bool b = this.ViewProject;
                    if (Boolean.TryParse(writableSettingsStore.GetString(Constants.SettingsCollectionPath, "ViewProject"), out b))
                    {
                        this.ViewProject = b;
                    }
                }

                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "FilenameSize"))
                {
                    double d = this.FilenameSize;
                    if (Double.TryParse(writableSettingsStore.GetString(Constants.SettingsCollectionPath, "FilenameSize"), out d))
                    {
                        this.FilenameSize = d;
                    }
                }

                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "FoldersSize"))
                {
                    double d = this.FoldersSize;
                    if (Double.TryParse(writableSettingsStore.GetString(Constants.SettingsCollectionPath, "FoldersSize"), out d))
                    {
                        this.FoldersSize = d;
                    }
                }

                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "ProjectSize"))
                {
                    double d = this.ProjectSize;
                    if (Double.TryParse(writableSettingsStore.GetString(Constants.SettingsCollectionPath, "ProjectSize"), out d))
                    {
                        this.ProjectSize = d;
                    }
                }

                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "Position"))
                {
                    AdornmentPositions p = this.Position;
                    if (Enum.TryParse <AdornmentPositions>(writableSettingsStore.GetString(Constants.SettingsCollectionPath, "Position"), out p))
                    {
                        this.Position = p;
                    }
                }

                if (writableSettingsStore.PropertyExists(Constants.SettingsCollectionPath, "Opacity"))
                {
                    double d = this.Opacity;
                    if (Double.TryParse(writableSettingsStore.GetString(Constants.SettingsCollectionPath, "Opacity"), out d))
                    {
                        this.Opacity = d;
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.Message);
            }
        }
Esempio n. 3
0
        private void LoadSettings()
        {
            // Default values
            _FilenameSize = 60;
            _FoldersSize = _ProjectSize = 52;

            _FilenameColor = Color.FromArgb(234, 234, 234);
            _FoldersColor = _ProjectColor = Color.FromArgb(243, 243, 243);

            _Position = AdornmentPositions.TopRight;

            _Opacity = 1;

            try
            {
                // Retrieve the Id of the current theme used in VS from user's settings, this is changed a lot in VS2015
                string visualStudioThemeId = VSRegistry.RegistryRoot(Microsoft.VisualStudio.Shell.Interop.__VsLocalRegistryType.RegType_UserSettings).OpenSubKey("ApplicationPrivateSettings").OpenSubKey("Microsoft").OpenSubKey("VisualStudio").GetValue("ColorTheme", "de3dbbcd-f642-433c-8353-8f1df4370aba", Microsoft.Win32.RegistryValueOptions.DoNotExpandEnvironmentNames).ToString();

                string parsedThemeId = Guid.Parse(visualStudioThemeId.Split('*')[2]).ToString();

                switch (parsedThemeId)
                {
                    case "de3dbbcd-f642-433c-8353-8f1df4370aba": // Light
                    case "a4d6a176-b948-4b29-8c66-53c97a1ed7d0": // Blue
                    default:
                        // Just use the defaults
                        break;

                    case "1ded0138-47ce-435e-84ef-9ec1f439b749": // Dark
                        _FilenameColor = Color.FromArgb(48, 48, 48);
                        _FoldersColor = _ProjectColor = Color.FromArgb(40, 40, 40);
                        break;
                }

                // Tries to retrieve the configurations if previously saved
                if (writableSettingsStore.PropertyExists(CollectionPath, "FilenameColor"))
                {
                    this.FilenameColor = Color.FromArgb(writableSettingsStore.GetInt32(CollectionPath, "FilenameColor", this.FilenameColor.ToArgb()));
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "FoldersColor"))
                {
                    this.FoldersColor = Color.FromArgb(writableSettingsStore.GetInt32(CollectionPath, "FoldersColor", this.FoldersColor.ToArgb()));
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "ProjectColor"))
                {
                    this.ProjectColor = Color.FromArgb(writableSettingsStore.GetInt32(CollectionPath, "ProjectColor", this.ProjectColor.ToArgb()));
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "ViewFilename"))
                {
                    bool b = this.ViewFilename;
                    if (Boolean.TryParse(writableSettingsStore.GetString(CollectionPath, "ViewFilename"), out b))
                        this.ViewFilename = b;
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "ViewFolders"))
                {
                    bool b = this.ViewFolders;
                    if (Boolean.TryParse(writableSettingsStore.GetString(CollectionPath, "ViewFolders"), out b))
                        this.ViewFolders = b;
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "ViewProject"))
                {
                    bool b = this.ViewProject;
                    if (Boolean.TryParse(writableSettingsStore.GetString(CollectionPath, "ViewProject"), out b))
                        this.ViewProject = b;
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "FilenameSize"))
                {
                    double d = this.FilenameSize;
                    if (Double.TryParse(writableSettingsStore.GetString(CollectionPath, "FilenameSize"), out d))
                        this.FilenameSize = d;
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "FoldersSize"))
                {
                    double d = this.FoldersSize;
                    if (Double.TryParse(writableSettingsStore.GetString(CollectionPath, "FoldersSize"), out d))
                        this.FoldersSize = d;
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "ProjectSize"))
                {
                    double d = this.ProjectSize;
                    if (Double.TryParse(writableSettingsStore.GetString(CollectionPath, "ProjectSize"), out d))
                        this.ProjectSize = d;
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "Position"))
                {
                    AdornmentPositions p = this.Position;
                    if (Enum.TryParse<AdornmentPositions>(writableSettingsStore.GetString(CollectionPath, "Position"), out p))
                        this.Position = p;
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "Opacity"))
                {
                    double d = this.Opacity;
                    if (Double.TryParse(writableSettingsStore.GetString(CollectionPath, "Opacity"), out d))
                        this.Opacity = d;
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.Message);
            }
        }
Esempio n. 4
0
        private void LoadSettings()
        {
            // Default values
            _FilenameSize = 60;
            _FoldersSize  = _ProjectSize = 52;

            _FilenameColor = Color.FromArgb(234, 234, 234);
            _FoldersColor  = _ProjectColor = Color.FromArgb(243, 243, 243);

            _Position = AdornmentPositions.TopRight;

            _Opacity = 1;

            try
            {
                // Retrieve the Id of the current theme used in VS from user's settings, this is changed a lot in VS2015
                string visualStudioThemeId = VSRegistry.RegistryRoot(Microsoft.VisualStudio.Shell.Interop.__VsLocalRegistryType.RegType_UserSettings).OpenSubKey("ApplicationPrivateSettings").OpenSubKey("Microsoft").OpenSubKey("VisualStudio").GetValue("ColorTheme", "de3dbbcd-f642-433c-8353-8f1df4370aba", Microsoft.Win32.RegistryValueOptions.DoNotExpandEnvironmentNames).ToString();

                string parsedThemeId = Guid.Parse(visualStudioThemeId.Split('*')[2]).ToString();

                switch (parsedThemeId)
                {
                case "de3dbbcd-f642-433c-8353-8f1df4370aba":     // Light
                case "a4d6a176-b948-4b29-8c66-53c97a1ed7d0":     // Blue
                default:
                    // Just use the defaults
                    break;

                case "1ded0138-47ce-435e-84ef-9ec1f439b749":     // Dark
                    _FilenameColor = Color.FromArgb(48, 48, 48);
                    _FoldersColor  = _ProjectColor = Color.FromArgb(40, 40, 40);
                    break;
                }

                // Tries to retrieve the configurations if previously saved
                if (writableSettingsStore.PropertyExists(CollectionPath, "FilenameColor"))
                {
                    this.FilenameColor = Color.FromArgb(writableSettingsStore.GetInt32(CollectionPath, "FilenameColor", this.FilenameColor.ToArgb()));
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "FoldersColor"))
                {
                    this.FoldersColor = Color.FromArgb(writableSettingsStore.GetInt32(CollectionPath, "FoldersColor", this.FoldersColor.ToArgb()));
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "ProjectColor"))
                {
                    this.ProjectColor = Color.FromArgb(writableSettingsStore.GetInt32(CollectionPath, "ProjectColor", this.ProjectColor.ToArgb()));
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "ViewFilename"))
                {
                    bool b = this.ViewFilename;
                    if (Boolean.TryParse(writableSettingsStore.GetString(CollectionPath, "ViewFilename"), out b))
                    {
                        this.ViewFilename = b;
                    }
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "ViewFolders"))
                {
                    bool b = this.ViewFolders;
                    if (Boolean.TryParse(writableSettingsStore.GetString(CollectionPath, "ViewFolders"), out b))
                    {
                        this.ViewFolders = b;
                    }
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "ViewProject"))
                {
                    bool b = this.ViewProject;
                    if (Boolean.TryParse(writableSettingsStore.GetString(CollectionPath, "ViewProject"), out b))
                    {
                        this.ViewProject = b;
                    }
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "FilenameSize"))
                {
                    double d = this.FilenameSize;
                    if (Double.TryParse(writableSettingsStore.GetString(CollectionPath, "FilenameSize"), out d))
                    {
                        this.FilenameSize = d;
                    }
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "FoldersSize"))
                {
                    double d = this.FoldersSize;
                    if (Double.TryParse(writableSettingsStore.GetString(CollectionPath, "FoldersSize"), out d))
                    {
                        this.FoldersSize = d;
                    }
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "ProjectSize"))
                {
                    double d = this.ProjectSize;
                    if (Double.TryParse(writableSettingsStore.GetString(CollectionPath, "ProjectSize"), out d))
                    {
                        this.ProjectSize = d;
                    }
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "Position"))
                {
                    AdornmentPositions p = this.Position;
                    if (Enum.TryParse <AdornmentPositions>(writableSettingsStore.GetString(CollectionPath, "Position"), out p))
                    {
                        this.Position = p;
                    }
                }

                if (writableSettingsStore.PropertyExists(CollectionPath, "Opacity"))
                {
                    double d = this.Opacity;
                    if (Double.TryParse(writableSettingsStore.GetString(CollectionPath, "Opacity"), out d))
                    {
                        this.Opacity = d;
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.Message);
            }
        }
        private void BindSettings()
        {
            _FilenameColor = settings.FilenameColor;
            _FoldersColor = settings.FoldersColor;
            _ProjectColor = settings.ProjectColor;

            _FilenameSize = settings.FilenameSize;
            _FoldersSize = settings.FoldersSize;
            _ProjectSize = settings.ProjectSize;

            _ViewFilename = settings.ViewFilename;
            _ViewFolders = settings.ViewFolders;
            _ViewProject = settings.ViewProject;

            _Position = settings.Position;
            _Opacity = settings.Opacity;
        }