FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit e72eda79 authored by Dr Adam Thorn's avatar Dr Adam Thorn
Browse files

Invoke notifier's ShowContextMenu on left click

parent c505d730
No related branches found
No related tags found
No related merge requests found
using System;
using System.Diagnostics;
using System.Reflection;
using System.ServiceModel;
using System.Windows.Forms;
......@@ -42,6 +43,19 @@ namespace WpkgNotifier
notifyIcon.ContextMenu = new ContextMenu(new MenuItem[]
{ syncMenuItem, queryMenuItem, exitMenuItem });
notifyIcon.Visible = true;
// reflectively call our ShowContextMenu method upon left-click
notifyIcon.MouseDown += (sender, e) =>
{
if (e.Button == MouseButtons.Left)
{
MethodInfo mi = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
if (mi != null)
{
mi.Invoke(notifyIcon, null);
}
}
};
}
private void OpenMessageChannel()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment