Esempio n. 1
0
        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");
            });
        }