Beispiel #1
0
 protected virtual Row ListAdd(LogItem log)
 {
     Table table = this.tableList;       // The Table control on a form - already initialised
     Cell s = new Cell(log.Message);
     Cell c;
     switch (log.Level)
     {
         case LogLevel.LOG_ERROR:
             c = new Cell(Translator.Instance.T("����"), global::ZForge.Controls.Logs.Properties.Resources.scroll_error_16);
             s.ForeColor = Color.Red;
             c.ForeColor = s.ForeColor;
             this.CountError++;
             break;
         case LogLevel.LOG_WARNING:
             c = new Cell(Translator.Instance.T("����"), global::ZForge.Controls.Logs.Properties.Resources.scroll_warning_16);
             s.ForeColor = Color.SteelBlue;
             c.ForeColor = s.ForeColor;
             this.CountWarn++;
             break;
         default:
             c = new Cell(Translator.Instance.T("��Ϣ"), global::ZForge.Controls.Logs.Properties.Resources.scroll_information_16);
             s.ForeColor = Color.Green;
             c.ForeColor = s.ForeColor;
             this.CountInfo++;
             break;
     }
     Row row = new Row(
         new Cell[] {
             c,
             new Cell(log.Timestamp.ToString()),
             s
         }
     );
     row.Tag = log;
     table.TableModel.Rows.Add(row);
     return row;
 }
Beispiel #2
0
 public void LogAdd(LogItem log)
 {
     if (this.InvokeRequired)
     {
         LogAddCallback d = new LogAddCallback(LogAdd);
         this.Invoke(d, new object[] { log });
     }
     else
     {
         lock (this.tableList)
         {
             Row row = ListAdd(log);
             AutosizeColumnWidth();
             if (this.AutoScrollToLast)
             {
                 this.tableList.TopIndex = this.CalcTableTopIndex();
             }
         }
     }
 }