From 2076f8fa0b97011412b1d917f9e513c3d8ff29d7 Mon Sep 17 00:00:00 2001 From: Philipp Sumi Date: Sat, 16 Nov 2013 19:46:49 +0000 Subject: [PATCH] CHG If setting the taskbar doesn't work, the control just retries again (and again) rather than throwing an exception. NTFY-6 git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@173 9f600761-6f11-4665-b6dc-0185e9171623 --- Source/NotifyIconWpf/TaskbarIcon.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Source/NotifyIconWpf/TaskbarIcon.cs b/Source/NotifyIconWpf/TaskbarIcon.cs index 5b9df1a..b635119 100644 --- a/Source/NotifyIconWpf/TaskbarIcon.cs +++ b/Source/NotifyIconWpf/TaskbarIcon.cs @@ -883,11 +883,7 @@ namespace Hardcodet.Wpf.TaskbarNotification //couldn't create the icon - we can assume this is because explorer is not running (yet!) //-> try a bit later again rather than throwing an exception. Typically, if the windows // shell is being loaded later, this method is being reinvoked from OnTaskbarCreated - Task.Factory.StartNew(() => - { - Thread.Sleep(1000); - CreateTaskbarIcon(); - }); + // (we could also retry after a delay, but that's currently YAGNI) return; } @@ -900,7 +896,6 @@ namespace Hardcodet.Wpf.TaskbarNotification } } - /// /// Closes the taskbar icon if required. /// @@ -908,6 +903,8 @@ namespace Hardcodet.Wpf.TaskbarNotification { lock (this) { + //make sure we didn't schedule a creation + if (IsTaskbarIconCreated) { Util.WriteIconData(ref iconData, NotifyCommand.Delete, IconDataMembers.Message);