Cause: - Live diagnostics required logging from multiple applications without blocking TBF. - Shared nlog.config files caused configuration conflicts. - The original viewer lacked configurable colors and practical log controls. - Inconsistent diagnostic deployment caused log transfer failures and locked shared DLLs during builds. Solution: 1. Added universal diagnostic transport - Added AppDiagnostic.Logging with an NLog target and named-pipe communication. - Added background buffering and automatic reconnection. - Registered the diagnostic connector programmatically. 2. Separated diagnostic window lifecycle - Run AppDiagnostic as an independent process. - Activate the existing window on repeated launches. - Keep TBF running when the diagnostic window closes. 3. Corrected diagnostic deployment - Copy the complete diagnostic output into a dedicated AppDiagnostic subdirectory during build. - Overwrite existing deployment files to prevent inconsistent versions. - Validate and launch the executable from that subdirectory with an explicit working directory. 4. Improved the log viewer - Added configurable substring colors with a palette and live preview. - Added text, level and application filters. - Added line wrapping, clipboard actions and log export. - Added Pause/Resume, Refresh, Clear, auto-scroll and Always on top. - Added connection and log counters. - Persist color rules between sessions. 5. Removed legacy dependencies - Replaced LiveLogCache with structured diagnostic storage. - Removed AppDiagnostic dependencies on log4net and SharedComponents. Validation: - Confirmed successful log transfer when launching AppDiagnostic from TBF.
310 lines
17 KiB
C#
310 lines
17 KiB
C#
namespace AppDiagnostic
|
|
{
|
|
partial class MainForm
|
|
{
|
|
private System.ComponentModel.IContainer components = null;
|
|
private System.Windows.Forms.ToolStrip mainToolStrip;
|
|
private System.Windows.Forms.ToolStripButton pauseButton;
|
|
private System.Windows.Forms.ToolStripButton refreshButton;
|
|
private System.Windows.Forms.ToolStripButton clearButton;
|
|
private System.Windows.Forms.ToolStripButton saveButton;
|
|
private System.Windows.Forms.ToolStripButton copyButton;
|
|
private System.Windows.Forms.ToolStripButton copyAllButton;
|
|
private System.Windows.Forms.ToolStripButton wrapButton;
|
|
private System.Windows.Forms.ToolStripButton autoScrollButton;
|
|
private System.Windows.Forms.ToolStripButton alwaysOnTopButton;
|
|
private System.Windows.Forms.ToolStripButton colorRulesButton;
|
|
private System.Windows.Forms.ToolStripButton closeButton;
|
|
private System.Windows.Forms.TableLayoutPanel filterPanel;
|
|
private System.Windows.Forms.Label filterLabel;
|
|
private System.Windows.Forms.TextBox filterTextBox;
|
|
private System.Windows.Forms.Label levelLabel;
|
|
private System.Windows.Forms.ComboBox levelComboBox;
|
|
private System.Windows.Forms.Label applicationLabel;
|
|
private System.Windows.Forms.ComboBox applicationComboBox;
|
|
private System.Windows.Forms.Button applyFilterButton;
|
|
private System.Windows.Forms.Button clearFilterButton;
|
|
private System.Windows.Forms.RichTextBox logView;
|
|
private System.Windows.Forms.StatusStrip statusStrip;
|
|
private System.Windows.Forms.ToolStripStatusLabel receiverStatusLabel;
|
|
private System.Windows.Forms.ToolStripStatusLabel statusSpacer;
|
|
private System.Windows.Forms.ToolStripStatusLabel countStatusLabel;
|
|
private System.Windows.Forms.ContextMenuStrip logContextMenu;
|
|
private System.Windows.Forms.ToolStripMenuItem copySelectionMenuItem;
|
|
private System.Windows.Forms.ToolStripMenuItem copyLineMenuItem;
|
|
private System.Windows.Forms.ToolStripMenuItem copyAllMenuItem;
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && components != null)
|
|
{
|
|
components.Dispose();
|
|
}
|
|
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
this.components = new System.ComponentModel.Container();
|
|
this.mainToolStrip = new System.Windows.Forms.ToolStrip();
|
|
this.pauseButton = new System.Windows.Forms.ToolStripButton();
|
|
this.refreshButton = new System.Windows.Forms.ToolStripButton();
|
|
this.clearButton = new System.Windows.Forms.ToolStripButton();
|
|
this.saveButton = new System.Windows.Forms.ToolStripButton();
|
|
this.copyButton = new System.Windows.Forms.ToolStripButton();
|
|
this.copyAllButton = new System.Windows.Forms.ToolStripButton();
|
|
this.wrapButton = new System.Windows.Forms.ToolStripButton();
|
|
this.autoScrollButton = new System.Windows.Forms.ToolStripButton();
|
|
this.alwaysOnTopButton = new System.Windows.Forms.ToolStripButton();
|
|
this.colorRulesButton = new System.Windows.Forms.ToolStripButton();
|
|
this.closeButton = new System.Windows.Forms.ToolStripButton();
|
|
this.filterPanel = new System.Windows.Forms.TableLayoutPanel();
|
|
this.filterLabel = new System.Windows.Forms.Label();
|
|
this.filterTextBox = new System.Windows.Forms.TextBox();
|
|
this.levelLabel = new System.Windows.Forms.Label();
|
|
this.levelComboBox = new System.Windows.Forms.ComboBox();
|
|
this.applicationLabel = new System.Windows.Forms.Label();
|
|
this.applicationComboBox = new System.Windows.Forms.ComboBox();
|
|
this.applyFilterButton = new System.Windows.Forms.Button();
|
|
this.clearFilterButton = new System.Windows.Forms.Button();
|
|
this.logContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
|
this.copySelectionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
this.copyLineMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
this.copyAllMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
this.logView = new System.Windows.Forms.RichTextBox();
|
|
this.statusStrip = new System.Windows.Forms.StatusStrip();
|
|
this.receiverStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
|
this.statusSpacer = new System.Windows.Forms.ToolStripStatusLabel();
|
|
this.countStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
|
this.mainToolStrip.SuspendLayout();
|
|
this.filterPanel.SuspendLayout();
|
|
this.logContextMenu.SuspendLayout();
|
|
this.statusStrip.SuspendLayout();
|
|
this.SuspendLayout();
|
|
//
|
|
// mainToolStrip
|
|
//
|
|
this.mainToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
|
|
this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
this.pauseButton,
|
|
this.refreshButton,
|
|
this.clearButton,
|
|
this.saveButton,
|
|
new System.Windows.Forms.ToolStripSeparator(),
|
|
this.copyButton,
|
|
this.copyAllButton,
|
|
new System.Windows.Forms.ToolStripSeparator(),
|
|
this.wrapButton,
|
|
this.autoScrollButton,
|
|
this.alwaysOnTopButton,
|
|
this.colorRulesButton,
|
|
this.closeButton});
|
|
this.mainToolStrip.Location = new System.Drawing.Point(0, 0);
|
|
this.mainToolStrip.Name = "mainToolStrip";
|
|
this.mainToolStrip.Padding = new System.Windows.Forms.Padding(6, 3, 6, 3);
|
|
this.mainToolStrip.Size = new System.Drawing.Size(1184, 31);
|
|
this.mainToolStrip.TabIndex = 0;
|
|
//
|
|
// pauseButton
|
|
//
|
|
this.pauseButton.CheckOnClick = true;
|
|
this.pauseButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.pauseButton.Text = "Pause";
|
|
this.pauseButton.ToolTipText = "Pause screen updates while continuing to receive logs";
|
|
this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click);
|
|
//
|
|
// refreshButton
|
|
//
|
|
this.refreshButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.refreshButton.Text = "Refresh";
|
|
this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
|
|
//
|
|
// clearButton
|
|
//
|
|
this.clearButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.clearButton.Text = "Clear";
|
|
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
|
//
|
|
// saveButton
|
|
//
|
|
this.saveButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.saveButton.Text = "Save...";
|
|
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
|
|
//
|
|
// copyButton
|
|
//
|
|
this.copyButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.copyButton.Text = "Copy";
|
|
this.copyButton.ToolTipText = "Copy selected text or the current log line";
|
|
this.copyButton.Click += new System.EventHandler(this.copyButton_Click);
|
|
//
|
|
// copyAllButton
|
|
//
|
|
this.copyAllButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.copyAllButton.Text = "Copy all";
|
|
this.copyAllButton.Click += new System.EventHandler(this.copyAllButton_Click);
|
|
//
|
|
// wrapButton
|
|
//
|
|
this.wrapButton.Checked = true;
|
|
this.wrapButton.CheckOnClick = true;
|
|
this.wrapButton.CheckState = System.Windows.Forms.CheckState.Checked;
|
|
this.wrapButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.wrapButton.Text = "Wrap lines";
|
|
this.wrapButton.Click += new System.EventHandler(this.wrapButton_Click);
|
|
//
|
|
// autoScrollButton
|
|
//
|
|
this.autoScrollButton.Checked = true;
|
|
this.autoScrollButton.CheckOnClick = true;
|
|
this.autoScrollButton.CheckState = System.Windows.Forms.CheckState.Checked;
|
|
this.autoScrollButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.autoScrollButton.Text = "Auto-scroll";
|
|
//
|
|
// alwaysOnTopButton
|
|
//
|
|
this.alwaysOnTopButton.CheckOnClick = true;
|
|
this.alwaysOnTopButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.alwaysOnTopButton.Text = "Always on top";
|
|
this.alwaysOnTopButton.Click += new System.EventHandler(this.alwaysOnTopButton_Click);
|
|
//
|
|
// colorRulesButton
|
|
//
|
|
this.colorRulesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.colorRulesButton.Text = "Color rules...";
|
|
this.colorRulesButton.Click += new System.EventHandler(this.colorRulesButton_Click);
|
|
//
|
|
// closeButton
|
|
//
|
|
this.closeButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
|
this.closeButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
|
this.closeButton.Text = "Close";
|
|
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
|
|
//
|
|
// filterPanel
|
|
//
|
|
this.filterPanel.ColumnCount = 8;
|
|
this.filterPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 42F));
|
|
this.filterPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
|
this.filterPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 42F));
|
|
this.filterPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 105F));
|
|
this.filterPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 72F));
|
|
this.filterPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 180F));
|
|
this.filterPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 66F));
|
|
this.filterPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 66F));
|
|
this.filterPanel.Controls.Add(this.filterLabel, 0, 0);
|
|
this.filterPanel.Controls.Add(this.filterTextBox, 1, 0);
|
|
this.filterPanel.Controls.Add(this.levelLabel, 2, 0);
|
|
this.filterPanel.Controls.Add(this.levelComboBox, 3, 0);
|
|
this.filterPanel.Controls.Add(this.applicationLabel, 4, 0);
|
|
this.filterPanel.Controls.Add(this.applicationComboBox, 5, 0);
|
|
this.filterPanel.Controls.Add(this.applyFilterButton, 6, 0);
|
|
this.filterPanel.Controls.Add(this.clearFilterButton, 7, 0);
|
|
this.filterPanel.Dock = System.Windows.Forms.DockStyle.Top;
|
|
this.filterPanel.Location = new System.Drawing.Point(0, 31);
|
|
this.filterPanel.Name = "filterPanel";
|
|
this.filterPanel.Padding = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
|
this.filterPanel.RowCount = 1;
|
|
this.filterPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
|
this.filterPanel.Size = new System.Drawing.Size(1184, 38);
|
|
this.filterPanel.TabIndex = 1;
|
|
//
|
|
// filter controls
|
|
//
|
|
this.filterLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
|
this.filterLabel.AutoSize = true;
|
|
this.filterLabel.Text = "Filter";
|
|
this.filterTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.filterTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.filterTextBox_KeyDown);
|
|
this.levelLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
|
this.levelLabel.AutoSize = true;
|
|
this.levelLabel.Text = "Level";
|
|
this.levelComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.levelComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
this.levelComboBox.SelectedIndexChanged += new System.EventHandler(this.filterValueChanged);
|
|
this.applicationLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
|
this.applicationLabel.AutoSize = true;
|
|
this.applicationLabel.Text = "Application";
|
|
this.applicationComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.applicationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
this.applicationComboBox.SelectedIndexChanged += new System.EventHandler(this.filterValueChanged);
|
|
this.applyFilterButton.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.applyFilterButton.Text = "Apply";
|
|
this.applyFilterButton.Click += new System.EventHandler(this.applyFilterButton_Click);
|
|
this.clearFilterButton.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.clearFilterButton.Text = "Reset";
|
|
this.clearFilterButton.Click += new System.EventHandler(this.clearFilterButton_Click);
|
|
//
|
|
// logContextMenu
|
|
//
|
|
this.logContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
this.copySelectionMenuItem,
|
|
this.copyLineMenuItem,
|
|
this.copyAllMenuItem});
|
|
this.copySelectionMenuItem.Text = "Copy selection";
|
|
this.copySelectionMenuItem.Click += new System.EventHandler(this.copySelectionMenuItem_Click);
|
|
this.copyLineMenuItem.Text = "Copy current line";
|
|
this.copyLineMenuItem.Click += new System.EventHandler(this.copyLineMenuItem_Click);
|
|
this.copyAllMenuItem.Text = "Copy all visible logs";
|
|
this.copyAllMenuItem.Click += new System.EventHandler(this.copyAllButton_Click);
|
|
//
|
|
// logView
|
|
//
|
|
this.logView.BackColor = System.Drawing.SystemColors.Window;
|
|
this.logView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.logView.ContextMenuStrip = this.logContextMenu;
|
|
this.logView.DetectUrls = false;
|
|
this.logView.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.logView.Font = new System.Drawing.Font("Consolas", 9F);
|
|
this.logView.HideSelection = false;
|
|
this.logView.Location = new System.Drawing.Point(0, 69);
|
|
this.logView.Name = "logView";
|
|
this.logView.ReadOnly = true;
|
|
this.logView.Size = new System.Drawing.Size(1184, 554);
|
|
this.logView.TabIndex = 2;
|
|
this.logView.Text = "";
|
|
this.logView.WordWrap = true;
|
|
//
|
|
// statusStrip
|
|
//
|
|
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
this.receiverStatusLabel,
|
|
this.statusSpacer,
|
|
this.countStatusLabel});
|
|
this.statusStrip.Location = new System.Drawing.Point(0, 623);
|
|
this.statusStrip.Name = "statusStrip";
|
|
this.statusStrip.Size = new System.Drawing.Size(1184, 22);
|
|
this.statusStrip.TabIndex = 3;
|
|
this.receiverStatusLabel.Text = "Listening";
|
|
this.statusSpacer.Spring = true;
|
|
this.countStatusLabel.Text = "Received: 0 | Visible: 0";
|
|
//
|
|
// MainForm
|
|
//
|
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
this.ClientSize = new System.Drawing.Size(1184, 645);
|
|
this.Controls.Add(this.logView);
|
|
this.Controls.Add(this.filterPanel);
|
|
this.Controls.Add(this.mainToolStrip);
|
|
this.Controls.Add(this.statusStrip);
|
|
this.KeyPreview = true;
|
|
this.MinimumSize = new System.Drawing.Size(860, 480);
|
|
this.Name = "MainForm";
|
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
|
this.Text = "Application live diagnostic";
|
|
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MainForm_KeyDown);
|
|
this.mainToolStrip.ResumeLayout(false);
|
|
this.mainToolStrip.PerformLayout();
|
|
this.filterPanel.ResumeLayout(false);
|
|
this.filterPanel.PerformLayout();
|
|
this.logContextMenu.ResumeLayout(false);
|
|
this.statusStrip.ResumeLayout(false);
|
|
this.statusStrip.PerformLayout();
|
|
this.ResumeLayout(false);
|
|
this.PerformLayout();
|
|
}
|
|
}
|
|
}
|