Events Class |
The Events class allows the user to register event listeners for drawing user interface events.
SystemObject
SystemMarshalByRefObject
Tekla.Structures.Drawing.UIEvents
SystemMarshalByRefObject
Tekla.Structures.Drawing.UIEvents
Namespace: Tekla.Structures.Drawing.UI
Assembly: Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2025.0.0-alpha00045580+dc02c3918546f1e94eb2d3b13ea99057fb3313e0
The Events type exposes the following members.
| Name | Description | |
|---|---|---|
| Dispose |
Disposes of the Events instance.
| |
| InitializeLifetimeService |
Initializes the lifetime service.
(Overrides MarshalByRefObjectInitializeLifetimeService.) | |
| OnInterrupted |
Called when uesr interrupts.
| |
| Register |
Registers the instance to listen to the specified events.
| |
| UnRegister |
Unregisters the instance from listening to events.
|
| Name | Description | |
|---|---|---|
| DocumentManagerClosed |
The DocumentManagerClosed eventis raised when the document manager is closed.
| |
| DrawingEditorClosed |
The DrawingEditorClosed event is raised when the drawing editor is closed.
| |
| DrawingEditorOpened |
The DrawingEditorOpened event is raised when the drawing editor is opened.
| |
| DrawingListSelectionChanged |
The DrawingListSelectionChanged event is raised when selection on the drawing list has changed.
| |
| DrawingLoaded |
The DrawingLoaded event is raised when a new drawing is opened in the drawing editor.
| |
| Interrupted |
Occurs when user interrupts.
| |
| LayoutEditingModeEntered |
The LayoutEditingModeEntered event is raised when layout editing mode is started.
| |
| LayoutEditingModeExited |
The LayoutEditingModeEntered event is raised when layout editing mode is finished.
| |
| LayoutOptionModified |
The event is raised when layout option is modified
| |
| LayoutTableDeleted |
The event is raised when table is deleted
| |
| LayoutTableInserted |
The event is raised when table is inserted
| |
| LayoutTableLayoutModified |
The event is raised when tablelayout is modified
| |
| LayoutTableModified |
The event is never raised
| |
| SelectionChange |
The SelectionChange event is raised when the selection is changed in a Tekla Structures drawing.
|
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
The following example shows how to make sure that only one selection event handler is running at a time.
using Tekla.Structures.Drawing; using Tekla.Structures.Drawing.UI; public class Example { private Tekla.Structures.Drawing.UI.Events _events = new Tekla.Structures.Drawing.UI.Events(); private object _selectionEventHandlerLock = new object(); public void RegisterEventHandler() { _events.SelectionChange += Events_SelectionChangeEvent; _events.Register(); } public void UnRegisterEventHandler() { _events.UnRegister(); } void Events_SelectionChangeEvent() { /* Make sure that the inner code block is running synchronously */ lock(_selectionEventHandlerLock) { System.Console.WriteLine("Selection changed event received."); } } }