Class IGeoObjectImpl.ChangingAttribute
- Namespace
- CADability.GeoObject
- Assembly
- CADability.dll
Helper class to wrap the setting of an attribute. Usually used in this way:
using (new ChangingAttribute(this,atrName,attribute))
{
// ... set the attribute here ...
}
This will call FireWillChange(GeoObjectChange) before the attribute is changed and FireDidChange(GeoObjectChange) after the attribute was changed.
protected class IGeoObjectImpl.ChangingAttribute : IGeoObjectImpl.Changing, IDisposable
- Inheritance
-
IGeoObjectImpl.ChangingAttribute
- Implements
- Inherited Members
Constructors
ChangingAttribute(IGeoObjectImpl, string, object)
Creates a ChangingAttribute
public ChangingAttribute(IGeoObjectImpl geoObject, string propertyName, object propertyValue)
Parameters
geoObjectIGeoObjectImplcausing GeoObject
propertyNamestringname of the property to set the attribute
propertyValueobjectthe attribute beeing set
Methods
Create<T>(IGeoObjectImpl, T, string)
Creates a IGeoObjectImpl.Changing<T> for the change of an attribute of geoObject: the change is
reported with OnlyAttributeChanged set, and undo restores oldValue
through the property propertyName. Use it as
using (ChangingAttribute.Create(this, colorDef)) { colorDef = value; } in the setter of the attribute
property; the compiler supplies the property name.
public static IGeoObjectImpl.Changing<T> Create<T>(IGeoObjectImpl geoObject, T oldValue, string propertyName = null) where T : INamedAttribute
Parameters
geoObjectIGeoObjectImplthe object being changed
oldValueTthe value of the attribute before the change
propertyNamestringthe name of the property being set; supplied by the compiler when omitted
Returns
- IGeoObjectImpl.Changing<T>
the object to dispose when the change is done
Type Parameters
Tthe type of the attribute