public void publishErrors() { Invoke((MethodInvoker) delegate { int totalErrors = 0; TreeNode curNode; if (ErrorHandle.WasSuccessful()) { treeView1.Nodes.Clear(); //Clear out the nodes //Add the errors TreeNode curErr; foreach (int fileid in ErrorHandle.getFileIDs()) { curNode = new TreeNode(ErrorHandle.getFilePath(fileid)); foreach (LineError error in ErrorHandle.getErrors(fileid)) { if (error.getSev() >= 20) { totalErrors += 1; curErr = curNode.Nodes.Add((error.getCode() == "" ? "" : error.getCode() + ": ") + error.getData().Trim() + " (" + error.getLine().ToString() + ")"); if (error.getCode() != "") { curErr.Tag = error.getLine().ToString() + ',' + error.getColumn().ToString(); } curErr.ImageIndex = 1; curErr.SelectedImageIndex = 1; } } //Only add a node if there is something to display if (curNode.Nodes.Count > 0) { curNode.ImageIndex = 0; curNode.SelectedImageIndex = 0; treeView1.Nodes.Add(curNode); } } if (totalErrors == 0) { treeView1.Nodes.Add(new TreeNode("No errors found for " + Library + "/" + Object + ".", 2, 2)); } if (treeView1.Nodes.Count <= 1) { treeView1.ExpandAll(); } } toolStripStatusLabel1.Text = "Total errors: " + totalErrors.ToString(); toolStripStatusLabel2.Text = ErrorHandle.doName(); toolStripStatusLabel3.Text = DateTime.Now.ToString("h:mm:ss tt"); }); }
public void publishErrors() { Invoke((MethodInvoker) delegate { int totalErrors = 0; TreeNode curNode; treeView1.Nodes.Clear(); //Clear out the nodes //Add the node that allows object change curNode = new TreeNode("Double click to change object"); curNode.Tag = "CHG"; curNode.ImageIndex = 0; curNode.SelectedImageIndex = 0; treeView1.Nodes.Add(curNode); //Add the errors TreeNode curErr; foreach (int fileid in ErrorHandle.getFileIDs()) { curNode = new TreeNode(ErrorHandle.getFilePath(fileid)); foreach (lineError error in ErrorHandle.getErrors(fileid)) { if (error.getSev() >= 20) { totalErrors += 1; curErr = curNode.Nodes.Add(error.getCode() + ": " + error.getData().Trim() + " (" + error.getLine().ToString() + ")"); curErr.Tag = error.getLine().ToString() + ',' + error.getColumn().ToString(); curErr.ImageIndex = 2; curErr.SelectedImageIndex = 2; } } //Only add a node if there is something to display if (curNode.Nodes.Count > 0) { curNode.ImageIndex = 1; curNode.SelectedImageIndex = 1; treeView1.Nodes.Add(curNode); } } toolStripStatusLabel1.Text = "Total errors: " + totalErrors.ToString(); toolStripStatusLabel2.Text = ErrorHandle.doName(); toolStripStatusLabel3.Text = DateTime.Now.ToString("h:mm:ss tt"); }); }