How to Use Existing Interaction Client (IC) Connection in Your Addin

Every time you instantiate a session in your IC addin, a new connection is made to the I3 server. It does not matter whether it got connected or failed, it’s there. If your addin is specific to a user or a station, you can use the Interaction Client’s session without having to create a separate one. If you make use of ConnectionStateChanged event of the Session object, you can reuse the session even when it changes.

When your addin is instantiated and you override the OnLoad method, you get to have IServiceProvider passed in. This provider class allows you to access the already established by IC session. To grab it, all you’d have to do is this:

protected override void OnLoad(IServiceProvider serviceProvider)
{
	var mySession = serviceProvider.GetService(typeof(Session)) as Session;
}

Now you don’t have to worry about it!

A maybe not so small note follows: make sure you have SU10 installed on your SDK for this to work, it appears SU9 does not – do it on your local machine. If you use a setup project to deploy to your client machines that are on SU9, do not include ININ dlls from SDK SU10 in your msi, let it use IC dlls that are already there, otherwise you may get a plugin failed to load.

Note or question – looking forward! 🙂

This entry was posted in I3 / Interactive Intelligence and tagged , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *