示例#1
0
		/// <summary>
		/// Analyzes rules tree directly from UI.
		/// </summary>
		public static void Initialize(PropertyControl tabControl)
		{
			IPropertyControlPage analyzersOptions = tabControl.Pages[0];
			TreeView tree = (TreeView)analyzersOptions.GetType().InvokeMember(
				"analyzeTree",
				BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField,
				null,
				analyzersOptions,
				null);

			s_ruleNodes = new Dictionary<string, Dictionary<string, TreeNode>>();

			foreach (TreeNode parserNode in tree.Nodes)
			{
				foreach (TreeNode analyzerNode in parserNode.Nodes)
				{
					SourceAnalyzer analyzer = (SourceAnalyzer)analyzerNode.Tag;
					s_ruleNodes[analyzer.Id] = new Dictionary<string, TreeNode>();
					AnalyzeRuleNodes(s_ruleNodes[analyzer.Id], analyzerNode);
				}
			}
		}
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">
        /// The tab control object.
        /// </param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "propertyControl");

            this.tabControl = propertyControl;

            // Get the merge style setting.
            StringProperty mergeTypeProperty = this.tabControl.LocalSettings.GlobalSettings.GetProperty(SettingsMerger.MergeSettingsFilesProperty) as StringProperty;
            string         mergeType         = mergeTypeProperty == null ? SettingsMerger.MergeStyleParent : mergeTypeProperty.Value;

            // If the merge style is set to link but the current environment doesn't support linking, change it to parent.
            if (!this.tabControl.Core.Environment.SupportsLinkedSettings && string.CompareOrdinal(mergeType, SettingsMerger.MergeStyleLinked) == 0)
            {
                mergeType           = SettingsMerger.MergeStyleParent;
                this.disableLinking = true;
            }

            if (string.CompareOrdinal(mergeType, SettingsMerger.MergeStyleNone) == 0)
            {
                this.noMerge.Checked = true;
            }
            else if (string.CompareOrdinal(mergeType, SettingsMerger.MergeStyleLinked) == 0)
            {
                this.mergeWithLinkedFile.Checked = true;

                StringProperty linkedSettingsFileProperty =
                    this.tabControl.LocalSettings.GlobalSettings.GetProperty(SettingsMerger.LinkedSettingsProperty) as StringProperty;
                if (linkedSettingsFileProperty != null && !string.IsNullOrEmpty(linkedSettingsFileProperty.Value))
                {
                    // This mode assumes that StyleCop is running in a file-based environment.
                    string linkedSettingsFile = Environment.ExpandEnvironmentVariables(linkedSettingsFileProperty.Value);

                    if (linkedSettingsFile.StartsWith(".", StringComparison.Ordinal))
                    {
                        linkedSettingsFile = Utils.MakeAbsolutePath(Path.GetDirectoryName(this.tabControl.LocalSettings.Location), linkedSettingsFile);
                    }

                    this.linkedFilePath.Text = linkedSettingsFile;
                }
            }
            else
            {
                this.mergeWithParents.Checked = true;
            }

            this.EnableDisable();

            bool defaultSettings = this.tabControl.LocalSettings.DefaultSettings;

            // Disable the parent link controls if this is the default settings file.
            if (defaultSettings)
            {
                this.mergeWithParents.Enabled       = false;
                this.editParentSettingsFile.Enabled = false;
                this.mergeWithLinkedFile.Enabled    = false;
                this.locationLabel.Enabled          = false;
                this.linkedFilePath.Enabled         = false;
                this.browse.Enabled = false;
                this.editLinkedSettingsFile.Enabled = false;
            }

            if (!this.noMerge.Checked && defaultSettings)
            {
                this.noMerge.Checked = true;
            }

            // Reset the dirty flag to false now.
            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">
        /// The tab control object.
        /// </param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "propertyControl");

            this.tabControl = propertyControl;

            // Get the list of allowed words from the parent settings.
            this.AddParentSettingsValues();

            // Get the list of allowed words from the local settings.
            CollectionProperty recognizedWordsProperty = this.tabControl.LocalSettings.GlobalSettings.GetProperty(RecognizedWordsPropertyName) as CollectionProperty;

            if (recognizedWordsProperty != null && recognizedWordsProperty.Values.Count > 0)
            {
                foreach (string value in recognizedWordsProperty)
                {
                    if (!string.IsNullOrEmpty(value))
                    {
                        ListViewItem item = this.recognizedWordsListView.Items.Add(value);
                        item.Tag = true;
                        this.SetBoldState(item, this.recognizedWordsListView);
                    }
                }
            }

            // Select the first item in the list.
            if (this.recognizedWordsListView.Items.Count > 0)
            {
                this.recognizedWordsListView.Items[0].Selected = true;
            }

            // Get the list of deprecated words from the local settings.
            CollectionProperty deprecatedWordsProperty = this.tabControl.LocalSettings.GlobalSettings.GetProperty(DeprecatedWordsPropertyName) as CollectionProperty;

            if (deprecatedWordsProperty != null && deprecatedWordsProperty.Values.Count > 0)
            {
                foreach (string value in deprecatedWordsProperty)
                {
                    if (!string.IsNullOrEmpty(value))
                    {
                        string[] valueParts = value.Split(',');
                        if (valueParts.Length == 2)
                        {
                            ListViewItem item = this.deprecatedWordsListView.Items.Add(valueParts[0].Trim() + ", " + valueParts[1].Trim());
                            item.Tag = true;
                            this.SetBoldState(item, this.deprecatedWordsListView);
                        }
                    }
                }
            }

            // Select the first item in the list.
            if (this.deprecatedWordsListView.Items.Count > 0)
            {
                this.deprecatedWordsListView.Items[0].Selected = true;
            }

            // Get the list of folders from the local settings.
            CollectionProperty dictionaryFoldersProperty = this.tabControl.LocalSettings.GlobalSettings.GetProperty(DictionaryFoldersPropertyName) as CollectionProperty;

            if (dictionaryFoldersProperty != null && dictionaryFoldersProperty.Values.Count > 0)
            {
                foreach (string value in dictionaryFoldersProperty)
                {
                    if (!string.IsNullOrEmpty(value))
                    {
                        ListViewItem item = this.foldersListView.Items.Add(value);
                        item.Tag = true;
                        this.SetBoldState(item, this.foldersListView);
                    }
                }
            }

            // Select the first item in the list.
            if (this.foldersListView.Items.Count > 0)
            {
                this.foldersListView.Items[0].Selected = true;
            }

            this.EnableDisableRemoveButtons();

            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
