Exemple #1
0
        /// <summary>
        /// 将配置信息保存到XML
        /// </summary>
        /// <param name="CurrentNode">当前XML节点</param>
        public void SerializeConfigToXmlNode(System.Xml.Linq.XElement CurrentNode)
        {
            //参数检查
            if (this.RawData == null)
            {
                throw new Exception("RawData属性未设置。");
            }

            //根据类型进行处理
            switch (this.DataType)
            {
            default:
                return;

            case DataTypes.Text:
            {
                CurrentNode.Add(new XElement("RawData", this.RawData.ToString()));
                break;
            }

            case DataTypes.News:
            {
                ArticleCan    ac  = RawData as ArticleCan;
                List <string> ret = new List <string>();
                ret.Add(ac.Title);
                ret.Add(ac.Description);
                ret.Add(ac.PicUrl);
                ret.Add(ac.Url);

                CurrentNode.Add(new XElement("RawData", ConfigHelper.SerializeToXE(ret)));
                break;
            }
            }
            CurrentNode.Add(new XElement("DataType", this.DataType));

            //处理状态成员
            XElement xeReady, xeSuccess, xeFail;

            this.SerializeStatusMember(out xeReady, out xeSuccess, out xeFail);
            if (xeReady != null)
            {
                CurrentNode.Add(xeReady);
            }
            if (xeSuccess != null)
            {
                CurrentNode.Add(xeSuccess);
            }
            if (xeFail != null)
            {
                CurrentNode.Add(xeFail);
            }
        }
        /// <summary>
        /// 创建单一图文类型的默认处理
        /// </summary>
        /// <param name="tipText"></param>
        /// <param name="nodeId"></param>
        /// <returns></returns>
        public static DefaultDealingHandler CreateInstance_SingleNews(ArticleCan article)
        {
            ResponseNewsResult message = new ResponseNewsResult(article);

            return(InternalCreateInstance(message));
        }