diff --git a/App.config b/App.config index c1c065b..e4b9285 100644 --- a/App.config +++ b/App.config @@ -21,10 +21,14 @@ + + + + - + diff --git a/Constant/CommonEnum.cs b/Constant/CommonEnum.cs index 33310c9..c45c948 100644 --- a/Constant/CommonEnum.cs +++ b/Constant/CommonEnum.cs @@ -14,6 +14,6 @@ namespace GeekDesk.Constant IMAGE_HEIGHT_AM = 52, //动画变换高度 IMAGE_PANEL_WIDTH = 110, //图标容器宽度 IMAGE_PANEL_HEIGHT = 90, //图标容器高度 - WINDOW_ANIMATION_TIME = 200, //主窗口动画时间 + WINDOW_ANIMATION_TIME = 200, //主窗口动画时间, } } diff --git a/Constant/TodoTaskExecType.cs b/Constant/TodoTaskExecType.cs new file mode 100644 index 0000000..d634ce7 --- /dev/null +++ b/Constant/TodoTaskExecType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GeekDesk.Constant +{ + public enum TodoTaskExecType + { + SET_TIME = 1, //指定时间 + CRON = 2 //cron表达式 + } +} diff --git a/Control/Other/BacklogNotificatin.xaml.cs b/Control/Other/BacklogNotificatin.xaml.cs index cfe0aed..b00460d 100644 --- a/Control/Other/BacklogNotificatin.xaml.cs +++ b/Control/Other/BacklogNotificatin.xaml.cs @@ -1,6 +1,9 @@ -using GeekDesk.Task; +using GeekDesk.Constant; +using GeekDesk.Task; using GeekDesk.Util; using GeekDesk.ViewModel; +using HandyControl.Controls; +using Quartz; using System; using System.Collections.Generic; using System.Linq; @@ -34,8 +37,36 @@ namespace GeekDesk.Control.Other { ToDoInfo info = this.DataContext as ToDoInfo; info.DoneTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - appData.ToDoList.Remove(info); //执行任务删除 - appData.HiToDoList.Add(info); //添加历史任务 + 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 nextTime = ddo.LocalDateTime; + TimeSpan ts = nextTime.Subtract(dtNow); + int minutes = (int)Math.Ceiling(ts.TotalMinutes); + if (minutes < 0) + { + minutes = 0; + } + if (minutes > 60) + { + int m = minutes % 60; + int h = minutes / 60; + Growl.SuccessGlobal("下次任务将在 " + h + " 小时零 " + m + " 分钟后提醒您!"); + } + else + { + Growl.SuccessGlobal("下次任务将在 " + minutes + " 分钟后提醒您!"); + } + } else + { + appData.ToDoList.Remove(info); //执行任务删除 + appData.HiToDoList.Add(info); //添加历史任务 + } ToDoTask.activityBacklog[info].Close(); //关闭桌面通知 ToDoTask.activityBacklog.Remove(info);//激活任务删除 CommonCode.SaveAppData(appData); @@ -93,9 +124,11 @@ namespace GeekDesk.Control.Other { case "分": info.ExeTime = DateTime.Now.AddMinutes(time).ToString("yyyy-MM-dd HH:mm:ss"); + Growl.SuccessGlobal("将在 " + time + " 分钟后再次提醒您!"); break; case "时": info.ExeTime = DateTime.Now.AddHours(time).ToString("yyyy-MM-dd HH:mm:ss"); + Growl.SuccessGlobal("将在 " + time + " 小时后再次提醒您!"); break; } ToDoTask.activityBacklog[info].Close(); //关闭桌面通知 diff --git a/Control/UserControls/Config/ThemeControl.xaml b/Control/UserControls/Config/ThemeControl.xaml index 2ca2e15..8bc53a2 100644 --- a/Control/UserControls/Config/ThemeControl.xaml +++ b/Control/UserControls/Config/ThemeControl.xaml @@ -12,11 +12,11 @@ - - + + - + - + @@ -38,16 +38,16 @@ - + - - + + - + - + - + - + - + - + - + + + + + + + + + + - - + +