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
[SerializableAttribute]
public sealed class Events : MarshalByRefObject

The Events type exposes the following members.

Constructors
  NameDescription
Public methodEvents
Constructs a new instance of Events.
Top
Methods
  NameDescription
Public methodInitializeLifetimeService
Initializes the lifetime service.
(Overrides MarshalByRefObjectInitializeLifetimeService.)
Public methodOnInterrupted
Called when uesr interrupts.
Public methodRegister
Registers the instance to listen to the specified events.
Public methodUnRegister
Unregisters the instance from listening to events.
Top
Events
  NameDescription
Public eventDocumentManagerClosed
The DocumentManagerClosed eventis raised when the document manager is closed.
Public eventDrawingEditorClosed
The DrawingEditorClosed event is raised when the drawing editor is closed.
Public eventDrawingEditorOpened
The DrawingEditorOpened event is raised when the drawing editor is opened.
Public eventDrawingListSelectionChanged
The DrawingListSelectionChanged event is raised when selection on the drawing list has changed.
Public eventDrawingLoaded
The DrawingLoaded event is raised when a new drawing is opened in the drawing editor.
Public eventInterrupted
Occurs when user interrupts.
Public eventSelectionChange
The SelectionChange event is raised when the selection is changed in a Tekla Structures drawing.
Top
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
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.
Previous
Next