Пример #1
0
            /// <summary>
            /// IVsSolutionEvents3.OnAfterOpenSolution is called BEFORE a solution is fully loaded.
            /// This is different from EnvDTE.Events.SolutionEvents.Opened which is loaded after a resolution was loaded due to historical reasons:
            /// In earlier Visual Studio versions there was no asynchronous loading, so a solution was either fully loaded or not at all.
            /// </summary>
            public override int OnAfterOpenSolution(object pUnkReserved, int fNewSolution)
            {
                // Check if we already saved something for this solution.
                string solutionPath = VSUtils.GetCurrentSolutionPath();

                System.Drawing.Color color;
                if (package.Settings.GetSolutionColorSetting(solutionPath, out color))
                {
                    package.SetTitleBarColor(color);
                }
                else if (package.Settings.IsAutomaticColorPickEnabled())
                {
                    color = RandomColorGenerator.RandomColor.GetColor(RandomColorGenerator.ColorScheme.Random, VSUtils.IsUsingDarkTheme() ? RandomColorGenerator.Luminosity.Dark : RandomColorGenerator.Luminosity.Light);
                    package.SetTitleBarColor(color);
                    package.Settings.SaveOrOverwriteSolutionColor(solutionPath, color);
                }

                return(0);
            }
Пример #2
0
        private void Execute(object sender, EventArgs e)
        {
            var dialog = new ColorDialog();

            dialog.AllowFullOpen = true;
            dialog.Color         = package.GetMainTitleBarColor();
            dialog.CustomColors  = package.Settings.GetCustomColorList();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                package.SetTitleBarColor(dialog.Color);
                package.Settings.SaveOrOverwriteSolutionColor(VSUtils.GetCurrentSolutionPath(), dialog.Color);
            }

            package.Settings.SaveCustomColorList(dialog.CustomColors);
        }