Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Summary

API Access from C#

To start off, lets look at a simple C# console application which controls Microwave Office. For this example we'll use Visual Studio as the development environment.

Project Setup

  1. Inside Visual Studio create a new solution, and from the C# options we select C# Console Application.

  2. Next to access the object model for the API we need to add a reference to the API type library.

    1. The type library provides information about all the objects exposed by the API to the development environment.

    2. In the Solution Explorer window right click on the References tree item and select "Add Reference…"

    3. In the Add Reference Dialog select the "COM" tab.

    4. In the list box find an entry that starts with "AWR Design Environment <year>" highlight that entry and click 'Select'.

    5. The entry will appear in the lower list box labeled "Selected Components", see Figure 6 below.

    6. Now Click OK and the reference will be added to the list of references in the solution explorer tree, see Figure 7 below .

Image Modified

The Add Reference dialog allows you to set references to a number of components by selecting each adding the reference and then approving all the components at the end. So first locate the 'AWR Design Environment <year>' entry under the Component Name in the upper list box. Select the line and press the Select key. The highlighted component will then be moved to the lower list of selected components.

Image Modified

Once the OK button is pressed the MWOffice reference should appear in the list of references in the solution explorer.

Code Snippets

Now open the main C# code file for the project and locate the Main function in the console class, it should look something like this:

...