Esempio n. 1
0
        /// <summary>
        /// 默认虚拟机构造函数
        /// </summary>
        /// <param name="workItem">系统组件容器</param>
        public DefaultVirtualCTI(WorkItem workItem)
        {
            this.workItem = workItem;
            this.workItem.Services.Add <IVirtualCTI>(this);
            logger = workItem.Services.Get <ILog>();

            IConfigurationService configService = workItem.Services.Get <IConfigurationService>();

            if (!configService.Exists(sectionPath))
            {
                String errStr = "在系统配置文件中文件未找到 \"LightweightCTI\" 配置节。";
                logger.Fatal(errStr);
                throw new Exception(errStr);
            }

            // 创建相关文件夹
            if (!Directory.Exists(resourceDir))
            {
                Directory.CreateDirectory(resourceDir);
            }
            if (!Directory.Exists(projectsDir))
            {
                Directory.CreateDirectory(projectsDir);
            }

            IConfiguration           config          = new XMLConfiguration(configService.GetItem(sectionPath));
            ConfigurationInterpreter confInterpreter = new ConfigurationInterpreter(workItem, config);

            confInterpreter.Parse(); // 解析配置信息并反序列化相关组件
        }
        /// <summary>
        /// Ĭ����������캯��
        /// </summary>
        /// <param name="workItem">ϵͳ�������</param>
        public DefaultVirtualCTI(WorkItem workItem)
        {
            this.workItem = workItem;
            this.workItem.Services.Add<IVirtualCTI>(this);
            logger = workItem.Services.Get<ILog>();

            IConfigurationService configService = workItem.Services.Get<IConfigurationService>();
            if (!configService.Exists(sectionPath))
            {
                String errStr = "��ϵͳ�����ļ����ļ�δ�ҵ� \"LightweightCTI\" ���ýڡ�";
                logger.Fatal(errStr);
                throw new Exception(errStr);
            }

            // ��������ļ���
            if (!Directory.Exists(resourceDir))
                Directory.CreateDirectory(resourceDir);
            if (!Directory.Exists(projectsDir))
                Directory.CreateDirectory(projectsDir);

            IConfiguration config = new XMLConfiguration(configService.GetItem(sectionPath));
            ConfigurationInterpreter confInterpreter = new ConfigurationInterpreter(workItem, config);
            confInterpreter.Parse(); // ����������Ϣ�������л�������
        }