From 037343e301fe1c9a87df9e842cb456d06c84fab6 Mon Sep 17 00:00:00 2001 From: batzen Date: Sat, 21 Feb 2015 11:30:41 +0100 Subject: [PATCH] Fixes #68 by preventing delay show when KeyTipService is detached and by checking if window is not null when showing --- Fluent/Services/KeyTipService.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Fluent/Services/KeyTipService.cs b/Fluent/Services/KeyTipService.cs index 70a9549df..4daee5ef3 100644 --- a/Fluent/Services/KeyTipService.cs +++ b/Fluent/Services/KeyTipService.cs @@ -137,13 +137,16 @@ public void Attach() /// public void Detach() { - if (!this.attached) + if (this.attached == false) { return; } this.attached = false; + // prevent delay show + this.timer.Stop(); + if (this.window != null) { this.window.PreviewKeyDown -= this.OnWindowKeyDown; @@ -342,9 +345,11 @@ private void ShowDelayed() private void Show() { - // Check whether the window is still active - // (it prevent keytips showing during Alt-Tab'ing) - if (this.window.IsActive == false) + // Check whether the window is + // - still present (prevents exceptions when window is closed by system commands) + // - still active (prevents keytips showing during Alt-Tab'ing) + if (this.window == null + || this.window.IsActive == false) { this.RestoreFocuses(); return;