Beispiel #1
0
        /// <summary>
        /// Shuts down AoInitialize object and check back in extensions to ensure
        /// any ESRI libraries that have been used are unloaded in the correct order.
        /// </summary>
        /// <remarks>Once Shutdown has been called, you cannot re-initialize the product license
        /// and should not make any ArcObjects call.</remarks>
        public void ShutdownApplication()
        {
            if (m_hasShutDown)
            {
                return;
            }

            //Check back in extensions
            foreach (KeyValuePair <esriLicenseExtensionCode, esriLicenseStatus> item in m_extensionStatus)
            {
                if (item.Value == esriLicenseStatus.esriLicenseCheckedOut)
                {
                    m_AoInit.CheckInExtension(item.Key);
                }
            }

            m_requestedProducts.Clear();

            if (m_requestedExtensions != null)
            {
                m_requestedExtensions.Clear();
            }
            m_extensionStatus.Clear();
            m_productStatus.Clear();
            m_AoInit.Shutdown();
            m_hasShutDown = true;
            //m_hasInitializeProduct = false;
        }
        public esriLicenseStatus CheckinExtension(esriLicenseExtensionCode extensionCode)
        {
            esriLicenseStatus status = _aoInitialize.CheckInExtension(extensionCode);

            if (status == esriLicenseStatus.esriLicenseCheckedIn)
            {
                if (_initializedExtensions != null)
                {
                    _initializedExtensions.Remove(extensionCode);
                }
            }

            return(status);
        }
        public void Dispose()
        {
            lock (_mutexLocker)
            {
                if (m_pAoInit == null)
                {
                    return;
                }

                if (m_extensionCode > 0 &&
                    m_pAoInit.IsExtensionCheckedOut((esriLicenseExtensionCode)m_extensionCode))
                {
                    m_pAoInit.CheckInExtension((esriLicenseExtensionCode)m_extensionCode);
                }
                UnRegisterLicenseService();
                m_pAoInit = null;
            }
        }
Beispiel #4
0
        public void ShutdownApplication()
        {
            if (m_AoInitialize == null)
            {
                return;
            }

            //Checkin the extensions
            if (m_initExts != null)
            {
                foreach (esriLicenseExtensionCode extLicense in m_initExts)
                {
                    if (m_AoInitialize.CheckInExtension(extLicense) != esriLicenseStatus.esriLicenseCheckedIn)
                    {
                        //Silent check in error
                        //System.Diagnostic.Trace.WriteLine(LicenseMessage(licenseStatus), "ESRI License Initializer")
                    }
                }
            }
            //Shut down the AoInitialize object
            m_AoInitialize.Shutdown();
            m_AoInitialize = null;
        }