Class IGeoObjectImpl.Changing
- Namespace
- CADability.GeoObject
- Assembly
- CADability.dll
Helper class to wrap any changing of this GeoObject. Usually used in this way:
using (new Changing(this,...))
{
// ... make the change here ...
}
This will call FireWillChange(GeoObjectChange) before the GeoObject is changed and FireDidChange(GeoObjectChange) after the GeoObject was changed with the appropriate parameters. Changig takes nested changes into account and raises the events only at the outermost level.
protected class IGeoObjectImpl.Changing : IDisposable
- Inheritance
-
IGeoObjectImpl.Changing
- Implements
- Derived
- Inherited Members
Constructors
Changing(IGeoObjectImpl)
Changing geometrical aspects of an GeoObject. A Clone() of this GeoObject is made and saved and CopyGeometry(IGeoObject) might be called with that clone later when there is an undo.
public Changing(IGeoObjectImpl geoObject)
Parameters
geoObjectIGeoObjectImplthe GeoObject
Changing(IGeoObjectImpl, bool)
Changing geometrical aspects of an GeoObject. A Clone() of this GeoObject is made and saved and CopyGeometry(IGeoObject) might be called with that clone later when there is an undo.
public Changing(IGeoObjectImpl geoObject, bool UndoNecessary)
Parameters
geoObjectIGeoObjectImplthe GeoObject
UndoNecessarybooltrue, if undo is required
Changing(IGeoObjectImpl, bool, bool)
Changing geometrical aspects of an GeoObject. A Clone() of this GeoObject is made and saved and CopyGeometry(IGeoObject) might be called with that clone later when there is an undo.
public Changing(IGeoObjectImpl geoObject, bool UndoNecessary, bool onlyAttribute)
Parameters
geoObjectIGeoObjectImplthe GeoObject
UndoNecessarybooltrue, if undo is required
onlyAttributebooltrue, if only an attribute is changed in contrast to a change of the geometry
Changing(IGeoObjectImpl, bool, bool, string, params object[])
Changing a GeoObject with a specification on how to undo that change. Undo might be performed later vie reflection. So we need the name of the method here and the parameters for that method.
public Changing(IGeoObjectImpl geoObject, bool noUndo, bool onlyAttribute, string MethodOrPropertyName, params object[] Parameters)
Parameters
geoObjectIGeoObjectImplthe GeoObject
noUndobooltrue if no undo is required, false otherwise
onlyAttributebooltrue if only an attribute is changed not the geometry
MethodOrPropertyNamestringname of a public method that might be called later by undo
Parametersobject[]parameters for the method
Changing(IGeoObjectImpl, string)
Changing a property, that has public get and set methods, and has only one property with this name. On construction the value of that property will be requested by a reflection call to "get_PropertyName"
public Changing(IGeoObjectImpl geoObject, string PropertyName)
Parameters
geoObjectIGeoObjectImplThe GeoObject
PropertyNamestringThe Name of the property
Changing(IGeoObjectImpl, string, GeoObjectList)
Changing a GeoObject with a single GeoObjectList as the parameter for the undo method, e.g. undoing Add(GeoObjectList) by calling Remove with that list. See the according constructor of ReversibleChange for why this overload is required: without it the list would be spread into one parameter per contained object and the undo would silently do nothing.
public Changing(IGeoObjectImpl geoObject, string MethodOrPropertyName, GeoObjectList Parameter)
Parameters
geoObjectIGeoObjectImplthe GeoObject
MethodOrPropertyNamestringname of a public method that might be called later by undo
ParameterGeoObjectListthe list to pass as a single parameter
Changing(IGeoObjectImpl, string, params object[])
Changing a GeoObject with a specification on how to undo that change. Undo might be performed later vie reflection. So we need the name of the method here and the parameters for that method.
public Changing(IGeoObjectImpl geoObject, string MethodOrPropertyName, params object[] Parameters)
Parameters
geoObjectIGeoObjectImplthe GeoObject
MethodOrPropertyNamestringname of a public method that might be called later by undo
Parametersobject[]parameters for the method
Changing(IGeoObjectImpl, Type, string, params object[])
Changing a GeoObject with a specification on how to undo that change. Undo might be performed later vie reflection. So we need the name of the method here and the parameters for that method. The method must be in the given interface.
public Changing(IGeoObjectImpl geoObject, Type interfaceForMethod, string MethodOrPropertyName, params object[] Parameters)
Parameters
geoObjectIGeoObjectImplthe GeoObject
interfaceForMethodTypethe type of the interface which contains the method
MethodOrPropertyNamestringname of a public method that might be called later by undo
Parametersobject[]parameters for the method
Methods
Create<T>(IGeoObjectImpl, T, string)
Creates a IGeoObjectImpl.Changing<T> for a change of the geometry of geoObject through the
property propertyName: undo sets the property back to oldValue. Use it as
using (Changing.Create(this, startPoint)) { startPoint = value; } in the setter of the property; the
compiler supplies the property name. Unlike the constructors of IGeoObjectImpl.Changing it uses no reflection and
allocates only when the events are actually raised.
public static IGeoObjectImpl.Changing<T> Create<T>(IGeoObjectImpl geoObject, T oldValue, string propertyName = null)
Parameters
geoObjectIGeoObjectImplthe object being changed
oldValueTthe value of the property 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 property
Dispose()
Implements IDisposable.Dispose. Calls FireDidChange(GeoObjectChange) when not inside a nested changing.
public virtual void Dispose()
NoUndoNecessary()
Sets NoUndoNecessary to true for the parameter of the call to FireWillChange(GeoObjectChange) and FireDidChange(GeoObjectChange).
public void NoUndoNecessary()