// Protected methods internal void RaisePropertyChangedEvent(double newValue) { // UIA doesn't tolerate a null doubles, so we convert them to zeroes. double oldValue = GetRatingControl().Value; var oldValueProp = PropertyValue.CreateDouble(oldValue); if (newValue == -1) { var newValueProp = PropertyValue.CreateDouble(0.0); base.RaisePropertyChangedEvent(ValuePatternIdentifiers.ValueProperty, oldValueProp, newValueProp); base.RaisePropertyChangedEvent(RangeValuePatternIdentifiers.ValueProperty, oldValueProp, newValueProp); } else { var newValueProp = PropertyValue.CreateDouble(newValue); base.RaisePropertyChangedEvent(ValuePatternIdentifiers.ValueProperty, oldValueProp, newValueProp); // make these strings base.RaisePropertyChangedEvent(RangeValuePatternIdentifiers.ValueProperty, oldValueProp, newValueProp); } }
public static object Parse(AppDataType.Type type, string s) { object obj = null; switch (type) { case AppDataType.Type.Empty: obj = PropertyValue.CreateEmpty();; break; case AppDataType.Type.UInt8: obj = PropertyValue.CreateUInt8(s.IsEmpty() ? (byte)0 : Byte.Parse(s)); break; case AppDataType.Type.Int16: obj = PropertyValue.CreateInt16(s.IsEmpty() ? (short)0 : Int16.Parse(s)); break; case AppDataType.Type.UInt16: obj = PropertyValue.CreateUInt16(s.IsEmpty() ? (ushort)0 : UInt16.Parse(s)); break; case AppDataType.Type.Int32: obj = PropertyValue.CreateInt32(s.IsEmpty() ? 0 : Int32.Parse(s)); break; case AppDataType.Type.UInt32: obj = PropertyValue.CreateUInt32(s.IsEmpty() ? 0 : UInt32.Parse(s)); break; case AppDataType.Type.Int64: obj = PropertyValue.CreateInt64(s.IsEmpty() ? 0 : Int64.Parse(s)); break; case AppDataType.Type.UInt64: obj = PropertyValue.CreateUInt64(s.IsEmpty() ? 0 : UInt64.Parse(s)); break; case AppDataType.Type.Single: obj = PropertyValue.CreateSingle(s.IsEmpty() ? 0 : Single.Parse(s)); break; case AppDataType.Type.Double: obj = PropertyValue.CreateDouble(s.IsEmpty() ? 0 : Double.Parse(s)); break; case AppDataType.Type.Char16: obj = PropertyValue.CreateChar16(Char.Parse(s)); break; case AppDataType.Type.Boolean: obj = PropertyValue.CreateBoolean(s.IsEmpty() ? false : Boolean.Parse(s)); break; case AppDataType.Type.String: obj = s; break; default: break; } return(obj); }
/// <summary> /// Raises the property changed event for this AutomationPeer for the provided identifier. /// </summary> /// <param name="oldValue">Old value</param> /// <param name="newValue">New value</param> public void RaiseValueChangedEvent(double oldValue, double newValue) { RaisePropertyChangedEvent(RangeValuePatternIdentifiers.ValueProperty, PropertyValue.CreateDouble(oldValue), PropertyValue.CreateDouble(newValue)); }