I am trying to fetch the session name, but only manage to get if the session is available. I am using following code
private bool IsEditSessionOpen()
{
bool enabled = false;
if (Editor.EditState == EditState.StateEditing)
{
GetSessionMgrExt();
if (_mmSessionMangerExt != null)
{
IMMSession currentSession = _mmSessionMangerExt.CurrentOpenSession;
IMMSession4 currentSession4 = currentSession as IMMSession4;
//Check if we have a session open and
//if it is not a redlining session (and is therefore an edit session)
if (currentSession4 != null && !currentSession4.get_Redlining())
{
enabled = true;
}
}
}
return enabled;
}
private void GetSessionMgrExt()
{
if (_mmSessionMangerExt == null)
{
IMMPxIntegrationCache mmSessionMangerIntegrationExt = FindExtesionByName("Session Manager Integration Extension") as IMMPxIntegrationCache;
if (mmSessionMangerIntegrationExt != null)
{
_pxApp = mmSessionMangerIntegrationExt.Application;
if (_pxApp != null)
{
__PxApplication_Event pxAppEvents = _pxApp as __PxApplication_Event;
pxAppEvents.Shutdown += new __PxApplication_ShutdownEventHandler(pxAppEvents_Shutdown);
IExtensionManager extensionMgr = Activator.CreateInstance(Type.GetTypeFromProgID(
"esriSystem.ExtensionManager")) as IExtensionManager;
_mmSessionMangerExt = extensionMgr.FindExtension(name);
}
}
}
}
currentSession.get_Name(), get_ID(), get_Owner()
but it does not give me desired result.