/// <summary> /// When disposed - likely will never get called /// </summary> /// <param name="disposing">True when disposing</param> protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (!disposing) { return; } if (_mainCatalog != null) { _mainCatalog.Dispose(); _mainCatalog = null; } if (_container != null) { _container.Dispose(); _container = null; } _mefDebugger = null; _disposed = true; }
/// <summary> /// Called by an application in order to initialize the application extension service. /// </summary> /// <param name="context">Provides information about the application state. </param> public void StartService(ApplicationServiceContext context) { var logLevel = LogSeverityLevel; if (context.ApplicationInitParams.ContainsKey(Constants.INIT_PARAM_LOGLEVEL)) { logLevel = (LogSeverity) Enum.Parse(typeof(LogSeverity), context.ApplicationInitParams[Constants.INIT_PARAM_LOGLEVEL], true); } _mainCatalog = new AggregateCatalog(new DeploymentCatalog()); // empty one adds current deployment (xap) _container = new CompositionContainer(_mainCatalog); CompositionHost.Initialize(_container); CompositionInitializer.SatisfyImports(this); if (Logger == null) { ILogger defaultLogger = new DefaultLogger(logLevel); _container.ComposeExportedValue(defaultLogger); } else { Logger.SetSeverity(logLevel); } DeploymentService.Catalog = _mainCatalog; DeploymentService.Container = _container; _mefDebugger = new MefDebugger(_container, Logger); }
/// <summary> /// When disposed - likely will never get called /// </summary> /// <param name="disposing">True when disposing</param> protected virtual void Dispose(bool disposing) { if (_disposed) return; if (!disposing) return; if (_mainCatalog != null) { _mainCatalog.Dispose(); _mainCatalog = null; } if (_container != null) { _container.Dispose(); _container = null; } _mefDebugger = null; _disposed = true; }
/// <summary> /// Called by an application in order to initialize the application extension service. /// </summary> /// <param name="context">Provides information about the application state. </param> public void StartService(ApplicationServiceContext context) { var logLevel = LogSeverityLevel; if (context != null) { foreach (var item in context.ApplicationInitParams) { Application.Current.Resources.Add(item.Key, item.Value); } if (context.ApplicationInitParams.ContainsKey(Constants.INIT_PARAM_LOGLEVEL)) { logLevel = (LogSeverity) Enum.Parse(typeof(LogSeverity), context.ApplicationInitParams[Constants.INIT_PARAM_LOGLEVEL], true); } else if (context.ApplicationInitParams.ContainsKey(HttpUtility.UrlEncode(Constants.INIT_PARAM_LOGLEVEL))) { logLevel = (LogSeverity) Enum.Parse(typeof(LogSeverity), HttpUtility.UrlDecode(context.ApplicationInitParams[HttpUtility.UrlEncode(Constants.INIT_PARAM_LOGLEVEL)]), true); } } _mainCatalog = new AggregateCatalog(new DeploymentCatalog()); // empty one adds current deployment (xap) _container = new CompositionContainer(_mainCatalog); CompositionHost.Initialize(_container); CompositionInitializer.SatisfyImports(this); if (Logger == null) { ILogger defaultLogger = new DefaultLogger(logLevel); _container.ComposeExportedValue(defaultLogger); } else { Logger.SetSeverity(logLevel); } DeploymentService.Catalog = _mainCatalog; DeploymentService.Container = _container; _mefDebugger = new MefDebugger(_container, Logger); }