diff --git a/AppSettings.cs b/AppSettings.cs index 01930de..263c90c 100644 --- a/AppSettings.cs +++ b/AppSettings.cs @@ -10,6 +10,7 @@ namespace TimerApp public int RestMinutes { get; set; } = 1; public int IdleThresholdSeconds { get; set; } = 30; public bool IsDarkMode { get; set; } = true; + public bool HasShownMinimizeTip { get; set; } = false; private static string LegacyConfigPath => Path.Combine(AppContext.BaseDirectory, "settings.json"); diff --git a/MainForm.cs b/MainForm.cs index 780f861..0d7fef1 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -524,15 +524,14 @@ namespace TimerApp notifyIcon1.ShowBalloonTip(3000, "休息结束", "继续加油工作吧!", ToolTipIcon.Info); } - private bool _hasShownMinimizeTip = false; - private void btnHide_Click(object sender, EventArgs e) { this.Hide(); - if (!_hasShownMinimizeTip) + if (!_settings.HasShownMinimizeTip) { notifyIcon1.ShowBalloonTip(2000, "已隐藏", "程序仍在后台运行,双击托盘图标恢复。", ToolTipIcon.Info); - _hasShownMinimizeTip = true; + _settings.HasShownMinimizeTip = true; + _settings.Save(); } } @@ -542,10 +541,11 @@ namespace TimerApp { e.Cancel = true; this.Hide(); - if (!_hasShownMinimizeTip) + if (!_settings.HasShownMinimizeTip) { notifyIcon1.ShowBalloonTip(2000, "已隐藏", "程序仍在后台运行,双击托盘图标恢复。", ToolTipIcon.Info); - _hasShownMinimizeTip = true; + _settings.HasShownMinimizeTip = true; + _settings.Save(); } } else