Close button quits app instead of hiding to tray

- OnFormClosing no longer intercepts close button — app quits on X
- Minimize still hides to tray (OnResize unchanged)
- Removed unused _closingFromTray flag
- Tray Exit and tray double-click restore unchanged
This commit is contained in:
2026-08-09 11:33:36 +00:00
parent 4c44d48a02
commit 4ad85f57ec
-9
View File
@@ -21,8 +21,6 @@ public class MainForm : Form
readonly System.Windows.Forms.Timer _statusTimer;
readonly CancellationTokenSource _loopCts;
bool _closingFromTray;
readonly HeatMap _heatA;
readonly HeatMap _heatB;
readonly ProgressBar _gaugeRecvA;
@@ -377,7 +375,6 @@ public class MainForm : Form
void ExitFromTray()
{
_closingFromTray = true;
_tray.Visible = false;
Application.Exit();
}
@@ -390,12 +387,6 @@ public class MainForm : Form
void OnFormClosing(object? sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing && !_closingFromTray)
{
e.Cancel = true;
Hide();
return;
}
_tray.Visible = false;
_statusTimer.Stop();
_loopCts.Cancel();