Fully remove processing queue code

This commit is contained in:
Matt Nadareski
2024-12-19 00:37:56 -05:00
parent cebbeb264f
commit 216c6de970
3 changed files with 12 additions and 117 deletions

View File

@@ -16,11 +16,6 @@ namespace MPF.UI.UserControls
/// </summary>
private readonly FlowDocument _document;
/// <summary>
/// Queue of items that need to be logged
/// </summary>
//private readonly ProcessingQueue<LogLine> _logQueue;
/// <summary>
/// Paragraph backing the log
/// </summary>
@@ -49,9 +44,6 @@ namespace MPF.UI.UserControls
_paragraph = new Paragraph();
_document.Blocks.Add(_paragraph);
// Setup the processing queue
//_logQueue = new ProcessingQueue<LogLine>(ProcessLogLine);
// Add handlers
OutputViewer!.SizeChanged += OutputViewerSizeChanged;
Output!.TextChanged += OnTextChanged;
@@ -75,11 +67,18 @@ namespace MPF.UI.UserControls
if (text == null)
return;
// Enqueue the text
//_logQueue.Enqueue(new LogLine(text, logLevel));
// Create a new log line
var logLine = new LogLine(text, logLevel);
// EXPERIMENTAL - Directly process the log line
ProcessLogLine(new LogLine(text, logLevel));
#if NET40
Dispatcher.Invoke(() =>
#else
Dispatcher.InvokeAsync(() =>
#endif
{
var run = logLine.GenerateRun();
_paragraph.Inlines.Add(run);
});
}
/// <summary>
@@ -121,28 +120,6 @@ namespace MPF.UI.UserControls
}
}
/// <summary>
/// Process the log lines in the queue
/// </summary>
/// <param name="logLine">LogLine item to process</param>
internal void ProcessLogLine(LogLine logLine)
{
// Null text gets ignored
string nextText = logLine.Text;
if (nextText == null)
return;
#if NET40
Dispatcher.Invoke(() =>
#else
Dispatcher.InvokeAsync(() =>
#endif
{
var run = logLine.GenerateRun();
_paragraph.Inlines.Add(run);
});
}
#endregion
#region Helpers