// Adds the notification icon
public void AddTaskbarIcon()
{
// The display text of the icon
string DisplayText = "MouseControl running at " + WebServer.runningIp;
systemIcon = new TaskbarIcon();
systemIcon.Icon = new System.Drawing.Icon(typeof(App), "MouseControlIcon.ico");
systemIcon.ToolTipText = DisplayText;
systemIcon.ShowBalloonTip("MouseControl", DisplayText, BalloonIcon.Info);
// Remove the text after a certain amount of time
Thread.Sleep(6000);
systemIcon.HideBalloonTip();
// Add context menu
ContextMenu cMenu = new ContextMenu();
MenuItem about = new MenuItem();
about.Header = "About";
about.Click += aboutClick;
MenuItem exit = new MenuItem();
exit.Header = "Exit";
exit.Click += exitClick;
cMenu.Items.Add(about);
cMenu.Items.Add(exit);
// Add System tray icon click handler
systemIcon.TrayMouseDoubleClick += SystemTrayIconClick;
systemIcon.ContextMenu = cMenu;
}