Class BooleanProperty
- Namespace
- CADability.UserInterface
- Assembly
- CADability.dll
A boolean property entry, which also can be used as a setting (hence serializable)
public class BooleanProperty : MultipleChoiceProperty, IPropertyEntry, IShowProperty, ISerializable, IDeserializationCallback, ISettingChanged, IJsonSerialize, IJsonSerializeDone
- Inheritance
-
BooleanProperty
- Implements
- Inherited Members
Constructors
BooleanProperty()
Empty constructor for the JSON deserialization; the data is set by SetObjectData(IJsonReadData).
protected BooleanProperty()
BooleanProperty(object, string, string)
Creates a BooleanProperty that displays and manipulates the boolean property of another object. The texts for true
and false are looked up under resourceId followed by ".Values".
public BooleanProperty(object ObjectWithProperty, string PropertyName, string resourceId)
Parameters
ObjectWithPropertyobjectThe object that holds the boolean property
PropertyNamestringName of the property (it is accessed via reflection)
resourceIdstringResource id of the label; the texts for true and false are found under resourceId + ".Values"
BooleanProperty(object, string, string, string)
Creates a BooleanProperty that displays and manipulates the boolean property of another object.
public BooleanProperty(object ObjectWithProperty, string PropertyName, string resourceIdLabel, string resourceIdValues)
Parameters
ObjectWithPropertyobjectThe object that holds the boolean property
PropertyNamestringName of the property (it is accessed via reflection)
resourceIdLabelstringResource id of the label and its tooltips. The tooltip texts are looked up under this resource id followed by ".ShortInfo" and ".DetailedInfo" respectively; ".Images" gives the name of an image list in the resources and the indices into it
resourceIdValuesstringResource id of the texts for true and false. The text must start with a separator character, followed by the text for true, the separator again and the text for false, e.g. "|yes|no"
BooleanProperty(SerializationInfo, StreamingContext)
Constructor required by deserialization
protected BooleanProperty(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfoSerializationInfo
contextStreamingContextStreamingContext
BooleanProperty(string, string)
Creates a BooleanProperty which holds its own value and is not connected to another object. Use GetBooleanEvent and SetBooleanEvent or BooleanValue to communicate with it.
public BooleanProperty(string resourceIdLabel, string resourceIdValues)
Parameters
resourceIdLabelstringResource id of the label; the text is found under resourceIdLabel + ".Label"
resourceIdValuesstringResource id of the texts for true and false. The text must start with a separator character, followed by the text for true, the separator again and the text for false, e.g. "|yes|no"
BooleanProperty(string, string, string)
Creates a BooleanProperty, which contains its own boolean value and can display and manipulate it. The value is available via the property BooleanValue.
public BooleanProperty(string resourceIdLabel, string resourceIdValues, string settingName)
Parameters
resourceIdLabelstringResourceId for the label and its tooltips. The texts for the tooltips are looked up under this ResourceId followed by ".ShortInfo" or ".DetailedInfo" respectively. Under ".Images" the name and the indices of an ImageList in the resource are found
resourceIdValuesstringResourceId for the texts for true and false. The text must start with a separator character, followed by the text for true, followed by the separator, followed by the text for false, e.g. "|yes|no"
settingNamestringName of the value when this property is used in a setting. It is passed as the name in the SettingChangedEvent
Properties
BooleanValue
The boolean value held by this entry. When the entry is connected to an object or to GetBooleanEvent, it is updated from there whenever the entry is displayed. Setting it updates the displayed text and raises SelectionChangedEvent and ValueChangedEvent, but does not write the value to the connected object.
public bool BooleanValue { get; set; }
Property Value
Value
Must be overridden, when Flags contains PropertyEntryType.ValueEditable
public override string Value { get; }
Property Value
Methods
GetObjectData(IJsonWriteData)
Writes the value, the resource ids and the setting name for the JSON serialization (IJsonSerialize). Only properties which hold their own value (see the constructor with the setting name) are serialized.
public void GetObjectData(IJsonWriteData data)
Parameters
dataIJsonWriteDataReceives the data
GetObjectData(SerializationInfo, StreamingContext)
Writes the data of this object for the legacy binary serialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInforeceives the data
contextStreamingContextthe destination of the serialization
OnSelectionChanged(string)
Called when the user has picked a choice. Raises SelectionChangedEvent, stores the text in SelectedText and raises ValueChangedEvent. Derived classes override it to pass the selection on to the object they represent.
protected override void OnSelectionChanged(string selected)
Parameters
selectedstringThe selected text
SetObjectData(IJsonReadData)
Reads the data written by GetObjectData(IJsonWriteData). The texts are initialized from the resource ids once the deserialization is complete.
public void SetObjectData(IJsonReadData data)
Parameters
dataIJsonReadDataProvides the data
Events
BooleanChangedEvent
Raised after the user selected a value and it was passed on to the connected object or to SetBooleanEvent.
public event BooleanChangedDelegate BooleanChangedEvent
Event Type
GetBooleanEvent
Queried whenever the entry is displayed. When a handler is attached, its result is shown instead of the value of the property of the object given to the constructor.
public event BooleanProperty.GetBooleanDelegate GetBooleanEvent
Event Type
SetBooleanEvent
Raised when the user selects a value. When a handler is attached, it receives the new value instead of the property of the object given to the constructor being set.
public event BooleanProperty.SetBooleanDelegate SetBooleanEvent
Event Type
SettingChangedEvent
Raised when the user changes the value while the property is used as a setting (implements ISettingChanged). The handler receives the setting name given to the constructor and this property.
public event SettingChangedDelegate SettingChangedEvent
Event Type
Operators
explicit operator bool(BooleanProperty)
Converts the property to the value it holds internally (BooleanValue).
public static explicit operator bool(BooleanProperty bp)
Parameters
bpBooleanPropertyThe property
Returns
- bool
The boolean value