public frmReplyManager(ReplyCollection replys) { InitializeComponent(); this._replyCollection = replys; RefreshListview(_replyCollection); this.lvReply.ItemChecked += new ItemCheckedEventHandler(listView1_ItemChecked); }
/// <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; }
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); }
/// <summary> /// /// </summary> /// <param name="a"></param> void RefreshListview(ReplyCollection a) { this.lvReply.Items.Clear(); foreach (ReplyItem item in a) { AddReplyItemToListView(item); } }
/// <summary> /// /// </summary> /// <param name="asc"></param> public void Save(ReplyCollection replyCollection) { Save(FileName, replyCollection); }