diff --git a/Control/Other/BacklogNotificatin.xaml b/Control/Other/BacklogNotificatin.xaml
index e672b09..5b63d8d 100644
--- a/Control/Other/BacklogNotificatin.xaml
+++ b/Control/Other/BacklogNotificatin.xaml
@@ -15,7 +15,7 @@
-
+
diff --git a/Control/Other/BacklogNotificatin.xaml.cs b/Control/Other/BacklogNotificatin.xaml.cs
index b00460d..be06ef4 100644
--- a/Control/Other/BacklogNotificatin.xaml.cs
+++ b/Control/Other/BacklogNotificatin.xaml.cs
@@ -40,13 +40,15 @@ namespace GeekDesk.Control.Other
if (info.ExecType == TodoTaskExecType.CRON)
{
CronExpression exp = new CronExpression(info.Cron);
- DateTime dtNow = DateTime.Now;
- DateTimeOffset ddo = DateTime.SpecifyKind(dtNow, DateTimeKind.Local);
- string nextExecTime = ddo.LocalDateTime.ToString("yyyy-MM-dd HH:mm:ss");
- info.ExeTime = nextExecTime;
+ DateTime nowTime = DateTime.Now;
- DateTime nextTime = ddo.LocalDateTime;
- TimeSpan ts = nextTime.Subtract(dtNow);
+ //计算下次执行时间
+ DateTime nextTime = DateTime.SpecifyKind(exp.GetNextValidTimeAfter(nowTime).Value.LocalDateTime, DateTimeKind.Local);
+
+ string nextTimeStr = nextTime.ToString("yyyy-MM-dd HH:mm:ss");
+ info.ExeTime = nextTimeStr;
+
+ TimeSpan ts = nextTime.Subtract(nowTime);
int minutes = (int)Math.Ceiling(ts.TotalMinutes);
if (minutes < 0)
{
@@ -62,7 +64,8 @@ namespace GeekDesk.Control.Other
{
Growl.SuccessGlobal("下次任务将在 " + minutes + " 分钟后提醒您!");
}
- } else
+ }
+ else
{
appData.ToDoList.Remove(info); //执行任务删除
appData.HiToDoList.Add(info); //添加历史任务
@@ -120,7 +123,7 @@ namespace GeekDesk.Control.Other
ToDoInfo info = this.DataContext as ToDoInfo;
int time = int.Parse(DelayTime.Text);
string type = DelayType.Text;
- switch(type)
+ switch (type)
{
case "分":
info.ExeTime = DateTime.Now.AddMinutes(time).ToString("yyyy-MM-dd HH:mm:ss");