BooleanSwitch.OnValueChanged 方法

定义

确定 Value 属性的新值是否可以被解析为一个布尔值。Determines whether the new value of the Value property can be parsed as a Boolean value.

protected:
 override void OnValueChanged();
protected override void OnValueChanged ();
override this.OnValueChanged : unit -> unit
Protected Overrides Sub OnValueChanged ()

注解

OnValueChanged方法确定新值是否为布尔值的有效字符串表示形式 ( "false" 或 "true" ) 。The OnValueChanged method determines whether the new value is a valid string representation of a Boolean value ("false" or "true"). 如果是这样,则该方法将 SwitchSetting 属性设置为0或1。If so, the method sets the SwitchSetting property to 0 or 1. 否则,将调用基方法,该方法将字符串值转换为整数值,然后使用该值来设置 SwitchSetting 属性。Otherwise, the base method is called, which converts the string value to an integer value, which is then used to set the SwitchSetting property.

适用于