Visual Studio UI Plugin Template
This template enables developers to build an STK UI Plugin quickly by setting up a properly configured, blank plugin. The template includes several useful code sample and libraries:
- Examples for adding a progress bar, a link to the plugin from the context menu, a link to the plugin from the main menu, and a link to the plugin from the toolbar
- An example of a persistent preference page, which keeps user selections even after STK is closed
- The STK code library, which is used for interacting with STK and manipulating STK objects, including simple methods to subscribe to events in STK and get a list of objects in an STK scenario
- Globe mouse events code that are commented out
To use the template to build a UI Plugin, follow the instructions below.
Copy the templates
Copy the following zip files to your Visual Studio user folder (<user area>Visual Studio<version number>Templates\ProjectTemplates\Visual C#):
Template used for creating UI plugin
<stk install folder>/CodeSamples/STKCodeSamples.zip/Extend/Ui.Plugins/Visual Studio Templates/STK13.UiPlugin.Template.zip
Do not unzip these files.
Create a new Visual Studio project
Launch Visual Studio and follow these instructions:
- Create a new project; the New Project dialog box will appear.
- In the left pane of the dialog box, select Visual C# under templates.
- In the right pane, select STK13.UIPlugin.Template.
- Enter a unique name for your project. If the name is not unique, your plugin will be in conflict with other UI plugins that have the same name.
- Click OK.
If you are using Visual Studio 2019, do not filter or search for templates. Scroll to the bottom of this list and select the STK13.UIPlugin.Template, and then skip to Step 4.
Build your project
- Open Setup.cs in the Visual Studio editor.
- Build the project.
- Instructions for installing your plugin can be found here.
Debugging your plugin
If you want to debug the plugin, you need to point your manifest file to your debug binary folder. Here are instructions for setting up the plugin for debugging:
- In Windows Explorer, go to the debug folder for the plugin and copy path.
- Go to your manifest file (C:\ProgramData\AGI\STK 13\Plugins).
- Open the XML file in the text editor of your choice and change the code path to your debug folder:
- Back in Visual Studio, switch the startup project back to the plugin and make sure that the configuration is set to Debug.
- Open the plugin project properties and select the Debug tab. Change Start Action to Start External Program and select AgUiApplication.exe in the STK installed bin folder.
XML Manifest File
<?xml version = "1.0"?>
<AGIRegistry version = "1.0">
<CategoryRegistry>
<Category Name = "UiPlugins">
<NETUiPlugin
DisplayName="Demo plugin"
TypeName="Stk13.UiPlugin.Demo.Setup"
AssemblyName="Stk13.UiPlugin.Demo"
CodeBase="D:\MyProjects\UIPlugin\Stk13.UiPlugin.Demo\Stk13.UiPlugin.Demo\bin\Debug">
</NETUiPlugin>
</Category>
</CategoryRegistry>
</AGIRegistry>