Click here to download EventSample VB v 2.0 for VSTA v 2
Overview:
This sample is intended to expose several common tasks in VSTA, including: declaring an object, using and manipulating a form, and handling form events and event args. This sample contains a very simple object, form, application with a basic VSTA integration, and an add-in. An EventHelper is used to prevent any errors in add-in event handling.
To run the sample, extract the files, open and build the EventSample solution, then run the setup file included (double click or use the command “cscript SetupEventSample.js” from a command prompt). Next, open and build the add-in solution included in the Samples folder. Run the EventSample application, which should now automatically find and load the sample add-in included.
The EventSample application records button clicks and input from a text box in a list box. The sample add-in responds to mouse clicks on any of the buttons on the form, to adding input through the add button, clearing the display, and selecting the Open button. Event handling for the Save and Close buttons in the add-in is not implemented.
Included in this sample:
|
Item
|
Description
|
|
MainForm
|
Main user form and empty code class.
|
|
Program
|
Starting point in the host application.
|
|
MainApplication
|
Main application class. All application specific code is here.
|
|
MainObject
|
Main object used by the MainApplication class. Consists of a string.
|
|
EventArgs
|
Contains class definitions for custom event used by the MainApplication.
|
|
EventHelper
|
Class taken from ShapeApp samples to manage events from the host application and add-ins.
|
|
VstaRunTimeIntegration
|
Class based on the ShapeApp samples which uses the VSTA pipeline to load and manage add-ins.
|
|
HostItemProvider
|
Class based on the ShapeApp samples which allows add-ins to access the host object model.
|
|
HostTypeMapProvider
|
HTMP file generated by ProxyGen and translated into Visual Basic. Maps the types to canocial names for translation between the host and add-ins.
|
|
EventSampleProxy
|
Proxy file generated by ProxyGen and updated to allow generic event handling.
|
|
EventSampleProject1
|
A sample add-in that interacts with the events of the host application.
|
Posted
Sep 02 2008, 01:43 PM
by
Melody