From 48e3ac56fc75ad45fa0b97285617ae9fb027d9b5 Mon Sep 17 00:00:00 2001 From: Rupert Benbrook Date: Thu, 9 Nov 2023 13:10:11 +0000 Subject: [PATCH] Fixing a performance problem in message display --- .../ControlOverlayMessageDisplay.cs | 13 ++++-- .../AltitudeAngelWings/ObservableProperty.cs | 4 +- .../Service/Messaging/IMessagesService.cs | 1 - .../Service/Messaging/MessagesService.cs | 41 +++++++------------ 4 files changed, 27 insertions(+), 32 deletions(-) diff --git a/ExtLibs/AltitudeAngelWings.Plugin/ControlOverlayMessageDisplay.cs b/ExtLibs/AltitudeAngelWings.Plugin/ControlOverlayMessageDisplay.cs index 55b323bc7c..aceeb70ab7 100644 --- a/ExtLibs/AltitudeAngelWings.Plugin/ControlOverlayMessageDisplay.cs +++ b/ExtLibs/AltitudeAngelWings.Plugin/ControlOverlayMessageDisplay.cs @@ -56,15 +56,22 @@ public void RemoveMessage(Message message) if (!_parent.Visible) return; _parent.SuspendLayout(); var labels = GetMessageLabels(); + var removed = false; foreach (var label in labels) { if (label.Tag != message) continue; _parent.Controls.Remove(label); labels.Remove(label); label.Dispose(); + removed = true; break; } - LayoutLabels(labels); + + if (removed) + { + LayoutLabels(labels); + } + _parent.ResumeLayout(); }); } @@ -110,7 +117,7 @@ private static Color GetColorForMessage(Message message) } } - private void LayoutLabels(ICollection