NET Managed (UI) Plugins

Many custom made, registration free, NET Managed UI Plugins can be found on AGI's Github.

Registration free XML manifest file

The STK application uses an XML manifest file to discover and load plugins at runtime. Using either Visual Studio or a text editor, you can create a new XML file. AGI recommends naming the XML file with the same name as your plugin (MySampleUiPlugin.xml). Below is an example of the required format for .NET Ui Plugins.

If you are deploying a previously made Plugin (like one from Github), you must edit the file directory in the *.dll file.

Generate a *.dll file from your Ui Plugin Visual Studio Solution file (*.sln) by running it. An error may result, but keep going. The *.dll will generate to C:\your file Ui Plugin File Directory\bin\Debug.

.NET UI Plugin Manifest

<?xml version = "1.0"?>
<AGIRegistry version = "1.0">
     <CategoryRegistry>
          <Category Name = "UiPlugins">
	     <NETUiPlugin 
		DisplayName="Rectangular Sensor UI Plugin (Examples)"
		TypeName="RectangularSensorPlugin.RectangularSensorPlugin"
		AssemblyName="RectangularSensorPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
		CodeBase="Insert DLL file path">
	     </NETUiPlugin>
	    </Category>
     </CategoryRegistry>
</AGIRegistry>
		

XML file location

This XML file must be saved in one of these locations, where the STK application will see it:

  1. STK User Config Plugins directory (usually Documents\STK 13 \Config\Plugins)
  2. Plugins registered here will be available only to the single user with access to this My Documents folder. Usually does not require administrative privileges.

  3. STK Install folder (usually <Install_Dir>\Plugins)
  4. Plugins registered here will be available to all STK users on this machine. Usually requires administrative privileges to save/modify files here.

XML Manifest file anatomy

Option Description
DisplayName Name displayed in the STK User Interface
AssemblyName Name of the *.dll file
TypeName Name of the setup file for the plugin. It can be found in the plugin namespace alongside the GUID and ProgID information. Usually the *.dll name has *.BasicCSharpPlugin appended to it.
CodeBase Path to directory where the *.dll file is located.

Manifest Location

When the STK application starts, it searches for XML files contained in identified folders and registers all plugins declared in each XML file found. Any changes made to these files after start-up will not take effect until the next time the application starts. The STK application looks at the following folders for XML plugin registration files:

  • <Install_Dir>\Plugins.
  • Windows All Users Application area:
  • <STK all users area>\Plugins

  • Windows Configuration area:
  • <STK all users area>\Config

XML registration files located in the following folders are available for every user:

  • <Install_Dir>\Plugins
  • <STK all users area>\Plugins

XML registration files located in <STK user area>\Config\Plugins will be available only for that user.

Compiled Plugins & Registration

A .NET UI Plugin component relies on a particular format for an XML manifest file registration.

Compiled components are contained in a dynamic link library, whose filename has an extension 'dll'. To register a .NET UI plugin component, create a command window (under the Start menu, hit "Run ...", type 'Command' and hit OK). Change your directory (using cd) to that of the file. At the command prompt, type 'regasm /codebase YOUR_UIPLUGINNAME'. For example:

regasm /codebase YOUR_UIPLUGINNAME.dll

The RegAsm tool is used to register .NET assemblies as COM components, allowing COM clients (like the STK application) to access .NET classes. This ensures your plugin is loadable into the STK application.

To guarantee this access along with the RegAsm registration, ensure the code contains the ComVisible(True) attribute. This is found in the plugin's AssemblyInfo.cs file.

Your system may not recognize the regasm command. In that case, you will need to specify the full filepath to RegAsm.exe. The file itself is found in a sub-folder of C:\WINDOWS\Microsoft.NET\Framework\. The actual folder depends on your version of the .NET Framework installed on your machine.

Setting ComVisible to false makes the types in this assembly not visible to COM components. If you need to access a type in this assembly from COM, set the ComVisible attribute to true on that type.

[assembly: ComVisible(true)]

COM Registered .NET UI Plugin Manifest

The registration has the following form:

.NET UI Plugin Manifest

<?xml version = "1.0"?>
<AGIRegistry version = "1.0">
   <CategoryRegistry>
        <Category Name = "UiPlugins">
           <UiPlugin DisplayName="Display Name"
                ProgID = "Your_ProdID"
                File = "Filepath/NameofComponent.dll"
		DisplayName: "Your_DisplayName">
          </UiPlugin>
	</Category>
   </CategoryRegistry>
</AGIRegistry>

XML Manifest Anatomy

Option Description
ProgID unique string used to identify your plugin to the STK application. This can be found in the class attributes of your UiPlugin, alongside the GUID:
[ProgID("MyCompany.MySampleUIPlugin")]
UiPlugin DisplayName Name displayed in the STK application UI. This is an optional addition to the XML manifest.
DisplayName The name of your .dll file.

Refer to "XML File location." Your XML file must be saved in one of these locations.

Related Topics

You may also want to learn more about:

  • Extend the User Interface Using HTML Pages
  • Extending the Engine