diff --git a/SparkleShare/Windows/SparkleNotifyIcon.cs b/SparkleShare/Windows/SparkleNotifyIcon.cs index a3c4aa46..3db05532 100644 --- a/SparkleShare/Windows/SparkleNotifyIcon.cs +++ b/SparkleShare/Windows/SparkleNotifyIcon.cs @@ -19,6 +19,7 @@ using System; using System.ComponentModel; using System.Diagnostics; using System.Runtime.InteropServices; +using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; @@ -253,11 +254,18 @@ namespace SparkleShare { try { if (button == left_button_down || button == right_button_down) { - Rect context_menu_rect = GetContextMenuRect(ContextMenu); - Point hit_point = GetHitPoint(data_pointer); + Rect context_menu_rect = GetContextMenuRect (ContextMenu); + Point hit_point = GetHitPoint (data_pointer); - if (!context_menu_rect.Contains(hit_point)) - ContextMenu.IsOpen = false; + if (!context_menu_rect.Contains(hit_point)) { + new Thread (() => { + Thread.Sleep (500); + + Dispatcher.BeginInvoke ((Action) delegate { + ContextMenu.IsOpen = false; + }); + }).Start (); + } } } finally { diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index 270b5d23..e17a3a98 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -144,9 +144,9 @@ namespace SparkleShare { this.exit_item = new SparkleMenuItem () { Header = "Exit" }; - add_item.Click += Controller.AddHostedProjectClicked; - this.log_item.Click += Controller.RecentEventsClicked; - about_item.Click += Controller.AboutClicked; + add_item.Click += delegate { Controller.AddHostedProjectClicked (); }; + this.log_item.Click += delegate { Controller.RecentEventsClicked (); }; + about_item.Click += delegate { Controller.AboutClicked (); }; notify_check_box.Click += delegate { this.context_menu.IsOpen = false; @@ -198,7 +198,7 @@ namespace SparkleShare { Header = "Try again" }; - try_again_item.Click += Controller.TryAgainDelegate (folder_name); + try_again_item.Click += delegate { Controller.TryAgainDelegate (folder_name); }; subfolder_item.Items.Add (error_item); subfolder_item.Items.Add (new Separator ()); @@ -206,7 +206,7 @@ namespace SparkleShare { } else { subfolder_item.Icon = subfolder_image; - subfolder_item.Click += Controller.OpenFolderDelegate (folder_name); + subfolder_item.Click += delegate { Controller.OpenFolderDelegate (folder_name); }; } this.context_menu.Items.Add (subfolder_item);