private object CreateService(IServiceContainer container, Type serviceType)
        {
            object service = null;

            if (typeof(PythonLanguage) == serviceType)
            {
                PythonLanguage language = new PythonLanguage();
                language.SetSite(this);
                RegisterForIdleTime();
                service = language;
            }
            else if (typeof(IPythonLibraryManager) == serviceType)
            {
                libraryManager = new PythonLibraryManager(this);
                service        = libraryManager as IPythonLibraryManager;
            }
            return(service);
        }
 protected override void Dispose(bool disposing)
 {
     try {
         if (componentID != 0)
         {
             IOleComponentManager mgr = GetService(typeof(SOleComponentManager)) as IOleComponentManager;
             if (mgr != null)
             {
                 mgr.FRevokeComponent(componentID);
             }
             componentID = 0;
         }
         if (null != libraryManager)
         {
             libraryManager.Dispose();
             libraryManager = null;
         }
     } finally {
         base.Dispose(disposing);
     }
 }
 private object CreateService(IServiceContainer container, Type serviceType)
 {
     object service = null;
     if (typeof(PythonLanguage) == serviceType) {
         PythonLanguage language = new PythonLanguage();
         language.SetSite(this);
         RegisterForIdleTime();
         service = language;
     } else if (typeof(IPythonLibraryManager) == serviceType) {
         libraryManager = new PythonLibraryManager(this);
         service = libraryManager as IPythonLibraryManager;
     }
     return service;
 }
 protected override void Dispose(bool disposing)
 {
     try {
         if (componentID != 0) {
             IOleComponentManager mgr = GetService(typeof(SOleComponentManager)) as IOleComponentManager;
             if (mgr != null) {
                 mgr.FRevokeComponent(componentID);
             }
             componentID = 0;
         }
         if (null != libraryManager) {
             libraryManager.Dispose();
             libraryManager = null;
         }
     } finally {
         base.Dispose(disposing);
     }
 }