private void LoadReportTreeData() { rptTreeView.SelectedImageIndex = (int)ImageCode.ActiveReportNode; if (File.Exists(rptXmlFile) != true) { TreeNode mainNode, mainSub, sub; mainNode = rptTreeView.Nodes.Add("Reports"); mainNode.ImageIndex = (int)ImageCode.MainReportNode; mainNode.Tag = "Parent"; if (Directory.Exists("Reports") == false) { Directory.CreateDirectory("Reports"); } mainSub = mainNode.Nodes.Add("Custom"); mainSub.ImageIndex = (int)ImageCode.SubReportNode; mainSub.Tag = "Parent"; if (Directory.Exists("Reports\\Custom") == false) { Directory.CreateDirectory("Reports\\Custom"); } sub = mainSub.Nodes.Add("Detailed"); sub.ImageIndex = (int)ImageCode.SubReportNode; sub.Tag = "\\xslt\\NamHtml.xsl"; if (Directory.Exists("Reports\\Custom\\Detailed") == false) { Directory.CreateDirectory("Reports\\Custom\\Detailed"); } mainSub = mainNode.Nodes.Add("Inventory"); mainSub.ImageIndex = (int)ImageCode.SubReportNode; mainSub.Tag = "Parent"; if (Directory.Exists("Reports\\Inventory") == false) { Directory.CreateDirectory("Reports\\Inventory"); } sub = mainSub.Nodes.Add("Hardware"); sub.ImageIndex = (int)ImageCode.SubReportNode; sub.Tag = "\\xslt\\HardwareReport.xsl"; if (Directory.Exists("Reports\\Inventory\\Hardware") == false) { Directory.CreateDirectory("Reports\\Inventory\\Hardware"); } mainSub = mainNode.Nodes.Add("OS"); mainSub.ImageIndex = (int)ImageCode.SubReportNode; mainSub.Tag = "Parent"; if (Directory.Exists("Reports\\OS") == false) { Directory.CreateDirectory("Reports\\OS"); } sub = mainSub.Nodes.Add("OS Install"); sub.ImageIndex = (int)ImageCode.SubReportNode; sub.Tag = "\\xslt\\OS_Report.xsl"; if (Directory.Exists("Reports\\OS\\OS Install") == false) { Directory.CreateDirectory("Reports\\OS\\OS Install"); } mainSub = mainNode.Nodes.Add("Disk"); mainSub.ImageIndex = (int)ImageCode.SubReportNode; mainSub.Tag = "Parent"; if (Directory.Exists("Reports\\Disk") == false) { Directory.CreateDirectory("Reports\\Disk"); } sub = mainSub.Nodes.Add("LowDisk"); sub.ImageIndex = (int)ImageCode.SubReportNode; sub.Tag = "\\xslt\\LowDisk.xsl"; if (Directory.Exists("Reports\\Disk\\LowDisk") == false) { Directory.CreateDirectory("Reports\\Disk\\LowDisk"); } sub = mainSub.Nodes.Add("Disk Utilization"); sub.ImageIndex = (int)ImageCode.SubReportNode; sub.Tag = "\\xslt\\DiskUtil.xsl"; if (Directory.Exists("Reports\\Disk\\Disk Utilization") == false) { Directory.CreateDirectory("Reports\\Disk\\Disk Utilization"); } } else { TreeViewSerializer serializer = new TreeViewSerializer(); serializer.DeserializeTreeView(rptTreeView, rptXmlFile); } rptTreeView.ExpandAll(); }
private void CommitReportTreeToXMLFile() { TreeViewSerializer serializer = new TreeViewSerializer(); serializer.SerializeTreeView(rptTreeView, rptXmlFile); }