/// <summary>
        /// 初始化插件
        /// </summary>
        /// <param name="cfg">插件配置文件实例</param>
        /// <param name="logHelper"></param>
        /// <returns>成功则返回true,否则返回false</returns>
        public bool Initialize(PluginConfigInfo cfg, ILog4cbHelper logHelper)
        {
            try
            {
                Context.PluginInfo = cfg;
                Context.LogHelper = logHelper;
                PluginContext.Configuration = new Configuration(cfg.ConfigPath, cfg);
                //创建一个主备冗余服务对象
                MSService = DirectoryService.GetMasterSlaveService(ServiceName,false);
                MSService.ModeChanged += new EventHandler(MSService_ModeChanged);
                MSService.CheckStatus += new Func<MasterSlaveService, bool>(MSService_CheckStatus);

                quotCenter = new MDS.Plugin.SZQuotV5.QuotationCenter (Context.LogHelper);
                return true;
            }
            catch (Exception ex)
            {
                Context.LogHelper.LogErrMsg(ex, "初始化失败");
                return false;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 初始化插件
        /// </summary>
        /// <param name="cfg">插件配置文件实例</param>
        /// <param name="logHelper"></param>
        /// <returns>成功则返回true,否则返回false</returns>
        public bool Initialize(PluginConfigInfo cfg, ILog4cbHelper logHelper)
        {
            try
            {
                Context.PluginInfo          = cfg;
                Context.LogHelper           = logHelper;
                PluginContext.Configuration = new Configuration(cfg.ConfigPath, cfg);
                //创建一个主备冗余服务对象
                MSService              = DirectoryService.GetMasterSlaveService(ServiceName, false);
                MSService.ModeChanged += new EventHandler(MSService_ModeChanged);
                MSService.CheckStatus += new Func <MasterSlaveService, bool>(MSService_CheckStatus);


                quotCenter = new MDS.Plugin.SZQuotV5.QuotationCenter(Context.LogHelper);
                return(true);
            }
            catch (Exception ex)
            {
                Context.LogHelper.LogErrMsg(ex, "初始化失败");
                return(false);
            }
        }