Esempio n. 1
0
 // 把事项重新全部加入listview
 /// <summary>
 /// 把当前集合中的事项全部加入 ListView
 /// </summary>
 /// <param name="list"></param>
 public void AddToListView(ListView list)
 {
     for (int i = 0; i < this.Count; i++)
     {
         CommentItem item = this[i];
         item.AddToListView(list);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 根据一个 XML 字符串内容,构建出集合内的若干事项
        /// </summary>
        /// <param name="nodeCommentCollection">XmlNode对象,本方法将使用其下属的 dprms:comment 元素来构造事项</param>
        /// <param name="list">ListView 对象。构造好的事项会显示到其中</param>
        /// <param name="bRefreshRefID">构造事项的过程中,是否要刷新每个事项的 RefID 成员值</param>
        /// <param name="strError">返回出错信息</param>
        /// <returns>-1: 出错。错误信息在 strError 中; 0: 成功</returns>
        public int ImportFromXml(XmlNode nodeCommentCollection,
                                 ListView list,
                                 bool bRefreshRefID,
                                 out string strError)
        {
            strError = "";
            int nRet = 0;

            if (nodeCommentCollection == null)
            {
                return(0);
            }

            XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());

            nsmgr.AddNamespace("dprms", DpNs.dprms);

            XmlNodeList nodes = nodeCommentCollection.SelectNodes("dprms:comment", nsmgr);

            for (int i = 0; i < nodes.Count; i++)
            {
                XmlNode node = nodes[i];

                CommentItem comment_item = new CommentItem();
                nRet = comment_item.SetData("",
                                            node.OuterXml,
                                            null,
                                            out strError);
                if (nRet == -1)
                {
                    return(-1);
                }

                if (bRefreshRefID == true)
                {
                    comment_item.RefID = Guid.NewGuid().ToString();
                }

                this.Add(comment_item);
                comment_item.ItemDisplayState = ItemDisplayState.New;
                comment_item.AddToListView(list);

                comment_item.Changed = true;
            }

            return(0);
        }
Esempio n. 3
0
        /// <summary>
        /// 根据一个 XML 字符串内容,构建出集合内的若干事项
        /// </summary>
        /// <param name="nodeCommentCollection">XmlNode对象,本方法将使用其下属的 dprms:comment 元素来构造事项</param>
        /// <param name="list">ListView 对象。构造好的事项会显示到其中</param>
        /// <param name="bRefreshRefID">构造事项的过程中,是否要刷新每个事项的 RefID 成员值</param>
        /// <param name="strError">返回出错信息</param>
        /// <returns>-1: 出错。错误信息在 strError 中; 0: 成功</returns>
        public int ImportFromXml(XmlNode nodeCommentCollection,
            ListView list,
            bool bRefreshRefID,
            out string strError)
        {
            strError = "";
            int nRet = 0;

            if (nodeCommentCollection == null)
                return 0;

            XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
            nsmgr.AddNamespace("dprms", DpNs.dprms);

            XmlNodeList nodes = nodeCommentCollection.SelectNodes("dprms:comment", nsmgr);
            for (int i = 0; i < nodes.Count; i++)
            {
                XmlNode node = nodes[i];

                CommentItem comment_item = new CommentItem();
                nRet = comment_item.SetData("",
                    node.OuterXml,
                    null,
                    out strError);
                if (nRet == -1)
                    return -1;

                if (bRefreshRefID == true)
                    comment_item.RefID = Guid.NewGuid().ToString();

                this.Add(comment_item);
                comment_item.ItemDisplayState = ItemDisplayState.New;
                comment_item.AddToListView(list);

                comment_item.Changed = true;
            }

            return 0;
        }