2 using System.Collections.Generic;
 
    3 using System.ComponentModel;
 
    7 using System.Windows.Forms;
 
   11 namespace Sample_Environment_Control_Interface.Dialogs.Help
 
   15         private Dictionary<String, String> _pages = 
new Dictionary<String, String>();
 
   21             InitializeComponent();
 
   30             if (treeView1.Nodes != null && treeView1.Nodes.Count != 0)
 
   32                 treeView1_AfterSelect(
this, 
new TreeViewEventArgs(treeView1.Nodes[0]));
 
   40                 treeView1.Nodes.Clear();
 
   42                 XmlDocument dom = 
new XmlDocument();
 
   43                 String filepath = Seci.SeciInterface.SeciStatus.ExecutionDir + 
"/Help Contents/";
 
   44                 _helpDirectory = 
new DirectoryInfo(filepath);
 
   46                 dom.Load(filepath + 
"TreeView.xml");
 
   49                 XmlNodeList nodelist = dom.SelectNodes(
"/contents/category");
 
   51                 parseNodeList(nodelist);  
 
   55                 MessageBox.Show(
"Could not open help files! Looking in " + _helpDirectory.FullName, 
"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
 
   56                 Seci.SeciInterface.Error_LogError(
"loadTreeViewXML", ex);
 
   64                 XmlDocument dom = 
new XmlDocument();
 
   66                 FileInfo fi = 
new FileInfo(_helpDirectory.FullName + 
"InstrumentHelp.xml");
 
   70                     dom.Load(fi.FullName);
 
   73                     XmlNodeList nodelist = dom.SelectNodes(
"/contents/category");
 
   75                     parseNodeList(nodelist);
 
   81                     StreamWriter sw = 
new StreamWriter(fi.FullName);
 
   85                         sw.WriteLine(
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
 
   86                         sw.WriteLine(
"<contents>");
 
   87                         sw.WriteLine(
"</contents>");
 
  101                 Seci.SeciInterface.Error_LogError(
"loadInstrumentXML", ex);
 
  107             foreach (XmlNode node 
in nodelist)
 
  109                 XmlDocument nodeDoc = 
new XmlDocument();
 
  110                 nodeDoc.LoadXml(node.OuterXml);
 
  112                 String title = nodeDoc.SelectSingleNode(
"/category/title").InnerXml.Trim();
 
  113                 String page = nodeDoc.SelectSingleNode(
"/category/page").InnerXml.Trim();
 
  115                 treeView1.Nodes.Add(title);
 
  117                 _pages.Add(title, page);
 
  120                 XmlNodeList sublist = nodeDoc.SelectNodes(
"/category/subcategory");
 
  122                 foreach (XmlNode sub 
in sublist)
 
  124                     XmlDocument subDoc = 
new XmlDocument();
 
  125                     subDoc.LoadXml(sub.OuterXml);
 
  127                     String subTitle = subDoc.SelectSingleNode(
"/subcategory/title").InnerXml.Trim();
 
  128                     String subPage = subDoc.SelectSingleNode(
"/subcategory/page").InnerXml.Trim();
 
  130                     treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Add(subTitle);
 
  132                     _pages.Add(subTitle, subPage);
 
  141                 if (_pages.ContainsKey(e.Node.Text))
 
  143                     String fileName = _pages[e.Node.Text].ToString();
 
  145                     webBrowser1.Url = 
new Uri(_helpDirectory.FullName + _pages[e.Node.Text].ToString());
 
  150                 MessageBox.Show(
"Could not find selected page.", 
"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);