diff --git a/Control/Other/BacklogNotificatin.xaml b/Control/Other/BacklogNotificatin.xaml
index 222214d..25683c5 100644
--- a/Control/Other/BacklogNotificatin.xaml
+++ b/Control/Other/BacklogNotificatin.xaml
@@ -9,35 +9,41 @@
Height="450">
-
+
+
- -->
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
+
diff --git a/Control/Other/BacklogNotificatin.xaml.cs b/Control/Other/BacklogNotificatin.xaml.cs
index 7379425..ad12d66 100644
--- a/Control/Other/BacklogNotificatin.xaml.cs
+++ b/Control/Other/BacklogNotificatin.xaml.cs
@@ -1,4 +1,6 @@
-using GeekDesk.ViewModel;
+using GeekDesk.Task;
+using GeekDesk.Util;
+using GeekDesk.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -20,9 +22,84 @@ namespace GeekDesk.Control.Other
///
public partial class BacklogNotificatin
{
+
+ private AppData appData = MainWindow.appData;
public BacklogNotificatin(BacklogInfo info)
{
InitializeComponent();
+ this.DataContext = info;
+ }
+
+ private void BacklogDone_Click(object sender, RoutedEventArgs e)
+ {
+ BacklogInfo info = this.DataContext as BacklogInfo;
+ info.DoneTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ appData.ExeBacklogList.Remove(info); //执行任务删除
+ appData.HiBacklogList.Add(info); //添加历史任务
+ BacklogTask.activityBacklog[info].Close(); //关闭桌面通知
+ BacklogTask.activityBacklog.Remove(info);//激活任务删除
+ CommonCode.SaveAppData(appData);
+ }
+
+
+ ///
+ /// 只允许输入数字
+ ///
+ ///
+ ///
+ private void DelayTime_PreviewTextInput(object sender, TextCompositionEventArgs e)
+ {
+ int textBoxInt;
+ //转化按下的键为数字,如果不是数字则会抓取到报错信息,不键入,反之则键入
+ try
+ {
+ textBoxInt = int.Parse($"{e.Text}");
+ }
+ catch (FormatException)
+ {
+ e.Handled = true;
+ }
+ }
+ ///
+ /// 失去焦点前如果为空
+ ///
+ ///
+ ///
+ private void DelayTime_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
+ {
+ int textBoxInt;
+ //转化val为数字,如果不是数字则会抓取到报错信息
+ try
+ {
+ textBoxInt = int.Parse(DelayTime.Text.Trim());
+ }
+ catch (FormatException)
+ {
+ DelayTime.Text = "10";
+ }
+ }
+
+ ///
+ /// 推迟提醒
+ ///
+ ///
+ ///
+ private void DelayButton_Click(object sender, RoutedEventArgs e)
+ {
+ BacklogInfo info = this.DataContext as BacklogInfo;
+ int time = int.Parse(DelayTime.Text);
+ string type = DelayType.Text;
+ switch(type)
+ {
+ case "分":
+ info.ExeTime = DateTime.Now.AddMinutes(time).ToString("yyyy-MM-dd HH:mm:ss");
+ break;
+ case "时":
+ info.ExeTime = DateTime.Now.AddHours(time).ToString("yyyy-MM-dd HH:mm:ss");
+ break;
+ }
+ BacklogTask.activityBacklog[info].Close(); //关闭桌面通知
+ BacklogTask.activityBacklog.Remove(info);//激活任务删除
}
}
}
diff --git a/GeekDesk.csproj b/GeekDesk.csproj
index 9fd21e8..c3996bd 100644
--- a/GeekDesk.csproj
+++ b/GeekDesk.csproj
@@ -275,6 +275,7 @@
+
\ No newline at end of file
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 35a5671..3ec2051 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -2,6 +2,7 @@
using GeekDesk.Constant;
using GeekDesk.Control;
using GeekDesk.Control.Windows;
+using GeekDesk.Task;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using GlobalHotKey;
@@ -37,6 +38,7 @@ namespace GeekDesk
this.Topmost = true;
this.Loaded += Window_Loaded;
this.SizeChanged += MainWindow_Resize;
+ BacklogTask.BackLogCheck();
}
private void LoadData()
diff --git a/Resource/Image/CompleteLogo.png b/Resource/Image/CompleteLogo.png
new file mode 100644
index 0000000..acfcef7
Binary files /dev/null and b/Resource/Image/CompleteLogo.png differ
diff --git a/Task/BacklogTask.cs b/Task/BacklogTask.cs
index 235138d..409bda9 100644
--- a/Task/BacklogTask.cs
+++ b/Task/BacklogTask.cs
@@ -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 activityBacklog = new ObservableCollection();
+
+ public static Dictionary activityBacklog = new Dictionary();
+
+ 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 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 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));
+ }
}
}
- }
+ }));
}
+
+
}
}