Пример #1
0
 public frmReplyManager(ReplyCollection replys)
 {
     InitializeComponent();
     this._replyCollection = replys;
     RefreshListview(_replyCollection);
     this.lvReply.ItemChecked += new ItemCheckedEventHandler(listView1_ItemChecked);
 }
Пример #2
0
        public void Save(string file, ReplyCollection asc)
        {
            XmlDocument doc  = new XmlDocument();
            XmlNode     root = doc.AppendChild(doc.CreateElement("root"));

            foreach (ReplyItem item in asc)
            {
                XmlElement i = doc.CreateElement("item");

                //XmlAttribute a = doc.CreateAttribute("desc");
                //a.Value = item.Desc;
                //i.Attributes.Append(a);

                i.Attributes.Append(CreateAtt(doc, "name", item.Name));
                i.Attributes.Append(CreateAtt(doc, "description", item.Description));
                i.Attributes.Append(CreateAtt(doc, "enabled", item.Enabled.ToString()));
                i.Attributes.Append(CreateAtt(doc, "receivedPattern", item.ReceivedPattern));
                i.Attributes.Append(CreateAtt(doc, "replyBytes",
                                              HexStringConverter.Default.ConvertToObject(item.ReplyBytes).ToString()));

                root.AppendChild(i);
            }

            doc.Save(file);
        }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="a"></param>
 void RefreshListview(ReplyCollection a)
 {
     this.lvReply.Items.Clear();
     foreach (ReplyItem item in a)
     {
         AddReplyItemToListView(item);
     }
 }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public ReplyCollection Build(string filename)
        {
            ReplyCollection r   = new ReplyCollection();
            XmlDocument     doc = new XmlDocument();

            doc.Load(filename);
            XmlNode root = doc.SelectSingleNode("root");

            foreach (XmlNode n in root.ChildNodes)
            {
                XmlElement e    = n as XmlElement;
                ReplyItem  item = Build(e);
                r.Add(item);
            }
            return(r);
        }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="asc"></param>
 public void Save(ReplyCollection replyCollection)
 {
     Save(FileName, replyCollection);
 }