Compartilhar via


Installing Plug-Ins

Note: this entry references code for an older version of VE3D. The newest code samples are here

Some types of plug-ins feature special data or rendering, and are intended to be used with a particular website. Others are intended to enhance the experience of all websites, and run every time a user runs VE3D. Most of the samples given so far have been about the former, where the test html page references the plug-in you wish to load. Today we’ll talk about the latter.

In addition, there is currently a limitation that plug-ins must be installed in the GAC in order to run. This is true regardless of what category the plug-in falls under. End users of a plug-in will need a way of installing the plug-in. Fortunately writing an installer is easy with Visual Studio.

The first link contains the source code for the plug-in itself and the deployment project. The plug-in is set up to run in a test page just like the others, but the intended way to use this solution is to build PlugInSetup. That project will take the output of the plug-in project, add it to an MSI along with some appropriate verbiage, and a setup.exe bootstrapper to run the MSI. Once those are built, the setup.exe and MSI combination can be distributed to end users. In my case, I created a self-extracting zip archive – the output is the second link. Visual Studio won’t do this directly, so use your favorite tool to create a nice single package for users. This method doesn’t necessarily create the most elegant installer, and any installer package that has the same features could be used, but this one works and is easy to use.

The important parts of the PlugInSetup projects are the files to include and the various text messages to display. Right click on the project name, and select View -> File System. The file locations we’d like to install to are shown. In order to run an automatically-running plug-in, we must install to a special location under VE3D’s install path, as seen here. A plug-in that loads on demand, as from a custom website, would install to its own Program Files directory. For this plug-in, there are no user-specific resources so all users will be able to use the plug-in when they run VE3D.

Adding output to Program Files

We also must add our plug-in to the Global Assembly Cache. This can be seen below.

Adding output to the GAC.

New files may be added to both by right clicking in the right-hand side of the main view, and new locations may be added by right-clicking in the left-hand side.

We may also modify various items like author name and contact info by clicking on the PlugInSetup project and looking at the properties page.

Deployment Project Properties page

The plug-in itself is a simple project to remember camera viewpoints and fly back to them when the user presses a key. It has no UI elements except for notifications on error, which is desirable for a plug-in that will always be run. Ideally, some form of instruction for the user would appear on startup or during the install but for now we are keeping it simple. To save a viewpoint, hold shift and then press a number key from 1 to 4. To return to that viewpoint, even after restarting the app, press the same number key again, this time without holding shift. To reset all the views, press 0.

The project uses the bindings system with a config file, meaning that end users may change the keys used by editing the ShortcutBindings.xml file (see the code for comments on the location of this file). It also uses IsolatedStorage for safe persistence of data, unique to the plug-in and user (so different users may have different saved views). The code has comments that hopefully explain what's going on, but some of it, bindings especially, will be a topic for a future post.

 

Enjoy!

Comments

  • Anonymous
    May 03, 2008
    You've been kicked (a good thing) - Trackback from DotNetKicks.com

  • Anonymous
    March 04, 2009
    Ever since I got a Touchsmart at home I've been very interested in the desktop touch experience, and