Пример #1
0
 /// <summary>
 /// 插件域的安装事件
 /// </summary>
 /// <param name="domain"></param>
 private void ModuleDomain_OnInstalled(PluginDomain domain)
 {
     if (this.OnModuleDomainInstalled != null)
     {
         this.OnModuleDomainInstalled(this, domain);
     }
 }
Пример #2
0
 /// <summary>
 /// 发生异常
 /// </summary>
 /// <param name="domain"></param>
 /// <param name="mex"></param>
 private void ModuleDomain_OnException(PluginDomain domain, PluginDomainException mex)
 {
     if (this.OnModulationException != null)
     {
         this.OnModulationException(this, mex);
     }
 }
Пример #3
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Initialize()
        {
            foreach (Plugin plugin in this.Plugins)
            {
                PluginDomain pluginDomain = new PluginDomain(plugin, this);
                pluginDomain.OnInstalled += ModuleDomain_OnInstalled;
                pluginDomain.OnClosed    += ModuleDomain_OnClosed;
                pluginDomain.OnException += ModuleDomain_OnException;

                this.PluginDomainCollection.Add(pluginDomain);
            }
        }
Пример #4
0
        /// <summary>
        /// 获得相关插件域里面的对外服务
        /// </summary>
        /// <param name="assemblyCatalogName"></param>
        /// <param name="typeName"></param>
        /// <returns></returns>
        public object GetService(string assemblyCatalogName, string typeName)
        {
            PluginDomain moduleDomain = this.PluginDomainCollection.Get(assemblyCatalogName);

            if (moduleDomain != null && moduleDomain.PluginDomainServices != null && moduleDomain.PluginDomainServices.Count > 0)
            {
                if (moduleDomain.PluginDomainServices.ContainsKey(typeName))
                {
                    return(moduleDomain.PluginDomainServices[typeName]);
                }
            }
            return(null);
        }
Пример #5
0
 /// <summary>
 /// 插件域的关闭事件
 /// </summary>
 /// <param name="domain"></param>
 private void ModuleDomain_OnClosed(PluginDomain domain)
 {
 }