public void RegisterSource(NodeId nodeId, object source, object handle, bool isEventSource)
{
if (nodeId == null) throw new ArgumentNullException("nodeId");
if (source == null) throw new ArgumentNullException("source");
#if LEGACY_CORENODEMANAGER
try
{
m_lock.Enter();
ILocalNode node = GetManagerHandle(nodeId) as ILocalNode;
if (node == null)
{
throw new ServiceResultException(StatusCodes.BadNodeIdInvalid);
}
if (isEventSource)
{
IEventSource eventSource = source as IEventSource;
if (eventSource != null)
{
m_eventSources[source] = eventSource;
}
}
// remove existing handle.
SourceHandle existingHandle = node.Handle as SourceHandle;
if (existingHandle != null)
{
UnregisterSource(existingHandle.Source);
}
// add a new handle.
if (source != null)
{
node.Handle = new SourceHandle(source, handle);
}
else
{
node.Handle = null;
}
}
finally
{
m_lock.Exit();
}
#endif
}