Called once just before the plugin is unloaded. If the plugin implements
IDisposable, then
Dispose will be called immediately after the plugin is unloaded.
Plugins are typically unloaded at application shutdown or when the end user has disabled a plugin.
Default implementation does nothing.
This is a good place to unsubscribe from API events.
Namespace: Autodesk.Navisworks.Api.Plugins
Assembly: Autodesk.Navisworks.Api (in Autodesk.Navisworks.Api.dll)
Syntax
| Visual Basic |
|---|
Public MustOverride Sub OnUnloading |
| C# |
|---|
public abstract void OnUnloading() |
| Visual C++ |
|---|
public:
virtual void OnUnloading() abstract override |
Examples
CopyBuilding an EventWatcherPlugin
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()
{
Autodesk.Navisworks.Api.Application.GuiCreated += Application_GuiCreated;
Autodesk.Navisworks.Api.Application.GuiDestroying += Application_GuiDestroying;
}
public override void OnUnloading()
{
Autodesk.Navisworks.Api.Application.GuiCreated -= Application_GuiCreated;
Autodesk.Navisworks.Api.Application.GuiDestroying -= Application_GuiDestroying;
}
void Application_GuiCreated(object sender, System.EventArgs e)
{
MessageBox.Show("The Gui has been created");
}
void Application_GuiDestroying(object sender, System.EventArgs e)
{
MessageBox.Show("The Gui is being destroyed");
}
}
}
See Also