/// <summary> /// Constructor</summary> /// <param name="node">PropertyNode</param> public SliderValueEditorContext(PropertyNode node) { m_node = node; m_node.ValueChanged += new EventHandler(Node_ValueChanged); Update(); NumberRangesAttribute numberRange = m_node.Descriptor.Attributes[typeof(NumberRangesAttribute)] as NumberRangesAttribute; if (numberRange != null) { Max = numberRange.Maximum; Min = numberRange.Minimum; } else { Max = double.MaxValue; Min = double.MinValue; } NumberIncrementsAttribute numberInc = m_node.Descriptor.Attributes[typeof(NumberIncrementsAttribute)] as NumberIncrementsAttribute; if (numberInc != null) { SmallChange = numberInc.SmallChange; LargeChange = numberInc.LargeChange; } else { SmallChange = 1; LargeChange = 10; } NumberFormatAttribute numberFormat = m_node.Descriptor.Attributes[typeof(NumberFormatAttribute)] as NumberFormatAttribute; if (numberFormat != null) { FormatString = numberFormat.FormatString; } else { FormatString = "{0:0.00}"; } }
/// <summary> /// Tests equality to an object</summary> /// <param name="obj">Object to compare to</param> /// <returns>True iff objects are equal</returns> public override bool Equals(object obj) { if (obj == this) { return(true); } NumberIncrementsAttribute attribute = obj as NumberIncrementsAttribute; if (attribute != null) { if ((attribute.smallChange == this.smallChange)) { return(attribute.largeChange == this.largeChange); } } return(false); }