Browse Source

优化部分代码,尝试修复热键回调多次bug

Demo_Liu 4 years ago
parent
commit
cdbdae09c7

+ 17 - 0
Constant/UpdateType.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+/// <summary>
+/// 更新源
+/// </summary>
+namespace GeekDesk.Constant
+{
+    public enum UpdateType
+    {
+        Gitee = 1,
+        GitHub = 2
+    }
+}

+ 9 - 9
Control/Other/BacklogNotificatin.xaml.cs

@@ -24,7 +24,7 @@ namespace GeekDesk.Control.Other
     {
 
         private AppData appData = MainWindow.appData;
-        public BacklogNotificatin(BacklogInfo info)
+        public BacklogNotificatin(ToDoInfo info)
         {
             InitializeComponent();
             this.DataContext = info;
@@ -32,12 +32,12 @@ namespace GeekDesk.Control.Other
 
         private void BacklogDone_Click(object sender, RoutedEventArgs e)
         {
-            BacklogInfo info = this.DataContext as BacklogInfo;
+            ToDoInfo info = this.DataContext as ToDoInfo;
             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);//激活任务删除
+            appData.ToDoList.Remove(info); //执行任务删除
+            appData.HiToDoList.Add(info);  //添加历史任务
+            ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
+            ToDoTask.activityBacklog.Remove(info);//激活任务删除
             CommonCode.SaveAppData(appData);
         }
 
@@ -86,7 +86,7 @@ namespace GeekDesk.Control.Other
         /// <param name="e"></param>
         private void DelayButton_Click(object sender, RoutedEventArgs e)
         {
-            BacklogInfo info = this.DataContext as BacklogInfo;
+            ToDoInfo info = this.DataContext as ToDoInfo;
             int time = int.Parse(DelayTime.Text);
             string type = DelayType.Text;
             switch(type)
@@ -98,8 +98,8 @@ namespace GeekDesk.Control.Other
                     info.ExeTime = DateTime.Now.AddHours(time).ToString("yyyy-MM-dd HH:mm:ss");
                     break;
             }
-            BacklogTask.activityBacklog[info].Close(); //关闭桌面通知
-            BacklogTask.activityBacklog.Remove(info);//激活任务删除
+            ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
+            ToDoTask.activityBacklog.Remove(info);//激活任务删除
         }
     }
 }

+ 4 - 3
Control/UserControls/Config/AboutControl.xaml

@@ -3,6 +3,7 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:cvt="clr-namespace:GeekDesk.Converts"
              xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
              xmlns:hc="https://handyorg.github.io/handycontrol"
              mc:Ignorable="d" 
@@ -10,7 +11,7 @@
              d:DesignHeight="400" d:DesignWidth="500">
 
     <UserControl.Resources>
-        
+        <cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
     </UserControl.Resources>
     <hc:SimplePanel Margin="20,50,20,20">
         <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
@@ -66,10 +67,10 @@
                 <TextBlock Text="更新源:" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                 <RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" 
                          Style="{StaticResource RadioButtonIcon}" Content="Gitee"
-                         IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
+                         IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=1}"/>
                 <RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
                          Style="{StaticResource RadioButtonIcon}" Content="GitHub" 
-                         IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=2}"/>
+                         IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
             </hc:UniformSpacingPanel>
         </StackPanel>
     </hc:SimplePanel>

+ 16 - 1
Control/UserControls/Config/MotionControl.xaml

@@ -54,8 +54,9 @@
             <TextBlock Text="热键设置" VerticalAlignment="Center" Margin="-26,0,26,0"/>
         </hc:UniformSpacingPanel>
         <hc:UniformSpacingPanel Spacing="10" Margin="30,193,0,-180.337" Grid.ColumnSpan="4">
-            <TextBlock Text="当前热键:"/>
+            <TextBlock Text="主面板:" Width="55"/>
             <hc:TextBox HorizontalAlignment="Left" 
+                        Tag="Main"
                         VerticalAlignment="Top" 
                         IsReadOnly="True" 
                         IsReadOnlyCaretVisible="True" 
@@ -65,6 +66,20 @@
                         KeyUp="HotKeyUp"
                         Margin="12.967,-7.38,-12.967,0"/>
         </hc:UniformSpacingPanel>
+        <hc:UniformSpacingPanel Spacing="10" Margin="30,229,0,-216.337" Grid.ColumnSpan="4">
+            <TextBlock Text="新建待办:"  Width="55"/>
+            <hc:TextBox HorizontalAlignment="Left" 
+                        Tag="ToDo"
+                        VerticalAlignment="Top" 
+                        IsReadOnly="True" 
+                        IsReadOnlyCaretVisible="True" 
+                        Width="200"
+                        Text="{Binding ToDoHotkeyStr}" 
+                        KeyDown="HotKeyDown"
+                        KeyUp="HotKeyUp"
+                        Margin="12.967,-7.38,-12.967,0"/>
+        </hc:UniformSpacingPanel>
+        <StackPanel hc:Growl.GrowlParent="True" hc:Growl.Token="HotKeyGrowl" VerticalAlignment="Top"/>
     </hc:SimplePanel>
    
 </UserControl>

+ 72 - 14
Control/UserControls/Config/MotionControl.xaml.cs

@@ -46,23 +46,48 @@ namespace GeekDesk.Control.UserControls.Config
         /// <param name="e"></param>
         private void HotKeyDown(object sender, KeyEventArgs e)
         {
+            string tag = (sender as TextBox).Tag.ToString();
+
+            bool main = false;
+            if ("Main".Equals(tag))
+            {
+                main = true;
+            }
+
             if (!e.IsRepeat)
             {
                 if (hotkeyFinished)
                 {
-                    appConfig.Hotkey = 0;
-                    appConfig.HotkeyStr = "";
-                    appConfig.HotkeyModifiers = 0;
+                    if (main)
+                    {
+                        appConfig.Hotkey = 0;
+                        appConfig.HotkeyStr = "";
+                        appConfig.HotkeyModifiers = 0;
+                    } else
+                    {
+                        appConfig.ToDoHotkey = 0;
+                        appConfig.ToDoHotkeyStr = "";
+                        appConfig.ToDoHotkeyModifiers = 0;
+                    }
                     hotkeyFinished = false;
+
                 }
                 //首次按下按键
-                if (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0)
+                if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0)) 
+                    || (!main && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0)))
                 {
                     if (CheckModifierKeys(e))
                     {
                         //辅助键
-                        appConfig.HotkeyStr = GetKeyName(e);
-                        appConfig.HotkeyModifiers = GetModifierKeys(e);
+                        if (main)
+                        {
+                            appConfig.HotkeyStr = GetKeyName(e);
+                            appConfig.HotkeyModifiers = GetModifierKeys(e);
+                        } else
+                        {
+                            appConfig.ToDoHotkeyStr = GetKeyName(e);
+                            appConfig.ToDoHotkeyModifiers = GetModifierKeys(e);
+                        }
                         prevKeyTemp = e;
                         keysTemp.Add(e);
                     }
@@ -75,15 +100,30 @@ namespace GeekDesk.Control.UserControls.Config
                         || (e.Key >= Key.F1 && e.Key <= Key.F12)
                         || (e.Key >= Key.D0 && e.Key <= Key.D9)))
                     {
-                        appConfig.Hotkey = e.Key;
-                        appConfig.HotkeyStr += e.Key.ToString();
+                        if (main)
+                        {
+                            appConfig.Hotkey = e.Key;
+                            appConfig.HotkeyStr += e.Key.ToString();
+                        } else
+                        {
+                            appConfig.ToDoHotkey = e.Key;
+                            appConfig.ToDoHotkeyStr += e.Key.ToString();
+                        }
                         prevKeyTemp = e;
                         keysTemp.Add(e);
                     }
                     else if (CheckModifierKeys(e))
                     {
-                        appConfig.HotkeyStr += GetKeyName(e);
-                        appConfig.HotkeyModifiers |= GetModifierKeys(e);
+                        if (main)
+                        {
+                            appConfig.HotkeyStr += GetKeyName(e);
+                            appConfig.HotkeyModifiers |= GetModifierKeys(e);
+                        } else
+                        {
+                            appConfig.ToDoHotkeyStr += GetKeyName(e);
+                            appConfig.ToDoHotkeyModifiers |= GetModifierKeys(e);
+                        }
+                        
                         prevKeyTemp = e;
                         keysTemp.Add(e);
                     }
@@ -146,13 +186,18 @@ namespace GeekDesk.Control.UserControls.Config
         [MethodImpl(MethodImplOptions.Synchronized)]
         private  void HotKeyUp(object sender, KeyEventArgs e)
         {
+            string tag = (sender as TextBox).Tag.ToString();
+            bool main = false;
+            if ("Main".Equals(tag))
+            {
+                main = true;
+            }
             lock(this)
             {
                 bool allKeyUp = true;
                 //判断所有键是否都松开
                 foreach (KeyEventArgs key in keysTemp)
                 {
-                    HandyControl.Controls.Growl.SuccessGlobal(key.Key.ToString() + "=" + key.KeyStates);
                     if (key.KeyStates == KeyStates.Down)
                     {
                         allKeyUp = false;
@@ -163,11 +208,24 @@ namespace GeekDesk.Control.UserControls.Config
                 {
                     keysTemp.Clear();
                     hotkeyFinished = true;
-                    if (MainWindow.hotKeyId != -1)
+
+                    if (main)
+                    {
+                        if (MainWindow.hotKeyId != -1)
+                        {
+                            Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
+                        }
+                        MainWindow.RegisterHotKey(false);
+                    } else
                     {
-                        Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
+                        if (MainWindow.toDoHotKeyId != -1)
+                        {
+                            Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
+                        }
+                        MainWindow.RegisterCreateToDoHotKey(false);
                     }
-                    MainWindow.RegisterHotKey();
+
+                    
                 }
             }
         }

+ 1 - 1
Control/UserControls/Backlog/BacklogControl.xaml → Control/UserControls/ToDo/TodoControl.xaml

@@ -1,4 +1,4 @@
-<UserControl x:Class="GeekDesk.Control.UserControls.Backlog.BacklogControl"
+<UserControl x:Class="GeekDesk.Control.UserControls.Backlog.TodoControl"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 

+ 6 - 6
Control/UserControls/Backlog/BacklogControl.xaml.cs → Control/UserControls/ToDo/TodoControl.xaml.cs

@@ -22,22 +22,22 @@ namespace GeekDesk.Control.UserControls.Backlog
     /// <summary>
     /// BacklogControl.xaml 的交互逻辑
     /// </summary>
-    public partial class BacklogControl : UserControl
+    public partial class TodoControl : UserControl
     {
         private AppData appData = MainWindow.appData;
-        public BacklogControl()
+        public TodoControl()
         {
             InitializeComponent();
         }
 
         private void DeleteMenu_Click(object sender, RoutedEventArgs e)
         {
-            BacklogInfo info = BacklogList.SelectedItem as BacklogInfo;
+            ToDoInfo info = BacklogList.SelectedItem as ToDoInfo;
             Growl.Ask("确认删除吗?", isConfirmed =>
             {
                 if (isConfirmed)
                 {
-                    appData.ExeBacklogList.Remove(info);
+                    appData.ToDoList.Remove(info);
                     CommonCode.SaveAppData(MainWindow.appData);
                 }
                 return true;
@@ -46,8 +46,8 @@ namespace GeekDesk.Control.UserControls.Backlog
 
         private void DetailMenu_Click(object sender, RoutedEventArgs e)
         {
-            BacklogInfo info = BacklogList.SelectedItem as BacklogInfo;
-            BacklogInfoWindow.ShowDetail(info);
+            ToDoInfo info = BacklogList.SelectedItem as ToDoInfo;
+            ToDoInfoWindow.ShowDetail(info);
         }
 
         /// <summary>

+ 1 - 1
Control/Windows/BacklogInfoWindow.xaml → Control/Windows/ToDoInfoWindow.xaml

@@ -1,4 +1,4 @@
-<Window x:Class="GeekDesk.Control.Windows.BacklogInfoWindow"
+<Window x:Class="GeekDesk.Control.Windows.ToDoInfoWindow"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

+ 29 - 17
Control/Windows/BacklogInfoWindow.xaml.cs → Control/Windows/ToDoInfoWindow.xaml.cs

@@ -20,24 +20,24 @@ namespace GeekDesk.Control.Windows
     /// <summary>
     /// BacklogInfoWindow.xaml 的交互逻辑
     /// </summary>
-    public partial class BacklogInfoWindow
+    public partial class ToDoInfoWindow
     {
 
         private static int windowType = -1;
-        private static readonly int NEW_BACKLOG = 1;
-        private static readonly int DETAIL_BACKLOG = 2;
+        private static readonly int NEW_TODO = 1;
+        private static readonly int DETAIL_TODO = 2;
 
         private AppData appData = MainWindow.appData;
 
-        private BacklogInfo info;
+        private ToDoInfo info;
 
-        private BacklogInfoWindow()
+        private ToDoInfoWindow()
         {
             InitializeComponent();
             ExeTime.SelectedDateTime = DateTime.Now.AddMinutes(10);
             this.Topmost = true;
         }
-        private BacklogInfoWindow(BacklogInfo info)
+        private ToDoInfoWindow(ToDoInfo info)
         {
             InitializeComponent();
             this.Topmost = true;
@@ -96,24 +96,24 @@ namespace GeekDesk.Control.Windows
                     return;
                 }
             }
-            if (windowType == NEW_BACKLOG)
+            if (windowType == NEW_TODO)
             {
-                info = new BacklogInfo
+                info = new ToDoInfo
                 {
                     Title = Title.Text,
                     Msg = Msg.Text,
                     ExeTime = ExeTime.Text
                 };
-                appData.ExeBacklogList.Add(info);
+                appData.ToDoList.Add(info);
             } else
             {
-                int index =appData.ExeBacklogList.IndexOf(info);
-                appData.ExeBacklogList.Remove(info);
+                int index =appData.ToDoList.IndexOf(info);
+                appData.ToDoList.Remove(info);
                 info.Title = Title.Text;
                 info.Msg = Msg.Text;
                 info.ExeTime = ExeTime.Text;
                 info.DoneTime = DoneTime.Text;
-                appData.ExeBacklogList.Insert(index, info);
+                appData.ToDoList.Insert(index, info);
             }
             CommonCode.SaveAppData(MainWindow.appData);
             this.Close();
@@ -124,21 +124,33 @@ namespace GeekDesk.Control.Windows
         {
             if (window == null || !window.Activate())
             {
-                window = new BacklogInfoWindow();
+                window = new ToDoInfoWindow();
                 
             }
-            windowType = NEW_BACKLOG;
+            windowType = NEW_TODO;
             window.Show();
         }
 
+
+        public static System.Windows.Window GetThis()
+        {
+            if (window == null || !window.Activate())
+            {
+                window = new ToDoInfoWindow();
+
+            }
+            windowType = NEW_TODO;
+            return window;
+        }
+
         private static System.Windows.Window window2 = null;
-        public static void ShowDetail(BacklogInfo info)
+        public static void ShowDetail(ToDoInfo info)
         {
             if (window2 == null || !window2.Activate())
             {
-                window2 = new BacklogInfoWindow(info);
+                window2 = new ToDoInfoWindow(info);
             }
-            windowType = DETAIL_BACKLOG;
+            windowType = DETAIL_TODO;
             window2.Show();
         }
     }

+ 1 - 1
Control/Windows/BacklogWindow.xaml → Control/Windows/ToDoWindow.xaml

@@ -1,4 +1,4 @@
-<Window x:Class="GeekDesk.Control.Windows.BacklogWindow"
+<Window x:Class="GeekDesk.Control.Windows.ToDoWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

+ 8 - 8
Control/Windows/BacklogWindow.xaml.cs → Control/Windows/ToDoWindow.xaml.cs

@@ -21,15 +21,15 @@ namespace GeekDesk.Control.Windows
     /// <summary>
     /// BacklogWindow.xaml 的交互逻辑
     /// </summary>
-    public partial class BacklogWindow
+    public partial class ToDoWindow
     {
-        private static BacklogControl backlog = new BacklogControl();
+        private static TodoControl backlog = new TodoControl();
         private AppData appData = MainWindow.appData;
-        private BacklogWindow()
+        private ToDoWindow()
         {
             InitializeComponent();
             RightCard.Content = backlog;
-            backlog.BacklogList.ItemsSource = appData.ExeBacklogList;
+            backlog.BacklogList.ItemsSource = appData.ToDoList;
             this.Topmost = true;
         }
 
@@ -63,10 +63,10 @@ namespace GeekDesk.Control.Windows
             switch (smi.Tag.ToString())
             {
                 case "History":
-                    backlog.BacklogList.ItemsSource = appData.HiBacklogList;
+                    backlog.BacklogList.ItemsSource = appData.HiToDoList;
                     break;
                 default:
-                    backlog.BacklogList.ItemsSource = appData.ExeBacklogList;
+                    backlog.BacklogList.ItemsSource = appData.ToDoList;
                     break;
             }
         }
@@ -78,7 +78,7 @@ namespace GeekDesk.Control.Windows
         /// <param name="e"></param>
         private void CreateBacklog_BtnClick(object sender, RoutedEventArgs e)
         {
-            BacklogInfoWindow.ShowNone();
+            ToDoInfoWindow.ShowNone();
         }
 
 
@@ -87,7 +87,7 @@ namespace GeekDesk.Control.Windows
         {
             if (window == null || !window.Activate())
             {
-                window = new BacklogWindow();
+                window = new ToDoWindow();
             }
             window.Show();
         }

+ 29 - 0
Converts/UpdateTypeConvert.cs

@@ -0,0 +1,29 @@
+using GeekDesk.Constant;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace GeekDesk.Converts
+{
+    class UpdateTypeConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            return (UpdateType)value == (UpdateType)int.Parse(parameter.ToString());
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            bool isChecked = (bool)value;
+            if (!isChecked)
+            {
+                return null;
+            }
+            return (UpdateType)int.Parse(parameter.ToString());
+        }
+    }
+}

+ 13 - 11
GeekDesk.csproj

@@ -117,23 +117,24 @@
     <Compile Include="Constant\MainWindowEnum.cs" />
     <Compile Include="Constant\IconStartType.cs" />
     <Compile Include="Constant\SortType.cs" />
+    <Compile Include="Constant\UpdateType.cs" />
     <Compile Include="Control\Other\BacklogNotificatin.xaml.cs">
       <DependentUpon>BacklogNotificatin.xaml</DependentUpon>
     </Compile>
     <Compile Include="Control\Other\CustomIconUrlDialog.xaml.cs">
       <DependentUpon>CustomIconUrlDialog.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Control\UserControls\Backlog\BacklogControl.xaml.cs">
-      <DependentUpon>BacklogControl.xaml</DependentUpon>
+    <Compile Include="Control\UserControls\ToDo\TodoControl.xaml.cs">
+      <DependentUpon>TodoControl.xaml</DependentUpon>
     </Compile>
     <Compile Include="Control\UserControls\IconFont\IconPannel.xaml.cs">
       <DependentUpon>IconPannel.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Control\Windows\BacklogInfoWindow.xaml.cs">
-      <DependentUpon>BacklogInfoWindow.xaml</DependentUpon>
+    <Compile Include="Control\Windows\ToDoInfoWindow.xaml.cs">
+      <DependentUpon>ToDoInfoWindow.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Control\Windows\BacklogWindow.xaml.cs">
-      <DependentUpon>BacklogWindow.xaml</DependentUpon>
+    <Compile Include="Control\Windows\ToDoWindow.xaml.cs">
+      <DependentUpon>ToDoWindow.xaml</DependentUpon>
     </Compile>
     <Compile Include="Control\Windows\ConfigWindow.xaml.cs">
       <DependentUpon>ConfigWindow.xaml</DependentUpon>
@@ -165,10 +166,11 @@
     <Compile Include="Converts\DoubleToGridLength.cs" />
     <Compile Include="Converts\IntToCornerRadius.cs" />
     <Compile Include="Converts\OpcityConvert.cs" />
+    <Compile Include="Converts\UpdateTypeConvert.cs" />
     <Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
     <Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
     <Compile Include="Converts\HideTypeConvert.cs" />
-    <Compile Include="Task\BacklogTask.cs" />
+    <Compile Include="Task\ToDoTask.cs" />
     <Compile Include="Thread\UpdateThread.cs" />
     <Compile Include="Util\AeroGlassHelper.cs" />
     <Compile Include="Util\CommonCode.cs" />
@@ -188,7 +190,7 @@
     <Compile Include="Util\SystemIcon.cs" />
     <Compile Include="ViewModel\AppConfig.cs" />
     <Compile Include="ViewModel\AppData.cs" />
-    <Compile Include="ViewModel\BacklogInfo.cs" />
+    <Compile Include="ViewModel\ToDoInfo.cs" />
     <Compile Include="ViewModel\IconfontInfo.cs" />
     <Compile Include="ViewModel\IconInfo.cs" />
     <Compile Include="ViewModel\MenuInfo.cs" />
@@ -200,7 +202,7 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="Control\UserControls\Backlog\BacklogControl.xaml">
+    <Page Include="Control\UserControls\ToDo\TodoControl.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
@@ -208,11 +210,11 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Control\Windows\BacklogInfoWindow.xaml">
+    <Page Include="Control\Windows\ToDoInfoWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Control\Windows\BacklogWindow.xaml">
+    <Page Include="Control\Windows\ToDoWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>

+ 69 - 17
MainWindow.xaml.cs

@@ -30,7 +30,9 @@ namespace GeekDesk
     {
 
         public static AppData appData = CommonCode.GetAppDataByFile();
+        public static ToDoInfoWindow toDoInfoWindow = (ToDoInfoWindow)ToDoInfoWindow.GetThis();
         public static int hotKeyId = -1;
+        public static int toDoHotKeyId = -1;
         public static MainWindow mainWindow;
         public HotKeyManager hkm = new HotKeyManager();
         public MainWindow()
@@ -41,7 +43,7 @@ namespace GeekDesk
             this.Topmost = true;
             this.Loaded += Window_Loaded;
             this.SizeChanged += MainWindow_Resize;
-            BacklogTask.BackLogCheck();
+            ToDoTask.BackLogCheck();
         }
 
         private void LoadData()
@@ -54,6 +56,7 @@ namespace GeekDesk
 
             this.Width = appData.AppConfig.WindowWidth;
             this.Height = appData.AppConfig.WindowHeight;
+            
         }
 
         void Window_Loaded(object sender, RoutedEventArgs e)
@@ -65,39 +68,88 @@ namespace GeekDesk
             {
                 ShowApp();
             }
-           
-
+            RegisterHotKey(true);
+            RegisterCreateToDoHotKey(true);
         }
 
         /// <summary>
         /// 注册当前窗口的热键
         /// </summary>
-        public static void RegisterHotKey()
+        public static void RegisterHotKey(bool first)
         {
             try
             {
-                //加载完毕注册热键
-                hotKeyId = Hotkey.Regist(new WindowInteropHelper(MainWindow.mainWindow).Handle, appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
+                if (appData.AppConfig.HotkeyModifiers != 0)
                 {
-                    if (MotionControl.hotkeyFinished)
+                    //加载完毕注册热键
+                    hotKeyId = Hotkey.Regist(new WindowInteropHelper(MainWindow.mainWindow).Handle, appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
                     {
-                        if (mainWindow.Visibility == Visibility.Collapsed)
+                        if (MotionControl.hotkeyFinished)
                         {
-                            ShowApp();
+                            if (mainWindow.Visibility == Visibility.Collapsed)
+                            {
+                                ShowApp();
+                            }
+                            else
+                            {
+                                mainWindow.Visibility = Visibility.Collapsed;
+                            }
                         }
-                        else
+                    });
+                }
+                if (!first)
+                {
+                    HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl");
+                }
+            }
+            catch (Exception)
+            {
+                if (first)
+                {
+                    HandyControl.Controls.Growl.WarningGlobal("GeekDesk启动快捷键已被其它程序占用(" + appData.AppConfig.HotkeyStr + ")!");
+                }
+                else
+                {
+                    HandyControl.Controls.Growl.Warning("GeekDesk启动快捷键已被其它程序占用(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl");
+
+                }
+            }
+        }
+
+        /// <summary>
+        /// 注册新建待办的热键
+        /// </summary>
+        public static void RegisterCreateToDoHotKey(bool first)
+        {
+            try
+            {
+                if (appData.AppConfig.ToDoHotkeyModifiers!=0)
+                {
+                    //加载完毕注册热键
+                    toDoHotKeyId = Hotkey.Regist(new WindowInteropHelper(toDoInfoWindow).Handle, appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
+                    {
+                        if (MotionControl.hotkeyFinished)
                         {
-                            mainWindow.Visibility = Visibility.Collapsed;
+                            ToDoInfoWindow.ShowNone();
                         }
-                    }
-                });
-                //HandyControl.Controls.Growl.SuccessGlobal("快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!");
+                    });
+                }
+                if (!first)
+                {
+                    HandyControl.Controls.Growl.Success("新建待办任务快捷键注册成功(" + appData.AppConfig.ToDoHotkeyStr + ")!", "HotKeyGrowl");
+                }
             }
             catch (Exception)
             {
-                HandyControl.Controls.Growl.WarningGlobal("GeekDesk启动快捷键已被其它程序占用(" + appData.AppConfig.HotkeyStr + ")!");
+                if (first)
+                {
+                    HandyControl.Controls.Growl.WarningGlobal("新建待办任务快捷键已被其它程序占用(" + appData.AppConfig.ToDoHotkeyStr + ")!");
+                }
+                else
+                {
+                    HandyControl.Controls.Growl.Warning("新建待办任务快捷键已被其它程序占用(" + appData.AppConfig.ToDoHotkeyStr + ")!", "HotKeyGrowl");
+                }
             }
