private void StartDocumentReview(MNDocument doc, string filePath) { Document = doc; ClearUI(); labelBookTitle.Text = Document.Book.BookTitle; tabControl1.SelectedTab = tabBook; LoadData(filePath.Replace(".smb", ".smr")); p_PageOrig = null; p_ItemOrig = null; p_Page = new ReviewPage(); p_Item = new ReviewItem(); }
public void LoadFromXml(XmlDocument doc) { foreach (XmlElement e in doc.ChildNodes) { if (e.Name.Equals("doc")) { foreach (XmlElement ef in e.ChildNodes) { if (ef.Name.Equals("notes")) { BookNotes = ef.InnerText; } else if (ef.Name.Equals("page")) { ReviewPage rp = new ReviewPage(); rp.Load(ef); Pages[int.Parse(ef.GetAttribute("id"))] = rp; } } } } }
private void InitWithPage(MNPage p) { tabControl1.SelectedTab = tabPage; StringBuilder sb = new StringBuilder(); sb.Append("<html><head></head><body style='font-family:Helvetica'>"); if (p_Book.Pages.ContainsKey(p.Id)) { p_Page = p_Book.Pages[p.Id]; } else { webBrowser1.DocumentText = ""; return; } if (!p.TextB.Equals(p_Page.PageTitle)) { sb.AppendFormat("<p><b>Page Title</b><br>{0}</p>", p_Page.PageTitle); } if (!p.MessageText.Equals(p_Page.PageHelp)) { sb.AppendFormat("<p><b>Page Help</b><br>{0}</p>", p_Page.PageHelp); } if (!string.IsNullOrWhiteSpace(p_Page.PageNotes)) { sb.AppendFormat("<p><b>Page Help</b><br>{0}</p>", p_Page.PageNotes); } bool header = false; foreach (KeyValuePair <long, ReviewItem> revi in p_Page.Items) { if (!header) { sb.AppendFormat("<h3 style='background:#efa0ef'>Items</h3>"); header = true; } sb.AppendLine("<table style='border:1px solid black;'>"); sb.AppendFormat("<tr><td>ID</td><td>{0}</td></tr>", revi.Key); SMControl itor = p_PageOrig.FindObject(revi.Key); if (itor != null && !itor.Text.Equals(p_Item.ItemText)) { sb.AppendFormat("<tr><td>New Text</td><td>{0}</td></tr>", revi.Value.ItemText); sb.AppendFormat("<tr><td>Orig Text</td><td>{0}</td></tr>", itor.Text); } else if (itor != null) { sb.AppendFormat("<tr><td>Text</td><td>{0}</td></tr>", revi.Value.ItemText); } if (!string.IsNullOrWhiteSpace(revi.Value.ItemNotes)) { sb.AppendFormat("<tr><td>Notes</td><td>{0}</td></tr>", revi.Value.ItemNotes); } sb.AppendLine("</table>"); } sb.Append("</body></html>"); p_PageOrig = p; p_ItemOrig = null; webBrowser1.DocumentText = sb.ToString(); }