This section describes how to add ActiveSync synchronization to an UltraLite.NET application, and how to register your application for use with ActiveSync on your end users' computers.
ActiveSync synchronization can only be initiated by ActiveSync. ActiveSync initiates synchronization when the device is placed in the cradle or when Synchronize is selected from the ActiveSync window.
When ActiveSync initiates synchronization, the MobiLink provider for ActiveSync starts the UltraLite application, if it is not already running, and sends a message to it. Your application must implement a ULActiveSyncListener object to receive and process messages from the MobiLink provider. Your application must specify the listener object using the SetActiveSyncListener method, where MyAppClassName is a unique Windows class name for the application.
dbMgr.SetActiveSyncListener( "MyAppClassName", listener );
For more information, including sample code, see ULActiveSyncListener interface.
When UltraLite receives an ActiveSync message, it invokes the specified listener's ActiveSyncInvoked method on a different thread. To avoid multi-threading issues, your ActiveSyncInvoked method should post an event to the user interface.
If your application is multi-threaded, use a separate connection and use the lock keyword in C# or SyncLock keyword in Visual Basic .NET to access any objects shared with the rest of the application. The ActiveSyncInvoked method should specify a ULStreamType.ACTIVE_SYNC for its connection's SyncParms.Stream and then call ULConnection.Synchronize.
When registering your application, set the following parameter:
Class Name The same class name the application used with the Connection.SetActiveSyncListener method.
Discuter à propos de cette page dans DocCommentXchange.
|Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0|