示例#4
0
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">
        /// The tab control object.
        /// </param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "tabControl");

            this.tabControl = propertyControl;

            // Adds the parsers and analyzers to the tree.
            this.FillAnalyzerTree();

            // Select the first node in the tree.
            if (this.analyzeTree.Nodes.Count > 0)
            {
                this.analyzeTree.SelectedNode = this.analyzeTree.Nodes[0];
            }

            // Reset the dirty flag to false now.
            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
示例#5
0
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">
        /// The tab control object.
        /// </param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "propertyControl");

            this.tabControl = propertyControl;

            // Get the list of allowed words from the parent settings.
            this.AddParentSettingsValues();

            // Get the list of allowed words from the local settings.
            CollectionProperty recognizedWordsProperty = this.tabControl.LocalSettings.GlobalSettings.GetProperty(RecognizedWordsPropertyName) as CollectionProperty;

            if (recognizedWordsProperty != null && recognizedWordsProperty.Values.Count > 0)
            {
                foreach (string value in recognizedWordsProperty)
                {
                    if (!string.IsNullOrEmpty(value))
                    {
                        ListViewItem item = this.recognizedWordsListView.Items.Add(value);
                        item.Tag = true;
                        this.SetBoldState(item, this.recognizedWordsListView);
                    }
                }
            }

            // Select the first item in the list.
            if (this.recognizedWordsListView.Items.Count > 0)
            {
                this.recognizedWordsListView.Items[0].Selected = true;
            }

            // Get the list of deprecated words from the local settings.
            CollectionProperty deprecatedWordsProperty = this.tabControl.LocalSettings.GlobalSettings.GetProperty(DeprecatedWordsPropertyName) as CollectionProperty;

            if (deprecatedWordsProperty != null && deprecatedWordsProperty.Values.Count > 0)
            {
                foreach (string value in deprecatedWordsProperty)
                {
                    if (!string.IsNullOrEmpty(value))
                    {
                        string[] valueParts = value.Split(',');
                        if (valueParts.Length == 2)
                        {
                            ListViewItem item = this.deprecatedWordsListView.Items.Add(valueParts[0].Trim() + ", " + valueParts[1].Trim());
                            item.Tag = true;
                            this.SetBoldState(item, this.deprecatedWordsListView);
                        }
                    }
                }
            }

            // Select the first item in the list.
            if (this.deprecatedWordsListView.Items.Count > 0)
            {
                this.deprecatedWordsListView.Items[0].Selected = true;
            }

            // Get the list of folders from the local settings.
            CollectionProperty dictionaryFoldersProperty = this.tabControl.LocalSettings.GlobalSettings.GetProperty(DictionaryFoldersPropertyName) as CollectionProperty;

            if (dictionaryFoldersProperty != null && dictionaryFoldersProperty.Values.Count > 0)
            {
                foreach (string value in dictionaryFoldersProperty)
                {
                    if (!string.IsNullOrEmpty(value))
                    {
                        ListViewItem item = this.foldersListView.Items.Add(value);
                        item.Tag = true;
                        this.SetBoldState(item, this.foldersListView);
                    }
                }
            }

            // Select the first item in the list.
            if (this.foldersListView.Items.Count > 0)
            {
                this.foldersListView.Items[0].Selected = true;
            }

            this.EnableDisableRemoveButtons();

            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
        /// <summary>
        /// Initializes this tab.
        /// </summary>
        /// <param name="propertyControl">The property control that hosts this
        /// tab.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref
        /// name="propertyControl"/> is <c>null</c>.</exception>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.RequireNotNull(propertyControl, "propertyControl");

            // Save the property control.
            this.tabControl = propertyControl;

            // Load the current settings and initialize the controls on the
            // form.
            this.InitializeSettings();

            // Put the form into 'not-dirty' state.
            this.Dirty = false;
        }
