コード例 #1
0
ファイル: MxApplication.cs プロジェクト: ikvm/webmatrix
 private object OnCreateService(IServiceContainer serviceContainer, Type type)
 {
     if (type == typeof(IComponentGalleryService))
     {
         if (this._componentGalleryService == null)
         {
             this._componentGalleryService = new ComponentGalleryService(this._serviceContainer);
         }
         return this._componentGalleryService;
     }
     if (type == typeof(IWebBrowsingService))
     {
         if (this._webBrowsingService == null)
         {
             this._webBrowsingService = new WebBrowsingService(this._serviceContainer);
         }
         return this._webBrowsingService;
     }
     if (type == typeof(IPrintService))
     {
         if (this._printService == null)
         {
             this._printService = new PrintService(this._serviceContainer);
         }
         return this._printService;
     }
     if (type != typeof(IDataObjectMappingService))
     {
         return null;
     }
     if (this._dataObjectMappingService == null)
     {
         this._dataObjectMappingService = new DataObjectMappingService(this._serviceContainer);
     }
     return this._dataObjectMappingService;
 }
コード例 #2
0
ファイル: MxApplication.cs プロジェクト: ikvm/webmatrix
 private void CloseApplication()
 {
     if ((this.ApplicationType & Microsoft.Matrix.Core.Application.ApplicationType.Workspace) != Microsoft.Matrix.Core.Application.ApplicationType.Generic)
     {
         this._serviceContainer.RemoveService(typeof(IToolboxService));
         if (this._toolboxService != null)
         {
             ((IDisposable) this._toolboxService).Dispose();
             this._toolboxService = null;
         }
         this._serviceContainer.RemoveService(typeof(IDocumentManager));
         this._serviceContainer.RemoveService(typeof(IDesignerEventService));
         if (this._docManager != null)
         {
             ((IDisposable) this._docManager).Dispose();
             this._docManager = null;
         }
         this._serviceContainer.RemoveService(typeof(IDocumentTypeManager));
         if (this._docTypeManager != null)
         {
             ((IDisposable) this._docTypeManager).Dispose();
             this._docTypeManager = null;
         }
         this._serviceContainer.RemoveService(typeof(ILanguageManager));
         if (this._languageManager != null)
         {
             ((IDisposable) this._languageManager).Dispose();
             this._languageManager = null;
         }
         this._serviceContainer.RemoveService(typeof(IProjectManager));
         if (this._projectManager != null)
         {
             ((IDisposable) this._projectManager).Dispose();
             this._projectManager = null;
         }
     }
     this._serviceContainer.RemoveService(typeof(IDataObjectMappingService));
     if (this._dataObjectMappingService != null)
     {
         this._dataObjectMappingService = null;
     }
     this._serviceContainer.RemoveService(typeof(IComponentGalleryService));
     if (this._componentGalleryService != null)
     {
         ((IDisposable) this._componentGalleryService).Dispose();
         this._componentGalleryService = null;
     }
     this._serviceContainer.RemoveService(typeof(IWebBrowsingService));
     if (this._webBrowsingService != null)
     {
         ((IDisposable) this._webBrowsingService).Dispose();
         this._webBrowsingService = null;
     }
     this._serviceContainer.RemoveService(typeof(IPrintService));
     if (this._printService != null)
     {
         ((IDisposable) this._printService).Dispose();
         this._printService = null;
     }
     this._serviceContainer.RemoveService(typeof(IPackageManager));
     if (this._packageManager != null)
     {
         ((IDisposable) this._packageManager).Dispose();
         this._packageManager = null;
     }
     this._serviceContainer.RemoveService(typeof(IPreferencesService));
     if (this._prefService != null)
     {
         this._prefService.Save();
         ((IDisposable) this._prefService).Dispose();
         this._prefService = null;
     }
     ((IDisposable) this._exceptionHandler).Dispose();
     this._exceptionHandler = null;
     this._serviceContainer.RemoveService(typeof(IApplicationIdentity));
     this._serviceContainer = null;
 }