Ejemplo n.º 1
0
 static void EnsurePlugInLoader(string appPath)
 {
     if (_plugInLoader == null)
     {
         PlugInLoadHelper plugInLoadHelper = new PlugInLoadHelper(appPath);
         DrectSoftConfigurationSectionHandler.SetConfigurationDelegate(plugInLoadHelper.ReadPlugInLoadConfiguration);
         PlugInLoadConfiguration plugInLoadConfig = (PlugInLoadConfiguration)ConfigurationManager.GetSection(PlugInLoadConfigSectionName);
         _plugInLoader = new PlugInLoader(appPath, plugInLoadConfig);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 实现读取自定义工具条配置信息的委托实现
        /// </summary>
        /// <param name="section"></param>
        /// <returns></returns>
        public PlugInLoadConfiguration ReadPlugInLoadConfiguration(XmlNode section)
        {
            if (section == null)
            {
                return(new PlugInLoadConfiguration());
            }

            PlugInLoadConfiguration plugInConfig = new PlugInLoadConfiguration();

            foreach (XmlNode xmlnode in section.ChildNodes)
            {
                if (xmlnode.Name == "UseShadowCopy")
                {
                    if (xmlnode.Attributes["value"] != null)
                    {
                        plugInConfig.UseShadowCopy = (bool.TrueString == xmlnode.Attributes["value"].Value);
                    }
                }
                if (xmlnode.Name == "PlugInsPath")
                {
                    if (xmlnode.Attributes["value"] != null)
                    {
                        string[] paths    = xmlnode.Attributes["value"].Value.Split(';');
                        string   plgpaths = string.Empty;
                        foreach (string path in paths)
                        {
                            plgpaths += System.IO.Path.Combine(_appStartPath, path) + ";";
                        }
                        plugInConfig.PlugInsPath = plgpaths;
                    }
                }
                if (xmlnode.Name == "BizPlugInsPath")
                {
                    if (xmlnode.Attributes["value"] != null)
                    {
                        string[] paths    = xmlnode.Attributes["value"].Value.Split(';');
                        string   plgpaths = string.Empty;
                        foreach (string path in paths)
                        {
                            plgpaths += System.IO.Path.Combine(_appStartPath, path) + ";";
                        }
                        plugInConfig.BizPlugInsPath = plgpaths;
                    }
                }
                if (xmlnode.Name == "CachePath")
                {
                    if (xmlnode.Attributes["value"] != null)
                    {
                        plugInConfig.CachePath = System.IO.Path.Combine(_appStartPath, xmlnode.Attributes["value"].Value);
                    }
                }
            }
            return(plugInConfig);
        }
Ejemplo n.º 3
0
        private static AppDomain GetCustomAppDomain()
        {
            PlugInLoadHelper @object = new PlugInLoadHelper(Application.StartupPath);

            DrectSoftConfigurationSectionHandler.SetConfigurationDelegate(new DelegateReadConfiguration(@object.ReadPlugInLoadConfiguration));
            PlugInLoadConfiguration plugInLoadConfiguration = (PlugInLoadConfiguration)ConfigurationManager.GetSection("plugInLoadSettings");
            AppDomainSetup          appDomainSetup          = new AppDomainSetup();

            appDomainSetup.ApplicationBase   = AppDomain.CurrentDomain.BaseDirectory;
            appDomainSetup.ApplicationName   = "DrectSoftEMR";
            appDomainSetup.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
            appDomainSetup.PrivateBinPath    = plugInLoadConfiguration.AllPath;
            if (plugInLoadConfiguration.UseShadowCopy)
            {
                appDomainSetup.ShadowCopyFiles = "true";
                appDomainSetup.CachePath       = plugInLoadConfiguration.CachePath;
            }
            return(AppDomain.CreateDomain("DrectSoftEMR", null, appDomainSetup));
        }
Ejemplo n.º 4
0
        static AppDomain GetCustomAppDomain()
        {
            PlugInLoadHelper plugInLoadHelper = new PlugInLoadHelper(Application.StartupPath);

            DrectSoftConfigurationSectionHandler.SetConfigurationDelegate(plugInLoadHelper.ReadPlugInLoadConfiguration);
            PlugInLoadConfiguration plugInLoadConfig = (PlugInLoadConfiguration)ConfigurationManager.GetSection("plugInLoadSettings");

            AppDomainSetup ads = new AppDomainSetup();

            ads.ApplicationBase   = AppDomain.CurrentDomain.BaseDirectory;
            ads.ApplicationName   = "adcemr";
            ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
            ads.PrivateBinPath    = plugInLoadConfig.AllPath;
            if (plugInLoadConfig.UseShadowCopy)
            {
                ads.ShadowCopyFiles = "true";
                ads.CachePath       = plugInLoadConfig.CachePath;
            }
            return(AppDomain.CreateDomain("adcemr", null, ads));
        }