EventWatcher

public class EventWatcher : IDisposable
An instance-based watcher for document and object events that can be notified for headless documents.

The static events on RhinoDoc are never raised for headless documents (a headless document is one created with RhinoDoc.CreateHeadless(string) or RhinoDoc.OpenHeadless(string), as used by Rhino.Inside and Rhino.Compute). Create an EventWatcher with includeHeadlessDocuments set to true to receive events for those documents as well.

IMPORTANT: When watching headless documents, events may be raised on a thread other than the main/UI thread, because headless documents can be created and read on background threads. Handlers must be thread-safe and must not assume they are running on the UI thread.

Call Dispose() when the watcher is no longer needed to stop receiving events and release the underlying native watcher.

Constructors

EventWatcher

#Since v9.0
public EventWatcher(bool includeHeadlessDocuments)
Creates a new event watcher and begins watching.
includeHeadlessDocuments (bool)When true, events are also raised for headless documents. In this case handlers may be invoked on a non-UI thread (see the remarks on EventWatcher).

Finalizer

~EventWatcher

#
~EventWatcher()
Releases the native watcher if Dispose() was not called.

Properties

IncludeHeadlessDocuments

#Since v9.0
public bool IncludeHeadlessDocuments { get; }
Gets whether this watcher also receives events for headless documents.

Methods

Dispose

#Since v9.0
public void Dispose()
Stops watching and releases the underlying native watcher.

Events

AddRhinoObject

#Since v9.0
public event EventHandler<RhinoObjectEventArgs> AddRhinoObject
Raised when a new object is added to a document.

BeginOpenDocument

#Since v9.0
public event EventHandler<DocumentOpenEventArgs> BeginOpenDocument
Raised when a document open operation begins.

CloseDocument

#Since v9.0
public event EventHandler<DocumentEventArgs> CloseDocument
Raised when a document is closed.

DeleteRhinoObject

#Since v9.0
public event EventHandler<RhinoObjectEventArgs> DeleteRhinoObject
Raised when an object is deleted from a document.

EndOpenDocument

#Since v9.0
public event EventHandler<DocumentOpenEventArgs> EndOpenDocument
Raised when a document open operation ends.

NewDocument

#Since v9.0
public event EventHandler<DocumentEventArgs> NewDocument
Raised when a new document is created.

PurgeRhinoObject

#Since v9.0
public event EventHandler<RhinoObjectEventArgs> PurgeRhinoObject
Raised when an object is purged from a document.

ReplaceRhinoObject

#Since v9.0
public event EventHandler<RhinoReplaceObjectEventArgs> ReplaceRhinoObject
Raised when an object is about to be replaced.

UndeleteRhinoObject

#Since v9.0
public event EventHandler<RhinoObjectEventArgs> UndeleteRhinoObject
Raised when a previously deleted object is un-deleted.