private void toolStripComboBoxView_SelectedIndexChanged(object sender, EventArgs e) { ExtendedLogViewerTag s = (ExtendedLogViewerTag)toolStripComboBoxView.SelectedItem; this.mMutex.WaitOne(); foreach (SourceGrid.Grid.GridRow row in this.logGrid.Rows) { if (row.Tag != null) { ExtendedLogViewerTag t = (ExtendedLogViewerTag)row.Tag; row.Visible = (s.ID.Equals("0") || s.ID.Equals(t.ID)); } } this.mMutex.ReleaseMutex(); }
public int CompareTo(object obj) { if (obj is ExtendedLogViewerTag) { ExtendedLogViewerTag t = (ExtendedLogViewerTag)obj; if (t.ID.Equals("0")) { return(1); } if (this.ID.Equals("0")) { return(-1); } } return(this.ToString().CompareTo(obj.ToString())); }
private void UpdateUIAdd(ExtendedLogViewerItem item) { int pos = this.logGrid.RowsCount; this.logGrid.RowsCount++; this.logGrid[pos, 0] = new SourceGrid.Cells.Cell(pos); this.FillRowMark(item.LogLevel, pos); this.logGrid[pos, 2] = new SourceGrid.Cells.Cell(item.TimeStamp.ToString()); this.logGrid[pos, 3] = new SourceGrid.Cells.Cell(item.Name); this.logGrid[pos, 4] = new SourceGrid.Cells.Cell(item.Message); this.logGrid[pos, 4].View.WordWrap = true; ExtendedLogViewerTag tag = new ExtendedLogViewerTag(item.LogLevel, item.ID, item.Name); this.logGrid.Rows[pos].Tag = tag; this.ShortcutAdd(tag); }
private void SetShowFlags(ZForge.Controls.Logs.LogLevel f, bool set) { lock (this) { if (set == true) { this.mShowLogs = this.mShowLogs | (int)f; } else { this.mShowLogs = this.mShowLogs & (~(int)f); } foreach (SourceGrid.Grid.GridRow row in this.logGrid.Rows) { if (row.Tag != null) { ExtendedLogViewerTag t = (ExtendedLogViewerTag)row.Tag; row.Visible = (((int)t.LogLevel & this.mShowLogs) != 0); } } } }
private void ShortcutAdd(ExtendedLogViewerTag tag) { foreach (ExtendedLogViewerTag t in this.toolStripComboBoxView.Items) { if (t.ID.Equals(tag.ID)) { return; } } this.toolStripComboBoxView.Items.Add(tag); try { object o = this.toolStripComboBoxView.SelectedItem; ArrayList list = ArrayList.Adapter(this.toolStripComboBoxView.Items); list.Sort(); this.toolStripComboBoxView.SelectedItem = o; } catch (Exception e) { MessageBox.Show(e.Message); } }
private void UpdateCultureGrid() { foreach (SourceGrid.Grid.GridRow row in this.logGrid.Rows) { ExtendedLogViewerTag t = row.Tag as ExtendedLogViewerTag; if (t != null) { switch (t.LogLevel) { case ZForge.Controls.Logs.LogLevel.LOG_ERROR: this.logGrid[row.Index, 1].Value = Translator.Instance.T("错误"); break; case ZForge.Controls.Logs.LogLevel.LOG_WARNING: this.logGrid[row.Index, 1].Value = Translator.Instance.T("警告"); break; default: this.logGrid[row.Index, 1].Value = Translator.Instance.T("普通"); break; } } } }