public ContextSinkListControl(Control container, DiagContext context) { Container = container; Context = context; _updater = new ControlUpdater <TrackedSink>(context, container) { ItemFilter = ItemFilter, AutoUpdateUntilContextLoaded = true, }; _updater.CreateSearchBox(10, 10); _updater.ListView.BorderStyle = BorderStyle.None; _updater.ListView.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; _updater.ListView.Bounds = new Rectangle(Container.ClientRectangle.Left, Container.ClientRectangle.Top + 40, Container.ClientRectangle.Width, Container.ClientRectangle.Height - 40); _updater.ListView.ItemActivate += ListView_ItemActivate; _updater.ListView.Columns.Add(new OLVColumn() { Text = "Rows", AspectGetter = x => (x as TrackedSink)?.RowCount, AspectToStringConverter = x => ((int?)x)?.FormatToStringNoZero(), TextAlign = HorizontalAlignment.Right, HeaderTextAlign = HorizontalAlignment.Right, }); _updater.ListView.Columns.Add(new OLVColumn() { Text = "Location", AspectGetter = x => (x as TrackedSink)?.Location, }); _updater.ListView.Columns.Add(new OLVColumn() { Text = "Path", AspectGetter = x => (x as TrackedSink)?.Path, }); context.WholePlaybook.OnSinkStarted += OnSinkStarted; _updater.Start(); }
public LogListControl(Control container, DiagnosticsStateManager diagnosticsStateManager, DiagSession session) { Container = container; Session = session; _updater = new ControlUpdater <LogModel>(null, Container) { ItemFilter = ItemFilter, }; _updater.CreateSearchBox(10, 10); ShowDebugLevel = new CheckBox() { Parent = container, Bounds = new Rectangle(_updater.SearchBox.Right + 20, _updater.SearchBox.Top, 200, _updater.SearchBox.Height), Text = "Show debug level", CheckAlign = ContentAlignment.MiddleLeft, }; ShowDebugLevel.CheckedChanged += (s, a) => _updater.RefreshItems(true); _updater.ListView.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; _updater.ListView.Bounds = new Rectangle(Container.ClientRectangle.Left, Container.ClientRectangle.Top + 40, Container.ClientRectangle.Width, Container.ClientRectangle.Height - 40); _updater.ListView.ItemActivate += ListView_ItemActivate; _updater.ListView.Columns.Add(new OLVColumn() { Text = "Timestamp", AspectGetter = x => (x as LogModel)?.Timestamp, AspectToStringConverter = x => ((DateTime)x).ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture), }); _updater.ListView.Columns.Add(new OLVColumn() { Text = "Severity", AspectGetter = x => (x as LogModel)?.Event.Severity.ToShortString(), }); _updater.ListView.Columns.Add(new OLVColumn() { Text = "Context", AspectGetter = x => (x as LogModel)?.Playbook.DiagContext.Name, }); _updater.ListView.Columns.Add(new OLVColumn() { Text = "Process", AspectGetter = x => (x as LogModel)?.Process?.Name, }); _updater.ListView.Columns.Add(new OLVColumn() { Text = "Kind", AspectGetter = x => (x as LogModel)?.Process?.KindToString(), }); _updater.ListView.Columns.Add(new OLVColumn() { Text = "Type", AspectGetter = x => (x as LogModel)?.Process?.Type, }); _updater.ListView.Columns.Add(new OLVColumn() { Text = "Topic", AspectGetter = x => (x as LogModel)?.Process?.Topic, }); _updater.ListView.Columns.Add(new OLVColumn() { Text = "Message", AspectGetter = x => (x as LogModel)?.Text, }); _updater.Start(); diagnosticsStateManager.OnDiagContextCreated += ec => { if (ec.Session == session) { ec.WholePlaybook.OnEventsAdded += OnEventsAdded; } }; }