示例#7
0
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">
        /// The tab control object.
        /// </param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "propertyControl");

            this.tabControl = propertyControl;

            // Get the cache setting.
            this.writeCachePropertyDescriptor = this.tabControl.Core.PropertyDescriptors["WriteCache"] as PropertyDescriptor <bool>;

            this.writeCacheParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                            BooleanProperty;

            BooleanProperty mergedWriteCacheProperty = this.tabControl.MergedSettings == null
                                                           ? null
                                                           : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                                       BooleanProperty;

            this.enableCache.Checked = mergedWriteCacheProperty == null ? this.writeCachePropertyDescriptor.DefaultValue : mergedWriteCacheProperty.Value;

            // Max Violation Count
            this.maxViolationCountPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["MaxViolationCount"] as PropertyDescriptor <int>;

            this.maxViolationCountParentProperty = this.tabControl.ParentSettings == null
                                                       ? null
                                                       : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.maxViolationCountPropertyDescriptor.PropertyName)
                                                   as IntProperty;

            IntProperty mergedMaxViolationCountProperty = this.tabControl.MergedSettings == null
                                                              ? null
                                                              : this.tabControl.MergedSettings.GlobalSettings.GetProperty(
                this.maxViolationCountPropertyDescriptor.PropertyName) as IntProperty;

            this.maxViolationCountMaskedTextBox.Text = mergedMaxViolationCountProperty == null
                                                           ? this.maxViolationCountPropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                                                           : mergedMaxViolationCountProperty.Value.ToString(CultureInfo.InvariantCulture);

            // Culture
            this.culturePropertyDescriptor = this.tabControl.Core.PropertyDescriptors["Culture"] as PropertyDescriptor <string>;

            this.cultureParentProperty = this.tabControl.ParentSettings == null
                                             ? null
                                             : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as StringProperty;

            StringProperty mergedCultureProperty = this.tabControl.MergedSettings == null
                                                       ? null
                                                       : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as
                                                   StringProperty;

            this.cultureComboBox.SelectedIndex =
                this.cultureComboBox.FindStringExact(
                    mergedCultureProperty == null
                        ? this.culturePropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                        : mergedCultureProperty.Value.ToString(CultureInfo.InvariantCulture));

            // Errors As Warnings
            this.violationsAsErrorsPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["ViolationsAsErrors"] as PropertyDescriptor <bool>;

            this.violationsAsErrorsParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.violationsAsErrorsPropertyDescriptor.PropertyName) as
                                                    BooleanProperty;

            BooleanProperty mergedViolationsAsErrorsProperty = this.tabControl.MergedSettings == null
                                                           ? null
                                                           : this.tabControl.MergedSettings.GlobalSettings.GetProperty(
                this.violationsAsErrorsPropertyDescriptor.PropertyName) as BooleanProperty;

            this.violationsAsErrorsCheckBox.Checked = mergedViolationsAsErrorsProperty == null
                                                          ? this.violationsAsErrorsPropertyDescriptor.DefaultValue
                                                          : mergedViolationsAsErrorsProperty.Value;

            this.SetBoldState();

            // Reset the dirty flag to false now.
            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
        /// <summary>
        /// Initializes the specified property control with the StyleCop settings file.
        /// </summary>
        /// <param name="propertyControl">The property control.</param>
        public void Initialize(PropertyControl propertyControl)
        {
            this.tabControl = propertyControl;

            StringProperty customSettingProperty =
                (StringProperty)this.analyzer.GetSetting(this.tabControl.MergedSettings, "UsingDirectiveGroups");

            if (customSettingProperty != null)
            {
                this.UsingGroupPrefixesTextBox.Text = customSettingProperty.Value;
            }

            this.Dirty = false;
            this.tabControl.DirtyChanged();
        }
