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:
@@ -21,8 +21,6 @@ public class MainForm : Form
|
|||||||
readonly System.Windows.Forms.Timer _statusTimer;
|
readonly System.Windows.Forms.Timer _statusTimer;
|
||||||
readonly CancellationTokenSource _loopCts;
|
readonly CancellationTokenSource _loopCts;
|
||||||
|
|
||||||
bool _closingFromTray;
|
|
||||||
|
|
||||||
readonly HeatMap _heatA;
|
readonly HeatMap _heatA;
|
||||||
readonly HeatMap _heatB;
|
readonly HeatMap _heatB;
|
||||||
readonly ProgressBar _gaugeRecvA;
|
readonly ProgressBar _gaugeRecvA;
|
||||||
@@ -377,7 +375,6 @@ public class MainForm : Form
|
|||||||
|
|
||||||
void ExitFromTray()
|
void ExitFromTray()
|
||||||
{
|
{
|
||||||
_closingFromTray = true;
|
|
||||||
_tray.Visible = false;
|
_tray.Visible = false;
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
}
|
}
|
||||||
@@ -390,12 +387,6 @@ public class MainForm : Form
|
|||||||
|
|
||||||
void OnFormClosing(object? sender, FormClosingEventArgs e)
|
void OnFormClosing(object? sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.CloseReason == CloseReason.UserClosing && !_closingFromTray)
|
|
||||||
{
|
|
||||||
e.Cancel = true;
|
|
||||||
Hide();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_tray.Visible = false;
|
_tray.Visible = false;
|
||||||
_statusTimer.Stop();
|
_statusTimer.Stop();
|
||||||
_loopCts.Cancel();
|
_loopCts.Cancel();
|
||||||
|
|||||||
Reference in New Issue
Block a user