Adding Context Participant Control to an Application
To enable an application to become a context participant create a class that implements the IContextParticipant interface. The class implementation is required to be a COM object. As a result the ComVisibleAttribute is required when declaring the class.
C#
[ComVisible(true)]T
public class ContextParticipant:IContextParticipant
{
}
VB
<ComVisible(True)>_
Public Class ContextParticipant
Implements IContextParticipant
End Class
Joining a Context Session To become a participant in a context session:
First create a Context Manager. The LEADTOOLS CCOW SDK provides a convenient method that allows you easily create a Context Manager. To create the Context Manager do the following:
IContextManager ContextManager = Utils.COMCreateObject<IContextManager>("CCOW.ContextManager");
Once a context manager has been created, call the IContextManager.JoinCommonContext method to become a participant.
Current Context Participant State
After an application has joined a context session, call the IContextData.GetItemNames method and the IContextData.GetItemValues method to get the current context session state.
Leave or Suspend a Link to a Context Session
Rejoining a Context Session
If an application has suspended its participation in a context session by calling the IContextManager.SuspendParticipation method it can rejoin the session by calling the IContextManager.ResumeParticipation method. If the application has disconnected from the context session by calling the IContextManager.LeaveCommonContext method it will need to call the IContextManager.JoinCommonContext method to rejoin the context session.
Initiating a Context Change
When initiating a context change, an application needs to perform the following steps:
Handling a Survey To handle a survey request an application needs to respond to the IContextParticipant.ContextChangesPending method. It should return the appropriate response string (accept, conditionally _accept) based on the current application state.
Handling Survey Failure During a context change transaction, the application that instigated the context transaction informs participants that it has completed the context change by calling the ContextManager.EndContextChanges. If any participant applications are unable to make the change, the user will be informed that there is a problem. To complete the changes the instigating application will need to call IContextmanager.LeaveCommonContext. This disconnects the instigating application from the context session and prevents spreading the changes to the other session participants.
Participating in a Secure Context System In order to participate in a context system and securely bind to the ContextManager, an application needs to perform the following steps:
Authentication Repository The LEADTOOLS CCOW SDK implements the interface IAuthenticationRepository. Users wishing to implement an Authentication Repository need to derive a class from the IAuthenticationRepository interface.
public class AuthenticationRepository:IAuthenticationRepository
{
}
All context agents (mapping, annotation and action) implement the Leadtools.Ccow.IContextAgent interface. The difference between the context agents is in the implementation of the agent's Leadtools.Ccow.IContextParticipant.ContextChangesPending(System.Int32,System.String@) method.
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET