添加待办任务提醒功能

This commit is contained in:
Demo_Liu
2021-06-17 23:06:46 +08:00
parent 2ed8bd8148
commit 3804064af8
6 changed files with 145 additions and 37 deletions

View File

@@ -8,28 +8,50 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
namespace GeekDesk.Task
{
class BacklogTask
public class BacklogTask
{
private static void BackLogCheck()
///public static ObservableCollection<BacklogInfo> activityBacklog = new ObservableCollection<BacklogInfo>();
public static Dictionary<BacklogInfo, Notification> activityBacklog = new Dictionary<BacklogInfo, Notification>();
public static void BackLogCheck()
{
while (true)
System.Timers.Timer timer = new System.Timers.Timer();
timer.Enabled = true;
timer.Interval = 5000;
timer.Start();
timer.Elapsed += new System.Timers.ElapsedEventHandler(Check);
}
private static void Check(object source, ElapsedEventArgs e)
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
ObservableCollection<BacklogInfo> exeBacklogList = MainWindow.appData.ExeBacklogList;
foreach (BacklogInfo info in exeBacklogList)
if (MainWindow.appData.ExeBacklogList.Count > 0)
{
if (info.ExeTime.CompareTo(nowTime) == -1)
string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
ObservableCollection<BacklogInfo> exeBacklogList = MainWindow.appData.ExeBacklogList;
foreach (BacklogInfo info in exeBacklogList)
{
Notification.Show(new BacklogNotificatin(info), ShowAnimation.Fade, true);
if (info.ExeTime.CompareTo(nowTime) == -1 && !activityBacklog.ContainsKey(info))
{
activityBacklog.Add(info, Notification.Show(new BacklogNotificatin(info), ShowAnimation.Fade, true));
}
}
}
}
}));
}
}
}