From e971ee855014cf3103c56634adff8132c172059a Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 18 Dec 2024 23:30:14 -0500 Subject: [PATCH] Use explicit InvokeAsync when possible --- CHANGELIST.md | 1 + MPF.UI/UserControls/LogOutput.xaml.cs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 349a8dd13..354a13080 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -86,6 +86,7 @@ - Fix access level for log queue - Fix access level for log document - Simplify ProcessLogLine method +- Use explicit InvokeAsync when possible ### 3.2.4 (2024-11-24) diff --git a/MPF.UI/UserControls/LogOutput.xaml.cs b/MPF.UI/UserControls/LogOutput.xaml.cs index 74a2082ff..8f880e214 100644 --- a/MPF.UI/UserControls/LogOutput.xaml.cs +++ b/MPF.UI/UserControls/LogOutput.xaml.cs @@ -14,7 +14,7 @@ public partial class LogOutput : UserControl /// /// Document representing the text /// - private readonly FlowDocument _document; + private readonly FlowDocument _document; /// /// Queue of items that need to be logged @@ -129,7 +129,11 @@ internal void ProcessLogLine(LogLine logLine) if (nextText == null) return; +#if NET40 Dispatcher.Invoke(() => +#else + Dispatcher.InvokeAsync(() => +#endif { var run = logLine.GenerateRun(); _paragraph.Inlines.Add(run);