Back to main C# extensions page
Introduction
The Spotfire API provides an extension point for creating event handlers associated with the application. The only event currently available fires when the application is started. Its intended usage is to automatically load data or initate a custom workflow. It can also be used to register event handlers for the DocumentChanged event. Such handlers can, for instance, be used to add custom nodes to the document when it is opened.
Prerequisites
- Spotfire® Developer (SDK), see download instructions here.
- Spotfire® Analyst, download from here.
- Microsoft Visual Studio® 2013 or higher. The free Community edition is available for download here.
Implementation
Define a class inheriting from CustomApplicationEventHandler. Override the OnApplicationInstanceCreated method. The snippet below displays a message box as soon as the application is started:
class MyEventHandler : CustomApplicationEventHandler { protected override void OnApplicationInstanceCreated(AnalysisApplication application) { base.OnApplicationInstanceCreated(application); // Do something with the application ... MessageBox.Show("The application has started!"); } }
Register the event handler in the add-in class:
class MyAddIn : AddIn { protected override void RegisterApplicationEventHandlers(AddIn.ApplicationEventHandlerRegistrar registrar) { base.RegisterApplicationEventHandlers(registrar); registrar.Register(new MyEventHandler()); } }
Recommended Comments
There are no comments to display.