Fixed a small invisible issue: the context menu is show 2x when clicking the NotifyIcon. This causes some code to be run 2x, decreasing the context-menu performance.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2193 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-10-23 10:07:05 +00:00
parent afbe046d3e
commit 703ecbf143
2 changed files with 7 additions and 5 deletions

View file

@ -244,7 +244,7 @@ namespace Greenshot {
// //
this.notifyIcon.ContextMenuStrip = this.contextMenu; this.notifyIcon.ContextMenuStrip = this.contextMenu;
this.notifyIcon.Text = "Greenshot"; this.notifyIcon.Text = "Greenshot";
this.notifyIcon.Click += new System.EventHandler(this.NotifyIconClick); this.notifyIcon.MouseUp += new System.Windows.Forms.MouseEventHandler(this.NotifyIconClick);
// //
// backgroundWorkerTimer // backgroundWorkerTimer
// //

View file

@ -1084,9 +1084,11 @@ namespace Greenshot {
new BugReportForm(exceptionText).ShowDialog(); new BugReportForm(exceptionText).ShowDialog();
} }
private void NotifyIconClick(object sender, EventArgs eventArgs) { private void NotifyIconClick(object sender, MouseEventArgs e) {
MethodInfo oMethodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic); if (e.Button == MouseButtons.Left) {
oMethodInfo.Invoke(notifyIcon, null); MethodInfo oMethodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
oMethodInfo.Invoke(notifyIcon, null);
}
} }
/// <summary> /// <summary>