-            
         }
 
         private void DisplayWindowHotKeyPress(object sender, KeyPressedEventArgs e)
@@ -336,7 +388,7 @@ namespace GeekDesk
         /// <param name="e"></param>
         private void BacklogMenuClick(object sender, RoutedEventArgs e)
         {
-            BacklogWindow.Show();
+            ToDoWindow.Show();
         }
         /// <summary>
         /// 禁用设置按钮右键菜单

+ 6 - 6
Task/BacklogTask.cs → Task/ToDoTask.cs

@@ -14,12 +14,12 @@ using System.Timers;
 
 namespace GeekDesk.Task
 {
-    public class BacklogTask
+    public class ToDoTask
     {
 
-        ///public static ObservableCollection<BacklogInfo> activityBacklog = new ObservableCollection<BacklogInfo>();
+        ///public static ObservableCollection<ToDoInfo> activityBacklog = new ObservableCollection<ToDoInfo>();
 
-        public static Dictionary<BacklogInfo, Notification> activityBacklog = new Dictionary<BacklogInfo, Notification>();
+        public static Dictionary<ToDoInfo, Notification> activityBacklog = new Dictionary<ToDoInfo, Notification>();
 
         public static void BackLogCheck()
         {
@@ -36,11 +36,11 @@ namespace GeekDesk.Task
         {
             App.Current.Dispatcher.Invoke((Action)(() =>
             {
-                if (MainWindow.appData.ExeBacklogList.Count > 0)
+                if (MainWindow.appData.ToDoList.Count > 0)
                 {
                     string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
-                    ObservableCollection<BacklogInfo> exeBacklogList = MainWindow.appData.ExeBacklogList;
-                    foreach (BacklogInfo info in exeBacklogList)
+                    ObservableCollection<ToDoInfo> exeBacklogList = MainWindow.appData.ToDoList;
+                    foreach (ToDoInfo info in exeBacklogList)
                     {
                         if (info.ExeTime.CompareTo(nowTime) == -1 && !activityBacklog.ContainsKey(info))
                         {

+ 61 - 0
ViewModel/AppConfig.cs

@@ -37,18 +37,79 @@ namespace GeekDesk.ViewModel
         private int pannelCornerRadius = 4;  //面板圆角 默认4
         [field: NonSerialized]
         private ObservableCollection<IconInfo> selectedMenuIcons;
+
         private string hotkeyStr = "Ctrl + Q";  //默认启动面板快捷键
         private HotkeyModifiers hotkeyModifiers = HotkeyModifiers.MOD_CONTROL; //默认启动面板快捷键
         private Key hotkey = Key.Q; //默认启动面板快捷键
 
+        private string toDoHotkeyStr;  //待办任务快捷键
+        private HotkeyModifiers toDoHotkeyModifiers; //待办任务快捷键
+        private Key toDoHotkey; //待办任务快捷键
+
         private string customIconUrl; //自定义图标url
         private string customIconJsonUrl;  //自定义图标json信息url
 
         private bool blurEffect = false; //毛玻璃效果 默认否
         private double blurValue;
 
+        private UpdateType updateType = UpdateType.Gitee; //更新源 默认gitee源
+
         #region GetSet
 
+
+        public Key ToDoHotkey
+        {
+            get
+            {
+                return toDoHotkey;
+            }
+            set
+            {
+                toDoHotkey = value;
+                OnPropertyChanged("ToDoHotkey");
+            }
+        }
+
+
+        public HotkeyModifiers ToDoHotkeyModifiers
+        {
+            get
+            {
+                return toDoHotkeyModifiers;
+            }
+            set
+            {
+                toDoHotkeyModifiers = value;
+                OnPropertyChanged("ToDoHotkeyModifiers");
+            }
+        }
+
+        public string ToDoHotkeyStr
+        {
+            get
+            {
+                return toDoHotkeyStr;
+            }
+            set
+            {
+                toDoHotkeyStr = value;
+                OnPropertyChanged("ToDoHotkeyStr");
+            }
+        }
+
+        public UpdateType UpdateType
+        {
+            get
+            {
+                return updateType;
+            }
+            set
+            {
+                updateType = value;
+                OnPropertyChanged("UpdateType");
+            }
+        }
+
         public double BlurValue
         {
             get

+ 14 - 14
ViewModel/AppData.cs

@@ -14,42 +14,42 @@ namespace GeekDesk.ViewModel
     {
         private ObservableCollection<MenuInfo> menuList; //菜单信息及菜单对应icon信息
         private AppConfig appConfig = new AppConfig(); //程序设置信息
-        private ObservableCollection<BacklogInfo> hiBacklogList; //历史待办
-        private ObservableCollection<BacklogInfo> exeBacklogList; //未处理待办 为了提高任务效率 分开处理
+        private ObservableCollection<ToDoInfo> hiToDoList; //历史待办
+        private ObservableCollection<ToDoInfo> toDoList; //未处理待办 为了提高任务效率 分开处理
 
 
-        public ObservableCollection<BacklogInfo> HiBacklogList
+        public ObservableCollection<ToDoInfo> HiToDoList
         {
             get
             {
-                if (hiBacklogList == null)
+                if (hiToDoList == null)
                 {
-                    hiBacklogList = new ObservableCollection<BacklogInfo>();
+                    hiToDoList = new ObservableCollection<ToDoInfo>();
 
                 }
-                return hiBacklogList;
+                return hiToDoList;
             }
             set
             {
-                hiBacklogList = value;
-                OnPropertyChanged("HiBacklogList");
+                hiToDoList = value;
+                OnPropertyChanged("HiToDoList");
             }
         }
 
-        public ObservableCollection<BacklogInfo> ExeBacklogList
+        public ObservableCollection<ToDoInfo> ToDoList
         {
             get
             {
-                if (exeBacklogList == null)
+                if (toDoList == null)
                 {
-                    exeBacklogList = new ObservableCollection<BacklogInfo>();
+                    toDoList = new ObservableCollection<ToDoInfo>();
                 }
-                return exeBacklogList;
+                return toDoList;
             }
             set
             {
-                exeBacklogList = value;
-                OnPropertyChanged("ExeBacklogList");
+                toDoList = value;
+                OnPropertyChanged("ToDoList");
             }
         }
 

+ 1 - 1
ViewModel/BacklogInfo.cs → ViewModel/ToDoInfo.cs

@@ -10,7 +10,7 @@ namespace GeekDesk.ViewModel
 {
 
     [Serializable]
-    public class BacklogInfo : INotifyPropertyChanged
+    public class ToDoInfo : INotifyPropertyChanged
     {
         //private string id;   //任务唯一id
         private string title; //待办事项