diff --git a/ATxTray/AutoTxTray.cs b/ATxTray/AutoTxTray.cs index 8e998bd8727e542a3b4cb8672a98bbec3d245ed8..abdf7db63686f4bcef15268c963cf629ce0c071a 100644 --- a/ATxTray/AutoTxTray.cs +++ b/ATxTray/AutoTxTray.cs @@ -133,7 +133,7 @@ namespace ATxTray private void SetupContextMenu() { Log.Trace("Building context menu..."); _miExit.Text = @"Exit"; - _miExit.Click += MiExitClick; + _miExit.Click += AutoTxTrayExit; _miTitle.Font = new Font(_cmStrip.Font, FontStyle.Bold); _miTitle.Text = AppTitle; @@ -176,13 +176,23 @@ namespace ATxTray _notifyIcon.ContextMenuStrip = _cmStrip; Log.Trace("Finished building context menu."); } - + + /// <summary> + /// Clean up the tray icon and shut down the application. + /// </summary> private void AutoTxTrayExit() { _notifyIcon.Visible = false; Log.Info("Shutting down {0}.", AppTitle); Application.Exit(); } + /// <summary> + /// Wrapper for AutoTxTrayExit to act as an event handler. + /// </summary> + private void AutoTxTrayExit(object sender, EventArgs e) { + AutoTxTrayExit(); + } + /// <summary> /// Update the tooltip making sure not to exceed the 63 characters limit. /// </summary> @@ -232,10 +242,6 @@ namespace ATxTray _statusFileChanged = true; } - private void MiExitClick(object sender, EventArgs e) { - AutoTxTrayExit(); - } - private void ShowContextMenu(object sender, EventArgs e) { // just show the menu again, to avoid that clicking the menu item closes the context // menu without having to disable the item (which would grey out the text and icon):