Skip to content
Snippets Groups Projects
Commit 25965456 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Indicate the exit wrapper method by making it an overloaded variant.

parent e5ce5f92
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment