Exemple #1
0
        /// <summary>
        /// �ֽ����ԭʼ����
        /// </summary>
        /// <param name="labelParam">��ǩ�����ַ���</param>
        /// <returns></returns>
        protected static LabelParameterInfo AnalysesParameter(string labelParam)
        {
            LabelParameterInfo info = null;

            //ȥ�������ߵ� "{" ���ұߵ�"}"
            labelParam = labelParam.Substring(1).Substring(0, labelParam.Length - 2);

            //�ֽ����
            string[] labelParams = labelParam.Split('��');

            if (labelParams.Length > 0) info = new LabelParameterInfo();

            for (int i = 0; i < labelParams.Length; i++)
            {
                if (i == 0)
                {
                    info.LabelFlagName = labelParams[0].ToString().Split('$')[1].ToString();
                    continue;
                }

                //����������������������뼯��
                string key = labelParams[i].ToString().Split('$')[0].ToString();
                string value = labelParams[i].ToString().Split('$')[1].ToString();

                info.ParamList.Add(key, value);
            }

            return info;
        }
Exemple #2
0
        /// <summary>
        /// ��ȡ��ǩ��������ʵ��
        /// </summary>
        /// <param name="labelName"></param>
        /// <returns></returns>
        public ContentLabelManager GetInstance(string labelName)
        {
            //ȥ���ǩǰ���XY_
            labelName = labelName.Substring(3);

            _labelInfo = new XYECOM.Business.Label().GetItem(labelName);

            if (_labelInfo == null)
            {
                throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "�����쳣��LabelName:��" + labelName + "��������");
            }

            //����ԭʼ����
            paramInfo = AnalysesParameter(_labelInfo.LabelContent);

            //���ؾ��崦����(���ݲ�ͬ��ǩ���ز�ͬ�Ķ���ʵ��)
            string className = "XYECOM.Label." + paramInfo.LabelFlagName;

            ContentLabelManager instance = null;

            lock (lockHelper)
            {
                instance = (XYECOM.Label.ContentLabelManager)Assembly.Load("XYECOM.Label").CreateInstance(className);
            }

            if (instance != null)
            {
                instance._LabelInfo = _labelInfo;
                instance.ParamInfo = paramInfo;
            }

            return instance;
        }