示例#1
0
 private void DrawRow(Graphics g, int line, LogLine logline, float y)
 {
     int p = logline.text.IndexOf(" : ");
     string time = "", text = "";
     if (p < 0)
         text = logline.text;
     else
     {
         time = logline.text.Substring(0, p);
         text = logline.text.Substring(p + 3);
     }
     Brush fontBrush = normalBrush;
     Brush bgBrush = ((line & 1)!=0 ? evenBackBrush : backBrush);
     if (hasFocus && line >= Math.Min(row, selRow) && line <= Math.Max(row, selRow))
     { // mark selection
         bgBrush = selectionBrush;
         fontBrush = selectionTextBrush;
     }
     else
     {
         switch (logline.level)
         {
             case 0:
                 fontBrush = normalBrush;
                 break;
             case 1:
                 fontBrush = warningBrush;
                 break;
             case 2:
                 fontBrush = errorBrush;
                 break;
             case 3:
                 fontBrush = infoBrush;
                 break;
             case 4:
                 fontBrush = normalBrush;
                 break;
         }
     }
     g.FillRectangle(bgBrush, linesWidth, y, log.Width-linesWidth, fontHeight);
     g.DrawString(text, drawFont, fontBrush, linesWidth+4, y);
     g.DrawString(time, drawFont, linesTextColor, linesWidth - 3 - fontWidth * time.Length, y);
 }
示例#2
0
 private void logUpdate(LogLine line)
 {
     logAppend(line);
     listLog.UpdateBox();
 }
示例#3
0
 public void Add(LogLine l)
 {
     if(!hasFocus)
         while (lines.Count >= maxLines)
         {
             _row--;
             selRow--;
             lines.RemoveAt(0);
         }
     lines.Add(l);
 }
示例#4
0
 private void logAppend(LogLine line)
 {
     if (switchACK.On == false && isAck(line.text)) return;
     if (line.level == 0 && line.response==false && switchCommandsSend.On == false) return;
     if (line.level == 1 && switchWarnings.On == false) return;
     if (line.level == 2 && switchErrors.On == false) return;
     if (line.level == 3 && switchInfo.On == false) return;
     listLog.Add(line);
 }