/// <summary> /// Refreshes the merged override state of properties on the page. /// </summary> public void RefreshSettingsOverrideState() { this.writeCacheParentProperty = this.tabControl.ParentSettings == null ? null : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as BooleanProperty; this.autoUpdateParentProperty = this.tabControl.ParentSettings == null ? null : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.autoUpdateCheckPropertyDescriptor.PropertyName) as BooleanProperty; this.daysToCheckParentProperty = this.tabControl.ParentSettings == null ? null : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.daysToCheckPropertyDescriptor.PropertyName) as IntProperty; this.maxViolationCountParentProperty = this.tabControl.ParentSettings == null ? null : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.maxViolationCountPropertyDescriptor.PropertyName) as IntProperty; this.cultureParentProperty = this.tabControl.ParentSettings == null ? null : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as StringProperty; this.violationsAsErrorsParentProperty = this.tabControl.ParentSettings == null ? null : this.tabControl.ParentSettings.GlobalSettings.GetProperty( this.violationsAsErrorsPropertyDescriptor.PropertyName) as BooleanProperty; this.SetBoldState(); }
/// <summary> /// Saves the given int property into the given node. /// </summary> /// <param name="rootNode">The node under which to store the new property node.</param> /// <param name="property">The property to save.</param> /// <param name="propertyName">The name of the property.</param> /// <returns>Returns true if the property was written.</returns> private static bool SaveIntProperty(XmlNode rootNode, IntProperty property, string propertyName) { Param.AssertNotNull(rootNode, "rootNode"); Param.AssertNotNull(property, "property"); Param.AssertValidString(propertyName, "propertyName"); // Create and append the root node for this property. XmlNode propertyNode = rootNode.OwnerDocument.CreateElement("IntegerProperty"); rootNode.AppendChild(propertyNode); XmlAttribute propertyNameAttribute = rootNode.OwnerDocument.CreateAttribute("Name"); propertyNameAttribute.Value = propertyName; propertyNode.Attributes.Append(propertyNameAttribute); // Add the value. int propertyValue = property.Value; propertyNode.InnerText = propertyValue.ToString(CultureInfo.InvariantCulture); return(true); }
/// <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(); }