Share via


Modifying Plug-in Data for Asynchronous Mode with Managed Device-Side Code (Windows Embedded CE 6.0)

1/6/2010

If your plug-in communicates in asynchronous mode and has a device-side component that uses managed code, perform the following procedure to modify the data and implement the periodic command packets that are sent back to the desktop-side component.

These steps are performed in addition to the procedure shown in Modifying Plug-in Data for Synchronous Mode with Managed Device-Side Code.

For information about the files in this procedure, see Components of a Plug-in

To modify data in an asynchronous-mode plug-in with managed device-side code

  1. In the device-side project, in the Async.cs file, the implementation of the Timer_Tick function provides an example of a function that pushes data from the device to the desktop-side component.

    To push data to the desktop-side component, your code must perform the following actions.

    • Create a new instance of the CommandPacket class. Set the CommandId property, and use the CommandPacket.AddParameterxxx methods to marshal the data that you want to send back to the desktop into the new command packet.
    • Use the CommandTransport.PushCommand method to push the command packet to the desktop.
  2. In the desktop-side project, in MyPlugin-Async.cs, the OnCommandPacketReceived function receives and handles the data that is pushed from the device. Use the CommandId property to identify the type of command packet, and then handle the data.

  3. If your data object requires a forced refresh of the views that are associated with it, to refresh these views, call the RenderViews (object hint) method.

    The hint parameter is user-definable, and can be left as null.

  4. Save your changes, and then rebuild the plug-in.

See Also

Concepts

Modifying Data Sent Between Desktop and Device Components