feat: 优化第一次启动时的弹窗提醒

This commit is contained in:
2026-01-18 20:55:31 +08:00
parent 4b5609d275
commit 78c07a12d0
2 changed files with 7 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ namespace TimerApp
public int RestMinutes { get; set; } = 1; public int RestMinutes { get; set; } = 1;
public int IdleThresholdSeconds { get; set; } = 30; public int IdleThresholdSeconds { get; set; } = 30;
public bool IsDarkMode { get; set; } = true; public bool IsDarkMode { get; set; } = true;
public bool HasShownMinimizeTip { get; set; } = false;
private static string LegacyConfigPath => Path.Combine(AppContext.BaseDirectory, "settings.json"); private static string LegacyConfigPath => Path.Combine(AppContext.BaseDirectory, "settings.json");

View File

@@ -524,15 +524,14 @@ namespace TimerApp
notifyIcon1.ShowBalloonTip(3000, "休息结束", "继续加油工作吧!", ToolTipIcon.Info); notifyIcon1.ShowBalloonTip(3000, "休息结束", "继续加油工作吧!", ToolTipIcon.Info);
} }
private bool _hasShownMinimizeTip = false;
private void btnHide_Click(object sender, EventArgs e) private void btnHide_Click(object sender, EventArgs e)
{ {
this.Hide(); this.Hide();
if (!_hasShownMinimizeTip) if (!_settings.HasShownMinimizeTip)
{ {
notifyIcon1.ShowBalloonTip(2000, "已隐藏", "程序仍在后台运行,双击托盘图标恢复。", ToolTipIcon.Info); notifyIcon1.ShowBalloonTip(2000, "已隐藏", "程序仍在后台运行,双击托盘图标恢复。", ToolTipIcon.Info);
_hasShownMinimizeTip = true; _settings.HasShownMinimizeTip = true;
_settings.Save();
} }
} }
@@ -542,10 +541,11 @@ namespace TimerApp
{ {
e.Cancel = true; e.Cancel = true;
this.Hide(); this.Hide();
if (!_hasShownMinimizeTip) if (!_settings.HasShownMinimizeTip)
{ {
notifyIcon1.ShowBalloonTip(2000, "已隐藏", "程序仍在后台运行,双击托盘图标恢复。", ToolTipIcon.Info); notifyIcon1.ShowBalloonTip(2000, "已隐藏", "程序仍在后台运行,双击托盘图标恢复。", ToolTipIcon.Info);
_hasShownMinimizeTip = true; _settings.HasShownMinimizeTip = true;
_settings.Save();
} }
} }
else else