示例#9
0
		/// <summary>
		/// Initializes the specified property control with the StyleCop settings file.
		/// </summary>
		public void Initialize(PropertyControl propertyControl)
		{
			m_tabControl = propertyControl;

			SettingsGrabber.Initialize(m_tabControl);
			namingRulesPage.Initialize();
			customRulesPage.Initialize();
		}
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">
        /// The tab control object.
        /// </param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "propertyControl");

            this.tabControl = propertyControl;

            // Get the merge style setting.
            StringProperty mergeTypeProperty = this.tabControl.LocalSettings.GlobalSettings.GetProperty(SettingsMerger.MergeSettingsFilesProperty) as StringProperty;
            string mergeType = mergeTypeProperty == null ? SettingsMerger.MergeStyleParent : mergeTypeProperty.Value;

            // If the merge style is set to link but the current environment doesn't support linking, change it to parent.
            if (!this.tabControl.Core.Environment.SupportsLinkedSettings && string.CompareOrdinal(mergeType, SettingsMerger.MergeStyleLinked) == 0)
            {
                mergeType = SettingsMerger.MergeStyleParent;
                this.disableLinking = true;
            }

            if (string.CompareOrdinal(mergeType, SettingsMerger.MergeStyleNone) == 0)
            {
                this.noMerge.Checked = true;
            }
            else if (string.CompareOrdinal(mergeType, SettingsMerger.MergeStyleLinked) == 0)
            {
                this.mergeWithLinkedFile.Checked = true;

                StringProperty linkedSettingsFileProperty =
                    this.tabControl.LocalSettings.GlobalSettings.GetProperty(SettingsMerger.LinkedSettingsProperty) as StringProperty;
                if (linkedSettingsFileProperty != null && !string.IsNullOrEmpty(linkedSettingsFileProperty.Value))
                {
                    // This mode assumes that StyleCop is running in a file-based environment.
                    string linkedSettingsFile = Environment.ExpandEnvironmentVariables(linkedSettingsFileProperty.Value);

                    if (linkedSettingsFile.StartsWith(".", StringComparison.Ordinal))
                    {
                        linkedSettingsFile = Utils.MakeAbsolutePath(Path.GetDirectoryName(this.tabControl.LocalSettings.Location), linkedSettingsFile);
                    }

                    this.linkedFilePath.Text = linkedSettingsFile;
                }
            }
            else
            {
                this.mergeWithParents.Checked = true;
            }

            this.EnableDisable();

            bool defaultSettings = this.tabControl.LocalSettings.DefaultSettings;

            // Disable the parent link controls if this is the default settings file.
            if (defaultSettings)
            {
                this.mergeWithParents.Enabled = false;
                this.editParentSettingsFile.Enabled = false;
                this.mergeWithLinkedFile.Enabled = false;
                this.locationLabel.Enabled = false;
                this.linkedFilePath.Enabled = false;
                this.browse.Enabled = false;
                this.editLinkedSettingsFile.Enabled = false;
            }

            if (!this.noMerge.Checked && defaultSettings)
            {
                this.noMerge.Checked = true;
            }

            // Reset the dirty flag to false now.
            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
