private void NotifyIcon_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (mainService.IsWorkTimerRun() && !backgroundWorker.IsBusy) { double restCT = mainService.GetRestCountdownMinutes(); string restStr = Math.Round(restCT, 1) + $"{Application.Current.Resources["Lang_Minutes_n"]}"; if (restCT < 1) { restStr = Math.Round((restCT * 60), 0).ToString() + $"{Application.Current.Resources["Lang_Seconds_n"]}"; } if (restCT > 60) { restCT = Math.Round(restCT / 60, 1); restStr = $"{restCT.ToString()}{Application.Current.Resources["Lang_Hours_n"]}"; if (restCT.ToString().IndexOf(".") != -1) { restStr = $"{restCT.ToString().Split('.')[0]}{Application.Current.Resources["Lang_Hours_n"]} {restCT.ToString().Split('.')[1]}{Application.Current.Resources["Lang_Minutes_n"]}"; } } SetText($"Project Eye\r\n{Application.Current.Resources["Lang_Thenextbreak"]}: " + restStr); } else if (config.options.General.Noreset) { SetText($"Project Eye: {Application.Current.Resources["Lang_Reminderisoff"]}"); } else if (!backgroundWorker.IsBusy) { SetText("Project Eye"); } MouseMoveTrayIcon?.Invoke(sender, e); }
private void NotifyIcon_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (mainService.IsWorkTimerRun() && !backgroundWorker.IsBusy) { double restCT = mainService.GetRestCountdownMinutes(); string restStr = Math.Round(restCT, 1) + "分钟"; if (restCT < 1) { restStr = Math.Round((restCT * 60), 0).ToString() + "秒"; } if (restCT > 60) { restCT = Math.Round(restCT / 60, 1); restStr = $"{restCT.ToString()}小时"; if (restCT.ToString().IndexOf(".") != -1) { restStr = $"{restCT.ToString().Split('.')[0]}小时{restCT.ToString().Split('.')[1]}分钟"; } } notifyIcon.Text = "Project Eye\r\n距离下一次休息:" + restStr; } else if (config.options.General.Noreset) { notifyIcon.Text = "Project Eye:暂不提醒已开启"; } else if (!backgroundWorker.IsBusy) { notifyIcon.Text = "Project Eye"; } MouseMoveTrayIcon?.Invoke(sender, e); }