Table of Contents

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

geoObject IGeoObjectImpl

causing GeoObject

propertyName string

name of the property to set the attribute

propertyValue object

the 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

geoObject IGeoObjectImpl

the object being changed

oldValue T

the value of the attribute before the change

propertyName string

the 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

T

the type of the attribute