From db15c85121f61afe69698e877587815b954661d2 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Tue, 20 Nov 2018 12:27:22 -0800 Subject: [PATCH] Eliminate SetInterval for animation, invoke when auto shown --- .../PartPreviewWindow/MainViewWidget.cs | 32 ++++++------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/MatterControlLib/PartPreviewWindow/MainViewWidget.cs b/MatterControlLib/PartPreviewWindow/MainViewWidget.cs index a5f8aa831..d20f9951a 100644 --- a/MatterControlLib/PartPreviewWindow/MainViewWidget.cs +++ b/MatterControlLib/PartPreviewWindow/MainViewWidget.cs @@ -150,25 +150,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // Register listeners UserSettings.Instance.SettingChanged += SetLinkButtonsVisibility; - RunningInterval showUpdateInterval = null; - updateAvailableButton.VisibleChanged += (s, e) => - { - if (!updateAvailableButton.Visible) - { - if (showUpdateInterval != null) - { - UiThread.ClearInterval(showUpdateInterval); - showUpdateInterval = null; - } - return; - } - - showUpdateInterval = UiThread.SetInterval(() => - { - ShowUpdateAvailableAnimation(); - }, 120); - }; - SetLinkButtonsVisibility(this, null); updateAvailableButton.Click += (s, e) => UiThread.RunOnIdle(() => { @@ -334,6 +315,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow double displayTime = 1; double pulseTime = 1; double totalSeconds = 0; + var textWidgets = updateAvailableButton.Descendants().Where((w) => w.Visible == true).ToArray(); Color startColor = theme.TextColor; @@ -380,9 +362,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (UpdateControlData.Instance.UpdateStatus == UpdateControlData.UpdateStatusStates.UpdateAvailable) { - updateAvailableButton.Visible = true; - // if we are going to show the update link hide the whats new link no matter what - seeWhatsNewButton.Visible = false; + if (!updateAvailableButton.Visible) + { + updateAvailableButton.Visible = true; + + this.ShowUpdateAvailableAnimation(); + + // if we are going to show the update link hide the whats new link no matter what + seeWhatsNewButton.Visible = false; + } } else {