Hi KevinG!
I tried to do it your way but I can't get the session. I verified that the CIC has the IceLib SDK license.
That's my test code:
using System;
using ININ.InteractionClient.AddIn;
using ININ.IceLib.Connection;
namespace AddIn_SessionTest
{
public class Class1 : IAddIn
{
Session m_Session = null;
ITraceContext m_TraceContext = null;
INotificationService m_Notification = null;
///
/// The code here runs when the client loads the add-in.
///
///
public void Load(IServiceProvider serviceProvider)
{
m_TraceContext = (ITraceContext)serviceProvider.GetService(typeof(ITraceContext));
m_TraceContext.Status("AddIn \"AddIn_SessionTest\":\nGetting Notification service.");
m_Notification = (INotificationService)serviceProvider.GetService(typeof(INotificationService));
//must have the IceLib SDK license to get the session as a service
try
{
m_TraceContext.Status("AddIn \"AddIn_SessionTest\":\nGetting Session...");
m_Session = (Session)serviceProvider.GetService(typeof(Session));
// register to user status changes only if we have a session!!!
if (m_Session != null)
{
m_TraceContext.Status("AddIn \"AddIn_SessionTest\":\nGetting Session: OK");
}
else
{
m_TraceContext.Warning("AddIn \"AddIn_SessionTest\":\nGetting Session: Failed");
}
}
catch (Exception exc)
{
m_TraceContext.Error("AddIn \"AddIn_SessionTest\":\nException: getting Session: Failed\nMessage: " + exc.Message);
}
}
///
/// Called by Client when the AddIn is about to be unloaded, e.g. in case of Client exit
///
public void Unload()
{
}
}
}
In ININ Log Viewer I got the following messages for Topic "IceLib_Custom":
N Tracing.TraceStatus : AddIn "AddIn_SessionTest": Getting Notification service. 10:46:33.3888295_0000 IceLib_Custom 0x2490 41
N Tracing.TraceStatus : AddIn "AddIn_SessionTest": Getting Session... 10:46:33.3918295_0000 IceLib_Custom 0x2490 41
W Tracing.TraceWarning : AddIn "AddIn_SessionTest": Getting Session: Failed 10:46:33.3928295_0000 IceLib_Custom 0x2490 21
Is there any way to check by coding using the interface IAddIn if an IceLib SDK license is available? I guess not...
Thanks,
Robert