private void LogChanged(object sender, LogFileMonitorLineEventArgs e) { var log = ParseLine(e.Line); if (log == null) { return; } if (!string.IsNullOrWhiteSpace(log.Prefix)) { CreatePanel(log.Prefix, DockState.Document, (name, hidden) => { var item = (ToolStripMenuItem)this.windowsToolStripMenuItem.DropDownItems.Find(log.Prefix, true).FirstOrDefault(); if (item == null) { return; } item.Checked = !hidden; }); } this.panels["Master"].Log(log); if (!string.IsNullOrWhiteSpace(log.Prefix)) { this.panels[log.Prefix].Log(new Log { DateTime = log.DateTime, Level = log.Level, Message = log.Message }); } if (!string.IsNullOrWhiteSpace(log.Level)) { this.panels[log.Level].Log(new Log { DateTime = log.DateTime, Level = log.Level, Prefix = log.Prefix, Message = log.Message }); } }
private void LogChanged(object sender, LogFileMonitorLineEventArgs e) { var log = ParseLine(e.Line); if (log == null) { return; } if (!string.IsNullOrWhiteSpace(log.Prefix)) { CreatePanel(log.Prefix, DockState.Document, (name, hidden) => { var parts = log.Prefix.Split(new[] { '|' }, 2); var item = (ToolStripMenuItem)this.windowsToolStripMenuItem.DropDownItems.Find(parts[0], false).FirstOrDefault(); if (item == null) { return; } if (parts.Length > 1) { var subItem = (ToolStripMenuItem)item.DropDownItems.Find(parts[1] == "Master" ? parts[0] : parts[1], false).FirstOrDefault(); if (subItem == null) { return; } item = subItem; } else if (item.DropDownItems.Count > 0) { var subItem = (ToolStripMenuItem)item.DropDownItems.Find("Master", false).FirstOrDefault(); if (subItem == null) { return; } item = subItem; } item.Checked = !hidden; }); } this.panels["Master"].Log(log); if (!string.IsNullOrWhiteSpace(log.Prefix)) { this.panels[log.Prefix].Log(new Log { DateTime = log.DateTime, Level = log.Level, Message = log.Message }); } if (!string.IsNullOrWhiteSpace(log.Level)) { this.panels[log.Level].Log(new Log { DateTime = log.DateTime, Level = log.Level, Prefix = log.Prefix, Message = log.Message }); } }