/// <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.SystemTrayApp; ni.Text = "System Tray Utility Application Demonstration Program"; ni.Visible = true; // Attach a context menu. ni.ContextMenuStrip = new ContextMenus().Create(); SleepControl.PreventSleep(); }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> public void Dispose() { // When the application closes, this will remove the icon from the system tray immediately. ni.Dispose(); SleepControl.EnableSleep(); }