Ejemplo n.º 1
0
        void Logger_ErrorEvent(object sender, PKStudio.Helpers.ErrorEventArgs e)
        {
            string line = string.Empty;

            if ((e.Error.MessageObject as FileMessageObject) != null)
            {
                FileMessageObject FMO = e.Error.MessageObject as FileMessageObject;
                if (FMO.File == "EXEC")
                {
                    line = Strings.Error + " " + e.Error.Message;
                }
                else
                {
                    line = FMO.File + "(" + FMO.LineNumber + "," + FMO.ColumnNumber + "): " + Strings.Error + " " + e.Error.Code + ": " + e.Error.Message;
                }
            }
            if ((e.Error.MessageObject as ComponentMessageObject) != null)
            {
                ComponentMessageObject CMO = e.Error.MessageObject as ComponentMessageObject;
                line = CMO.Component.Name + ": " + Strings.Error + " " + e.Error.Code + ": " + e.Error.Message;
            }

            if (e.Error.MessageObject == null)
            {
            }

            if (!string.IsNullOrEmpty(line))
            {
                this.AppendText(line + "\r\n");
                int linenum = GetOutputLinesCount() - 2;//En: -2 because last line always empty Ru: -2 потому что последняя линяя всегда пустая
                ErrorsAndWarningsDict.Add(linenum, e.Error);
            }
        }
Ejemplo n.º 2
0
        private void OutputTextBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int Line = OutputTextBox.GetLineFromCharIndex(OutputTextBox.GetCharIndexFromPosition(e.Location));

            if (ErrorsAndWarningsDict.ContainsKey(Line))
            {
                if (LastHighlitedLine != -1)
                {
                    CleanHighlight(LastHighlitedLine);
                }
                HighlightLine(Line, Color.Blue, Color.White);
                WEMessage mes = ErrorsAndWarningsDict[Line];
                if ((mes.MessageObject as FileMessageObject) != null)
                {
                    FileMessageObject FMO = mes.MessageObject as FileMessageObject;
                    if (File.Exists(FMO.File))
                    {
                        PKStudio.Helpers.EditorsFormsController.EditFileDescriptor comp = new PKStudio.Helpers.EditorsFormsController.EditFileDescriptor();
                        comp.Path   = FMO.File;
                        comp.Line   = FMO.LineNumber;
                        comp.Column = FMO.ColumnNumber;
                        this.OnEditEvent(comp);
                    }
                }
                if ((mes.MessageObject as ComponentMessageObject) != null)
                {
                    ComponentMessageObject CMO = mes.MessageObject as ComponentMessageObject;
                    this.OnEditEvent(CMO.Component);
                }
            }
        }
Ejemplo n.º 3
0
        private void AddWarning(WEMessage Warning)
        {
            ListViewItem LVitem = new ListViewItem("", 1);

            LVitem.SubItems.Add(index.ToString());
            LVitem.SubItems.Add(Warning.Message);
            if ((Warning.MessageObject as FileMessageObject) != null)
            {
                FileMessageObject FMO = Warning.MessageObject as FileMessageObject;
                if (FMO.File != "EXEC")
                {
                    LVitem.SubItems.Add(Path.GetFileName(FMO.File));
                    LVitem.SubItems.Add(FMO.LineNumber.ToString());
                    //LVitem.SubItems.Add(item.ColumnNumber.ToString());
                }
            }
            if ((Warning.MessageObject as ComponentMessageObject) != null)
            {
                ComponentMessageObject CMO = Warning.MessageObject as ComponentMessageObject;
                LVitem.SubItems.Add(Path.GetFileName(CMO.Component.Name));
            }
            LVitem.Tag = Warning;
            AddLVItem(LVitem);
            index++;
        }
Ejemplo n.º 4
0
 private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         WEMessage mes = (WEMessage)listView1.SelectedItems[0].Tag;
         if ((mes.MessageObject as FileMessageObject) != null)
         {
             FileMessageObject FMO = mes.MessageObject as FileMessageObject;
             if (File.Exists(FMO.File))
             {
                 PKStudio.Helpers.EditorsFormsController.EditFileDescriptor comp = new PKStudio.Helpers.EditorsFormsController.EditFileDescriptor();
                 comp.Path   = FMO.File;
                 comp.Line   = FMO.LineNumber;
                 comp.Column = FMO.ColumnNumber;
                 this.OnEditEvent(comp);
             }
         }
         if ((mes.MessageObject as ComponentMessageObject) != null)
         {
             ComponentMessageObject CMO = mes.MessageObject as ComponentMessageObject;
             this.OnEditEvent(CMO.Component);
         }
     }
 }