Versions Compared

Key

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

...

Note

The Template device requires knowledge of either the C# or VB code languages. This page focuses solely on device usage and is not intended for a code language tutorial.

Understanding the UI

The Template Device panel is divided into three main areas.

Image Added

The area in the upper left displays the code that is currently being edited, as well as a toolbar with the following activities:

  • Set code language: Set the code language to either C# or VB. Note that changing the code language will discard the current code document and load a blank template.
  • Run the start method
  • Find text within the code
  • Comment out the selected lines of code (meaning that the lines will not be executed when the device is run)
  • Uncomment out the selected lines of code (meaning that the lines will be executed when the device is run)
  • Collapse to definitions: collapse the code so that only the highest level definitions are visible.
  • List available code snippets: display a list of code snippets that are available for use.
  • Copy device to Visual Studio: copy all device code so it can be pasted into Visual Studio and edited.
  • A drop-down that shows the methods available for editing (choosing a method will jump directly to that code in the device)

The panel on the right lists the external files and references to be used with the device. If any references are present, you can expand the tree node to view and configure them.

To manage a reference:

  1. Right-click on the appropriate tree node and choose Manage References.
  2. A pop-up window will appear, listing all .NET and Device references available. If you see the reference you want to use, check the box in the Include column.
  3. To add a reference, click Browse, navigate to the location of the reference DLL, select it, and choose Open.

To add a resource:

  1. Right-click on the Resources tree node and select Add Resource.
  2. Navigate to the location of the resource file, select it, and choose Open.

To add a data connection:

  1. Right-click on the Data Connections tree not and select Add Database Connection.
  2. Configure the connection and click OK.

The tree contains three other nodes.

Viewing the Code node

The Code tree node displays all of the code currently associated with the device and is pre-populated with two types of Code: the Template Code and the Template Context. Select one of these to view and edit the associated code (see Editing Code below). You can also add a new code object:

  1. Right-click on the Code tree node and choose Add Code File.
  2. A new tree node will appear with a default class name (e.g., Class1). To rename this class, right-click and choose Rename File.
  3. Select the new class to edit the associated code.

The right-click context menu also provides options for deleting the class and locking the file so that other users cannot edit the code.