Partager via


Adding New Nodes to a Plug-in (Windows Embedded CE 6.0)

1/6/2010

The desktop-side objects are organized such that there is always a single plug-in object that has one or more nodes shown in the Remote Tools Shell.

You can choose to add new nodes to an existing plug-in. The Remote Tools Shell displays these new nodes. There are two types of nodes, a data node and a label node. A data node displays data. A hierarchical label node, which has no data of its own, displays other nodes.

For each data node, there is one view object and one data object. Hierarchical label nodes do not have views or data associated with them.

There are no additional objects in the device-side code for each view. The device-side code processes the command packets that are sent to the device, and in the case of asynchronous mode plug-ins, the device-side code sends command packets to the desktop.

For more information, see Requirements for Plug-in Data Objects.

To add a new data node

  1. In the desktop-side component, create new PluginView and PluginData subclass implementations for the new node that you want to add.

    For example, you could call these implementations MyView2 and MyData2.

  2. Open the MyPlugin.cs file.

  3. In the MyPlugin class, create a new member string variable that contains a GUID for a new node. For example, call the variable guidChildNode2.

    To generate a new GUID in the Registry format, you can use GUIDGEN.exe, and assign it to the string. When doing this, ensure that the curly brackets are removed and that the alphabetic characters are in all lowercase. For information about Guidgen.exe, see the Visual Studio documentation.

  4. Create a member variable for the new PluginView and PluginData objects. The following code example uses this topic's example names.

    private MyData2 data2;
    private MyView2 view2;
    
  5. In the OnInit method implementation, instantiate the new MyView2 and MyData2 classes and assign them to the new member variables. Call the PluginComponent.AddData method to add the data object to the plug-in object. The following code example shows how to do it.

    this.data2 = new MyData2 (this, this.guidChildNode2);
    AddData (this.data2);
    this.view2 = new MyView2 (this.data2);
    
  6. Call the PluginComponent.AddNode method using the following syntax.

    The following code sample uses the example names used in this topic.

    AddNode(new PluginNode("Child Node2", guidChildNode2, guidTopLevelNode, this.data2, this.view2, this, BuiltInIcon.NodeData));
    
  7. Implement the data to be displayed in the new data node. Add code to both the desktop-side and device-side code to handle any new command packets you need to implement the new view.

    For more information, see Modifying Data Sent Between Desktop and Device Components.

  8. Save your changes.

To add a new hierarchical label node

  1. Open the MyPlugin.cs file.

  2. In the MyPlugin class, create a new member string variable that contains a GUID for a new node. For example, call the variable guidLabelNode.

    To generate a new GUID in the Registry format, you can use GUIDGEN.exe, and assign it to the string. When doing this, ensure that the curly brackets are removed and that the alphabetic characters are in all lowercase. For information about Guidgen.exe, see the Visual Studio documentation.

  3. Call the PluginComponent.AddNode method with the following syntax.

    The following code example shows how to do it.

    AddNode(new PluginNode("Label Node", guidLabelNode, guidTopLevelNode, null, null, this, BuiltInIcon.NodeLabel));
    
  4. Save your changes.

See Also

Concepts

Modifying Data Sent Between Desktop and Device Components

Other Resources

Modification of a Plug-in Project Created Using the Project Wizard
Remote Tools Framework Native API