Added "NoLeftClickDelay" TaskbarIcon dependency property, to optionally make left clicks work without delay.

This commit is contained in:
jr
2015-07-09 15:20:11 +02:00
parent 13cd4b1728
commit c2876ee758
2 changed files with 38 additions and 3 deletions

View File

@@ -67,6 +67,14 @@ namespace Hardcodet.Wpf.TaskbarNotification
/// </summary>
private readonly Timer singleClickTimer;
/// <summary>
/// The time we should wait for a double click.
/// </summary>
private int doubleClickWaitTime
{
get { return NoLeftClickDelay ? 0 : WinApi.GetDoubleClickTime(); }
}
/// <summary>
/// A timer that is used to close open balloon tooltips.
/// </summary>
@@ -409,7 +417,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
ShowTrayPopup(cursorPosition);
};
singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
singleClickTimer.Change(doubleClickWaitTime, Timeout.Infinite);
isLeftClickCommandInvoked = true;
}
else
@@ -431,7 +439,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
ShowContextMenu(cursorPosition);
};
singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
singleClickTimer.Change(doubleClickWaitTime, Timeout.Infinite);
isLeftClickCommandInvoked = true;
}
else
@@ -450,7 +458,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
{
LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
};
singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
singleClickTimer.Change(doubleClickWaitTime, Timeout.Infinite);
}
}