0

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);
                }
            }
        }
    }
2
  • So what's your Question? It seems to make sense that you can't retrieve something which isn't available.
    – Vince
    Jan 29 at 12:51
  • @Vince I want to fetch the SessionName from session manager. can you help me out which class is responsible to extract session name. I tried currentSession.get_Name(), get_ID(), get_Owner() but it does not give me desired result. Jan 29 at 14:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.