Events Class |
The Events class allows the user to register event listeners for drawing user interface events.
Inheritance Hierarchy
Namespace: Tekla.Structures.Drawing.UI
Assembly: Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2023.0.3
Syntax
The Events type exposes the following members.
Constructors
Methods
Name | Description | |
---|---|---|
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.
|
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.
| |
SelectionChange |
The SelectionChange event is raised when the selection is changed in a Tekla Structures drawing.
|
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; 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."); } } }
See Also