Events Class |
The Events class allows the user to register event listeners for drawing events.
Inheritance Hierarchy
Namespace: Tekla.Structures.Drawing
Assembly: Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2024.0.0+a110b435391768740483e3032720a566518c9a63
Syntax
The Events type exposes the following members.
Constructors
Methods
Name | Description | |
---|---|---|
InitializeLifetimeService |
Initializes the lifetime service.
(Overrides MarshalByRefObjectInitializeLifetimeService.) | |
Register |
Registers the instance to listen to the specified events.
| |
UnRegister |
Unregisters the instance from listening to events.
|
Events
Name | Description | |
---|---|---|
DrawingChanged |
The DrawingChanged event is raised when the drawing has been changed and the database is committed.
| |
DrawingDeleted |
The DrawingDeleted event is raised when a drawing has been deleted.
| |
DrawingInserted |
The DrawingInserted event is raised when a drawing has been inserted.
| |
DrawingReadyForIssuingChange |
The DrawingReadyForIssuingChange event is raised just after a drawing is marked or unmarked ready for issuing.
| |
DrawingStatusChanged |
The DrawingStatusChanged event is raised when the drawing status has changed.
| |
DrawingUpdated |
The DrawingUpdated event is raised when the drawing has been inserted, deleted or modified, and the database is committed.
|
Remarks
Asynchronous event handling
Registered event handlers are called asynchronously so that many handlers may be running simultaneously. Event handlers are not guaranteed to be run in the same thread where they were registered. The asynchronous nature of the events requires the use of synchronization constructs on objects and data structures that are not defined to be thread safe.
- Microsoft's documentation about the lock statement: http://msdn.microsoft.com/en-us/library/c5kehkcz.aspx
- Microsoft's documentation about delegates: http://msdn.microsoft.com/en-us/library/900fyy8e.aspx
- Microsoft's documentation about managed threading: http://msdn.microsoft.com/en-us/library/1c9txz50.aspx
Examples
The following example shows how to make sure that only one selection event handler is running at a time.
using Tekla.Structures.Drawing; public class Example { private Events _events = new Events(); private object _statusChangedEventHandlerLock = new object(); public void RegisterEventHandler() { _events.DrawingStatusChanged += Events_DrawingStatusChangedEvent; _events.Register(); } public void UnRegisterEventHandler() { _events.UnRegister(); } void Events_DrawingStatusChangedEvent() { /* Make sure that the inner code block is running synchronously */ lock(_statusChangedEventHandlerLock) { System.Console.WriteLine("Selection changed event received."); } } }
See Also