public ArticleView(Main m, int[] i, Article ar, Annotation an) { InitializeComponent(); this.Text = ar.Title; textBoxes.Add(textBox6); textBoxes.Add(textBox7); textBoxes.Add(textBox8); textBoxes.Add(textBox9); textBoxes.Add(textBox10); this.m = m; this.i = i; this.ar = ar; this.an = an; textBox1.Text = ar.Title; textBox2.Text = ar.Author; dateTimePicker1.Value = ar.Date; textBox4.Text = ar.Link; textBox5.Text = ar.Body; textBox6.Text = an.Who; textBox7.Text = an.When; textBox8.Text = an.Where; textBox9.Text = an.What; textBox10.Text = an.Why; }
public List<Annotation> parseAnnotations(String path) { List<Annotation> annotationList = new List<Annotation>(); String xmlContents = ""; using (StreamReader streamReader = new StreamReader(path, Encoding.UTF8)) { xmlContents = streamReader.ReadToEnd(); } xmlContents = WebUtility.HtmlDecode(xmlContents); xmlContents = xmlContents.Replace("&", "&"); XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlContents); XmlNodeList articleNodes = doc.DocumentElement.SelectNodes("/data/article"); foreach (XmlNode articleNode in articleNodes) { Annotation annotation = new Annotation(); annotation.Who = WebUtility.HtmlDecode(articleNode.SelectSingleNode("who").InnerText); annotation.Where = WebUtility.HtmlDecode(articleNode.SelectSingleNode("where").InnerText); annotation.When = WebUtility.HtmlDecode(articleNode.SelectSingleNode("when").InnerText); annotation.What = WebUtility.HtmlDecode(articleNode.SelectSingleNode("what").InnerText); annotation.Why = WebUtility.HtmlDecode(articleNode.SelectSingleNode("why").InnerText); annotationList.Add(annotation); } return annotationList; }
public void saveChanges(int[] i, Annotation a) { XmlDocument doc = new XmlDocument(); doc.Load(sourcePaths[i[0]]); XmlNode root = doc.DocumentElement; root.SelectSingleNode("/data/article[" + (a.Index + 1) + "]")["who"].InnerText = a.Who; root.SelectSingleNode("/data/article[" + (a.Index + 1) + "]")["when"].InnerText = a.When; root.SelectSingleNode("/data/article[" + (a.Index + 1) + "]")["where"].InnerText = a.Where; root.SelectSingleNode("/data/article[" + (a.Index + 1) + "]")["what"].InnerText = a.What; root.SelectSingleNode("/data/article[" + (a.Index + 1) + "]")["why"].InnerText = a.Why; doc.Save(sourcePaths[i[0]]); if (tabControl1.SelectedIndex == 1) { listViewerAnnotations[a.Index] = a; } else if (tabControl1.SelectedIndex == 2) { listNavigatorAnnotations[a.Index] = a; } }
public void setCurrentAnnotation(Annotation pAnnotation) { annotationCurrent = pAnnotation; }