示例#1
0
        private void listViewErrors_MouseUp(object sender, MouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (listViewErrors.SelectedItems.Count > 0 && listViewErrors.SelectedItems[0].Tag != null)
            {
                Compiler.Message msg = (Compiler.Message)listViewErrors.SelectedItems[0].Tag;
                if (OnErrorSelected != null)
                {
                    OnErrorSelected(this, msg);
                }
            }
        }
示例#2
0
        public void AddMessage(Compiler.Message msg)
        {
            int iconIndex = 0;

            switch (msg.error.severity)
            {
            case "Note":
                iconIndex = 0;
                break;

            case "Warning":
                iconIndex = 1;
                break;

            case "Error":
                iconIndex = 2;
                break;

            case "Fatal":
                iconIndex = 3;
                break;

            default:
                break;
            }

            string absPath = msg.error.file;

            if (File.Exists(msg.error.file))
            {
                absPath = new FileInfo(msg.error.file).FullName;
            }

            ListViewItem item = new ListViewItem(new string[]
            {
                msg.error.severity,
                msg.error.msg,
                msg.error.line > 0 ? msg.error.line + "" : "",
                msg.error.col > 0 ? msg.error.col + "" : "",
                absPath
            },
                                                 iconIndex
                                                 );

            item.Tag = msg;
            listViewErrors.Items.Add(item);
        }