示例#11
0
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">The tab control object.</param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "propertyControl");

            this.tabControl = propertyControl;

            // Get the cache setting.
            PropertyDescriptor<bool> descriptor = this.tabControl.Core.PropertyDescriptors["WriteCache"] as PropertyDescriptor<bool>;

            this.parentProperty = this.tabControl.ParentSettings == null ? 
                null : 
                this.tabControl.ParentSettings.GlobalSettings.GetProperty(descriptor.PropertyName) as BooleanProperty;
            
            BooleanProperty mergedProperty = this.tabControl.MergedSettings == null ? 
                null : 
                this.tabControl.MergedSettings.GlobalSettings.GetProperty(descriptor.PropertyName) as BooleanProperty;

            this.enableCache.Checked = mergedProperty == null ? descriptor.DefaultValue : mergedProperty.Value;

            this.SetBoldState();

            // Reset the dirty flag to false now.
            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
示例#12
0
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">
        /// The tab control object.
        /// </param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "propertyControl");

            this.tabControl = propertyControl;

            // Get the cache setting.
            this.writeCachePropertyDescriptor = this.tabControl.Core.PropertyDescriptors["WriteCache"] as PropertyDescriptor<bool>;

            this.writeCacheParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                                  BooleanProperty;

            BooleanProperty mergedWriteCacheProperty = this.tabControl.MergedSettings == null
                                                           ? null
                                                           : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                                             BooleanProperty;

            this.enableCache.Checked = mergedWriteCacheProperty == null ? this.writeCachePropertyDescriptor.DefaultValue : mergedWriteCacheProperty.Value;

            // Auto update check
            this.autoUpdateCheckPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["AutoCheckForUpdate"] as PropertyDescriptor<bool>;

            this.autoUpdateParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.autoUpdateCheckPropertyDescriptor.PropertyName) as
                                                  BooleanProperty;

            BooleanProperty mergedAutoUpdateProperty = this.tabControl.MergedSettings == null
                                                           ? null
                                                           : this.tabControl.MergedSettings.GlobalSettings.GetProperty(
                                                               this.autoUpdateCheckPropertyDescriptor.PropertyName) as BooleanProperty;

            this.autoUpdateCheckBox.Checked = mergedAutoUpdateProperty == null ? this.autoUpdateCheckPropertyDescriptor.DefaultValue : mergedAutoUpdateProperty.Value;

            // Days to Check
            this.daysToCheckPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["DaysToCheckForUpdates"] as PropertyDescriptor<int>;

            this.daysToCheckParentProperty = this.tabControl.ParentSettings == null
                                                 ? null
                                                 : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.daysToCheckPropertyDescriptor.PropertyName) as
                                                   IntProperty;

            IntProperty mergedDaysToCheckProperty = this.tabControl.MergedSettings == null
                                                        ? null
                                                        : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.daysToCheckPropertyDescriptor.PropertyName) as
                                                          IntProperty;

            this.daysMaskedTextBox.Text = mergedDaysToCheckProperty == null
                                              ? this.daysToCheckPropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                                              : mergedDaysToCheckProperty.Value.ToString(CultureInfo.InvariantCulture);

            // Max Violation Count
            this.maxViolationCountPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["MaxViolationCount"] as PropertyDescriptor<int>;

            this.maxViolationCountParentProperty = this.tabControl.ParentSettings == null
                                                       ? null
                                                       : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.maxViolationCountPropertyDescriptor.PropertyName)
                                                         as IntProperty;

            IntProperty mergedMaxViolationCountProperty = this.tabControl.MergedSettings == null
                                                              ? null
                                                              : this.tabControl.MergedSettings.GlobalSettings.GetProperty(
                                                                  this.maxViolationCountPropertyDescriptor.PropertyName) as IntProperty;

            this.maxViolationCountMaskedTextBox.Text = mergedMaxViolationCountProperty == null
                                                           ? this.maxViolationCountPropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                                                           : mergedMaxViolationCountProperty.Value.ToString(CultureInfo.InvariantCulture);

            // Culture
            this.culturePropertyDescriptor = this.tabControl.Core.PropertyDescriptors["Culture"] as PropertyDescriptor<string>;

            this.cultureParentProperty = this.tabControl.ParentSettings == null
                                             ? null
                                             : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as StringProperty;

            StringProperty mergedCultureProperty = this.tabControl.MergedSettings == null
                                                       ? null
                                                       : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as
                                                         StringProperty;

            this.cultureComboBox.SelectedIndex =
                this.cultureComboBox.FindStringExact(
                    mergedCultureProperty == null
                        ? this.culturePropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                        : mergedCultureProperty.Value.ToString(CultureInfo.InvariantCulture));

            // Errors As Warnings
            this.violationsAsErrorsPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["ViolationsAsErrors"] as PropertyDescriptor<bool>;

            this.violationsAsErrorsParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.violationsAsErrorsPropertyDescriptor.PropertyName) as
                                                  BooleanProperty;

            BooleanProperty mergedViolationsAsErrorsProperty = this.tabControl.MergedSettings == null
                                                           ? null
                                                           : this.tabControl.MergedSettings.GlobalSettings.GetProperty(
                                                               this.violationsAsErrorsPropertyDescriptor.PropertyName) as BooleanProperty;

            this.violationsAsErrorsCheckBox.Checked = mergedViolationsAsErrorsProperty == null
                                                          ? this.violationsAsErrorsPropertyDescriptor.DefaultValue
                                                          : mergedViolationsAsErrorsProperty.Value;

            this.SetBoldState();

            // Reset the dirty flag to false now.
            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
