User Interface (UI) Plugins Technology
The UI plugins framework consists of a hosting environment and the hosted components discovered and loaded at run-time. A hosted component, or plugin, is a COM object that implements interfaces required by the hosted environment to invoke the object's methods at run-time. Plugins may be implemented in a variety of languages (Visual Basic,Visual C#, C++, etc.) that support COM interfaces. The hosting environment is a GUI or GUI-less application that makes use of the UI plugins framework. A hosting environment is responsible for activation and management of the lifetime of the plugins. In addition, a hosted environment supplies information about itself and its capabilities to the plugins during their initialization.
Implementing Key Interfaces
To create a UI plugin you need to implement a few interfaces from the AgUiPlugins
library (AGI.Ui.Plugins namespace). You can implement the AgUiPlugins interface from any technology where it is possible to implement COM interfaces.
The first figure outlines the most significant UI plugin interfaces:
- The IAgUiPlugin interface must be implemented to define a UI plugin.
- The IAgUiPluginCommandTarget interface is required to process commands from context menus and toolbars.
- The IAgUiPluginEmbeddedControlSite interface must be implemented for custom windows (if any) hosted within the integrated environment.
- If you want to expose any configuration pages accessible from the Edit --> Preferences dialog you need to implement the IAgUiPluginConfigPageActions interface.
Methods & Properties Associated With Key Interfaces
The figure below outlines the methods an properties associated with the most significant UI plugin interfaces:
Using the Object Model With User Interface (UI) Plugins
User interface (UI) Plugins can access and manipulate the STK scenario and objects using the STK Object Model. The STK Object Model can be accessed by interrogating the UI Plugin object site. At this time the STK Object Model is only available for the UI Plugins running inside STK.
using AGI.STKObjects;
using AGI.Ui.Plugins;
using AGI.Ui.Application;
void IAgUiPlugin.OnStartup(IAgUiPluginSite pSite)
{AgUiApplication oApp = pSite.Application as AgUiApplication;
if (oApp != null)
{IAgStkObjectRoot root = oApp.Personality2 as IAgStkObjectRoot;}}