mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-02-02 01:35:37 -05:00
WPF NotifyIcon
-------------- ADD Completed events. FIX Suppressing second left mouse click event in case of a double click. CHG General cleanup. git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@53 9f600761-6f11-4665-b6dc-0185e9171623
This commit is contained in:
@@ -35,13 +35,15 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
/// </summary>
|
||||
private WindowProcedureHandler messageHandler;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates the helper message window that is used
|
||||
/// to receive messages from the taskbar icon.
|
||||
/// </summary>
|
||||
private void CreateMessageWindow()
|
||||
{
|
||||
WindowId = "WPFTaskbarIcon_" + Guid.NewGuid().ToString();
|
||||
//generate a unique ID for the window
|
||||
WindowId = "WPFTaskbarIcon_" + DateTime.Now.Ticks;
|
||||
|
||||
//register window message handler
|
||||
messageHandler = OnWindowMessageReceived;
|
||||
@@ -86,14 +88,13 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
{
|
||||
if (messageId == taskbarRestartMessageId)
|
||||
{
|
||||
//recreate the icon if the taskbar was restarted
|
||||
//TODO refresh icon
|
||||
//recreate the icon if the taskbar was restarted (e.g. due to Win Explorer shutdown)
|
||||
TaskbarCreated();
|
||||
}
|
||||
|
||||
//forward message
|
||||
ProcessWindowMessage(messageId, wparam, lparam);
|
||||
|
||||
//handle mouse clicks...
|
||||
|
||||
// Pass the message to the default window procedure
|
||||
return WinApi.DefWindowProc(hwnd, messageId, wparam, lparam);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,14 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
/// </summary>
|
||||
public NotifyIconVersion Version { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to track whether a mouse-up event is just
|
||||
/// the aftermath of a double-click and therefore needs
|
||||
/// to be suppressed.
|
||||
/// </summary>
|
||||
private bool isDoubleClick;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -47,7 +55,7 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
public event Action<bool> BallonToolTipChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Fired if the taskbar was created. Requires the taskbar
|
||||
/// Fired if the taskbar was created or restarted. Requires the taskbar
|
||||
/// icon to be reset.
|
||||
/// </summary>
|
||||
public event Action TaskbarCreated;
|
||||
@@ -119,11 +127,16 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
|
||||
|
||||
case 0x202:
|
||||
Debug.WriteLine("left up");
|
||||
MouseEventReceived(MouseEvent.IconLeftMouseUp);
|
||||
if (!isDoubleClick)
|
||||
{
|
||||
MouseEventReceived(MouseEvent.IconLeftMouseUp);
|
||||
}
|
||||
isDoubleClick = false;
|
||||
break;
|
||||
|
||||
case 0x203:
|
||||
Debug.WriteLine("left click 2");
|
||||
isDoubleClick = true;
|
||||
MouseEventReceived(MouseEvent.IconDoubleClick);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user