Partager via


Support for Data Push from the Device (Windows Embedded CE 6.0)

1/6/2010

You can choose to design your plug-in to receive data that is pushed from the target device. To do this, you must ensure that the following three conditions are met.

  • The desktop-side component must implement an event handler for when command packets arrive from the device.
  • The device-side application must run asynchronously. For more information, see Requirements for Device-Side Components.
  • The plug-in data objects must force the views in the Remote Tools Shell to refresh.
    After a given data object has changed its data in response to the pushed command from the device, call the base.RenderViews(hint) method to refresh the views associated with the data object.

Creating an Event Handler

In the desktop-side component, the main plug-in object has a virtual method called OnCommandPacketCreated that you can override to add an event handler for incoming command packets.

The following code example shows how to do it.

protected override void 
OnCommandPacketCreated (CommandTransport transport)
{
    //
    // Enable push by setting up an event handler
    //
    transport.CommandReceived += 
      new EventHandler<CommandTransportCommandEventArgs>
          (transport_CommandReceived);
}

void transport_CommandReceived
  (object sender, CommandTransportCommandEventArgs e)
{
    //
    // Do something
    //
}

See Also

Concepts

General Plug-in Design Requirements