Skip to content

Commit

Permalink
Fixes #68 by preventing delay show when KeyTipService is detached and…
Browse files Browse the repository at this point in the history
… by checking if window is not null when showing
  • Loading branch information
batzen committed Feb 21, 2015
1 parent 70cc051 commit 037343e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Fluent/Services/KeyTipService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,16 @@ public void Attach()
/// </summary>
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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 037343e

Please sign in to comment.