|
![]() |
Differs fom other plugin types in that the plugin is not delay loaded.
A typical implementation will subscribe to some API events in
OnLoaded and
unsubscribe in OnUnloading.
Namespace: Autodesk.Navisworks.Api.Plugins
Assembly: Autodesk.Navisworks.Api (in Autodesk.Navisworks.Api.dll)
Syntax
Remarks
Many advanced GUI addins need to subscribe to events in the Navisworks API. The existing plugins are designed specifically so that they are loaded as late as possible. An EventWatcherPlugin is the one type of plugin that is always loaded and activated as soon as possible and which will remain active for the duration of the session.
The EventWatcherPlugin offers no extra methods or functionality beyond those already present on the Plugin base type.
A typical implementation will subscribe to some API events in OnLoaded and unsubscribe in OnUnloading.

Examples

using System.Windows.Forms; using Autodesk.Navisworks.Api; using Autodesk.Navisworks.Api.Plugins; namespace EventWatcher { [Plugin("EventWatcher", "ADSK", DisplayName = "Event Watcher")] public class EventWatcher : EventWatcherPlugin { public override void OnLoaded() { //The plugin will be loaded as soon as is possible in the GUI Autodesk.Navisworks.Api.Application.GuiCreated += Application_GuiCreated; Autodesk.Navisworks.Api.Application.GuiDestroying += Application_GuiDestroying; } public override void OnUnloading() { //The plugin is unloaded at the end of the Navisworks session Autodesk.Navisworks.Api.Application.GuiCreated -= Application_GuiCreated; Autodesk.Navisworks.Api.Application.GuiDestroying -= Application_GuiDestroying; } /// <summary> /// simple event handler for Application.GuiCreated /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Application_GuiCreated(object sender, System.EventArgs e) { MessageBox.Show("The Gui has been created"); } /// <summary> /// simple event handler for Application.GuiDestroying /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Application_GuiDestroying(object sender, System.EventArgs e) { MessageBox.Show("The Gui is being destroyed"); } } }
Inheritance Hierarchy
System..::..Object
Autodesk.Navisworks.Api.Plugins..::..Plugin
Autodesk.Navisworks.Api.Plugins..::..EventWatcherPlugin
Autodesk.Navisworks.Api.Plugins..::..Plugin
Autodesk.Navisworks.Api.Plugins..::..EventWatcherPlugin