示例#13
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PropertyDialog));
            this.help = new System.Windows.Forms.Button();
            this.cancel = new System.Windows.Forms.Button();
            this.ok = new System.Windows.Forms.Button();
            this.apply = new System.Windows.Forms.Button();
            this.properties = new StyleCop.PropertyControl();
            this.SuspendLayout();
            // 
            // help
            // 
            resources.ApplyResources(this.help, "help");
            this.help.Name = "help";
            this.help.Click += new System.EventHandler(this.HelpClick);
            // 
            // cancel
            // 
            resources.ApplyResources(this.cancel, "cancel");
            this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.cancel.Name = "cancel";
            this.cancel.Click += new System.EventHandler(this.CancelClick);
            // 
            // ok
            // 
            resources.ApplyResources(this.ok, "ok");
            this.ok.Name = "ok";
            this.ok.Click += new System.EventHandler(this.OkClick);
            // 
            // apply
            // 
            resources.ApplyResources(this.apply, "apply");
            this.apply.Name = "apply";
            this.apply.Click += new System.EventHandler(this.ApplyClick);
            // 
            // properties
            // 
            resources.ApplyResources(this.properties, "properties");
            this.properties.HotTrack = true;
            this.properties.Name = "properties";
            this.properties.SelectedIndex = 0;
            // 
            // PropertyDialog
            // 
            this.AcceptButton = this.ok;
            this.CancelButton = this.cancel;
            resources.ApplyResources(this, "$this");
            this.Controls.Add(this.properties);
            this.Controls.Add(this.apply);
            this.Controls.Add(this.ok);
            this.Controls.Add(this.cancel);
            this.Controls.Add(this.help);
            this.Name = "PropertyDialog";
            this.ResumeLayout(false);

        }