/// <summary> /// Displays the icon in the system tray. /// </summary> public void Display() { // Put the icon in the system tray and allow it react to mouse clicks. ni.MouseClick += new MouseEventHandler(ni_MouseClick); ni.Icon = Resources.TrayIcon; ni.Text = "System Tray Utility Application Demonstration Program"; ni.Visible = true; // Attach a context menu. ni.ContextMenuStrip = new ContextMenus().Create(); //I guess listen _listener = new Listen(); }
/// <summary> /// Handles the MouseClick event of the ni control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param> void ni_MouseClick(object sender, MouseEventArgs e) { // Handle mouse button clicks. if (e.Button == MouseButtons.Left) { // Start Windows Explorer. Process.Start("explorer", null); } else if (e.Button == MouseButtons.Middle) { List <string> test = _listener.GetData(); test.ForEach(i => Debug.WriteLine(String.Format("{0}", i))); _listener.Dispose(); _listener = new Listen(); } }