FIX Fixed potential event propagation before event listeners where registered.

This commit is contained in:
Philipp Sumi
2016-04-01 19:18:08 +02:00
parent e93c8ed503
commit 0426aa87d2
2 changed files with 8 additions and 3 deletions

View File

@@ -25,7 +25,6 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Hardcodet.Wpf.TaskbarNotification.Interop
{
@@ -119,7 +118,6 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
public WindowMessageSink(NotifyIconVersion version)
{
Version = version;
CreateMessageWindow();
}
@@ -127,6 +125,10 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
{
}
internal void Listen()
{
CreateMessageWindow();
}
/// <summary>
/// Creates a dummy instance that provides an empty
@@ -154,7 +156,7 @@ namespace Hardcodet.Wpf.TaskbarNotification.Interop
private void CreateMessageWindow()
{
//generate a unique ID for the window
WindowId = "WPFTaskbarIcon_" + DateTime.Now.Ticks;
WindowId = "WPFTaskbarIcon_" + Guid.NewGuid();
//register window message handler
messageHandler = OnWindowMessageReceived;