public override void LoadPanelContents()
        {
            InitializeHelper();

            var masterSettingsFile = helper.GetProperty <string>("SourceAnalysisOverrideSettingsFile", "", true);

            if (masterSettingsFile.Length == 0)
            {
                helper.SetProperty <string>("SourceAnalysisOverrideSettingsFile",
                                            StyleCopWrapper.GetMasterSettingsFile(),
                                            true,
                                            PropertyStorageLocations.Base);
            }

            AnalysisProjectOptions po = new AnalysisProjectOptions();

            po.Dock = DockStyle.Fill;
            Controls.Add(po);

            ChooseStorageLocationButton btnEnable;
            ChooseStorageLocationButton btnFileLocation;

            btnEnable       = helper.BindBoolean(po.EnableCheckBox, "RunSourceAnalysis", false).CreateLocationButton(po.EnableCheckBox);
            btnFileLocation = helper.BindString(po.SettingsFileTextBox, "SourceAnalysisOverrideSettingsFile", TextBoxEditMode.EditRawProperty).CreateLocationButton(po.SettingsFileTextBox);
            ConfigurationGuiBinding binding = po.CreateBinding();

            binding.RegisterLocationButton(btnEnable);
            binding.RegisterLocationButton(btnFileLocation);

            helper.AddConfigurationSelector(this);

            po.ModifyStyleCopSettingsButton.Click += ModifyStyleCopSettingsClick;
        }
        void ModifyStyleCopSettingsClick(object sender, EventArgs e)
        {
            var settingsFile = helper.GetProperty <string>("SourceAnalysisOverrideSettingsFile", "", true);

            if (settingsFile == StyleCopWrapper.GetMasterSettingsFile())
            {
                if (ConfirmSwitchFromMaster())
                {
                    settingsFile = CopyFromMaster();
                }
            }

            if (!System.IO.File.Exists(settingsFile))
            {
                if (ConfirmReplaceMissingFile())
                {
                    settingsFile = CopyFromMaster();
                }
                else
                {
                    MessageService.ShowWarning("No settings file found to modify.");
                    return;
                }
            }

            string styleCopPath = StyleCopWrapper.FindStyleCopPath();
            string executable;

            if (styleCopPath != null)
            {
                executable = Path.Combine(styleCopPath, "StyleCopSettingsEditor.exe");
            }
            else
            {
                executable = null;
            }
            string parameters = "\"" + settingsFile + "\"";

            if (!File.Exists(executable))
            {
                LoggingService.Debug("StyleCopSettingsEditor.exe: " + executable);
                MessageService.ShowWarning("Unable to find the StyleCop Settings editor. Please specify the StyleCop location in Tools Options.");
                return;
            }

            using (Process p = Process.Start("\"" + executable + "\"", parameters)) {
                // No need to wait for the settings dialog to close - we can leave it open.
            }
        }
        private string CopyFromMaster()
        {
            var newSettingsFile = helper.Project.Directory + "\\Settings.SourceAnalysis";

            System.IO.File.Copy(
                StyleCopWrapper.GetMasterSettingsFile(),
                newSettingsFile,
                true
                );
            helper.SetProperty <string>("SourceAnalysisOverrideSettingsFile",
                                        newSettingsFile,
                                        true,
                                        PropertyStorageLocations.Base
                                        );
            return(newSettingsFile);
        }
        void ModifyStyleCopSettingsClick(object sender, EventArgs e)
        {
            var executable = Path.Combine(StyleCopWrapper.FindStyleCopPath(), "StyleCopSettingsEditor.exe");
            var parameters = "\"" + StyleCopWrapper.GetMasterSettingsFile() + "\"";

            if (!File.Exists(executable))
            {
                LoggingService.Debug("StyleCopSettingsEditor.exe: " + executable);
                MessageService.ShowWarning("Unable to find the StyleCop Settings editor. Please specify the StyleCop location in Tools Options.");
                return;
            }

            using (Process p = Process.Start("\"" + executable + "\"", parameters))
            {
                // No need to wait for the settings dialog to close - we can leave it open.
            }
        }