Merge pull request #2 from Demo-Liu/1.0-beta

1.0 beta
This commit is contained in:
Demo-Liu
2021-07-19 17:31:12 +08:00
committed by GitHub
35 changed files with 652 additions and 252 deletions

View File

@@ -11,4 +11,11 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<appSettings>
<add key="version" value="1.0 beta"/>
<add key="GitHubUrl" value="1.0 beta"/>
<add key="MYUrl" value="1.0 beta"/>
<add key="GitHubUpdateUrl" value="1.0 beta"/>
<add key="MYUpdateUrl" value="1.0 beta"/>
</appSettings>
</configuration>

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@
/// </summary>
namespace GeekDesk.Constant
{
public enum DefaultConstant
public enum MainWindowEnum
{
WINDOW_WIDTH = 666, //默认窗体宽度
WINDOW_HEIGHT = 500, //默认窗体高度

17
Constant/UpdateType.cs Normal file
View File

@@ -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
}
}

View File

@@ -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);//激活任务删除
}
}
}

View File

@@ -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,26 +11,68 @@
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">
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
<TextBlock TextAlignment="Center" Text="Copyright © 2021 GeekDesk 1.0 beta"/>
<WrapPanel Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk "/>
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
<hc:Shield Subject="公众号" Status="抓几个娃" Color="#04913B">
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
<hc:Shield Subject="GitHub" Status="Demo-liu"
Command="hc:ControlCommands.OpenLink"
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
Margin="0,0,10,0" Color="#24292F"/>
<hc:Shield Subject="码云" Status="Demo-liu"
Command="hc:ControlCommands.OpenLink"
CommandParameter=""
Margin="0,5,10,0" Color="#C71D23"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" HorizontalAlignment="Center" Margin="0,5,0,0">
<hc:Shield Subject="公众号" Status="抓几个娃" Margin="0,0,5,0" Color="#04913B">
<hc:Poptip.Instance>
<hc:Poptip PlacementType="Top">
<hc:Poptip.Content>
<Image Source="/Resource/Image/公众号.jpg" Width="150" Height="150" />
<Image x:Name="PublicWeChat" Width="150" Height="150" />
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</hc:Shield>
</WrapPanel>
<hc:Shield Subject="赞赏" Status="支付宝" Margin="0,0,10,0" Color="#1577FE">
<hc:Poptip.Instance>
<hc:Poptip PlacementType="Top">
<hc:Poptip.Content>
<Image x:Name="ZFBCode" Width="150" Height="150" />
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</hc:Shield>
<hc:Shield Subject="赞赏" Status="微信" Margin="0,0,10,0" Color="#04913B">
<hc:Poptip.Instance>
<hc:Poptip PlacementType="Top">
<hc:Poptip.Content>
<Image x:Name="WeChatCode" Width="150" Height="150" />
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</hc:Shield>
</hc:UniformSpacingPanel>
<TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center" Text="这是个人开发的程序,所有人可任意修改和免费使用(商用请联系作者)" TextWrapping="Wrap"/>
<hc:UniformSpacingPanel Spacing="10" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
<TextBlock Text="更新源:" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
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 UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
</StackPanel>
</hc:SimplePanel>
</UserControl>

View File

@@ -1,4 +1,5 @@
using System;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -12,6 +13,8 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GeekDesk.Util;
using GeekDesk.Constant;
namespace GeekDesk.Control.UserControls.Config
{
@@ -23,6 +26,10 @@ namespace GeekDesk.Control.UserControls.Config
public AboutControl()
{
InitializeComponent();
AppInfo.Text += ConfigurationManager.AppSettings["version"];
PublicWeChat.Source = ImageUtil.Base64ToBitmapImage(Constants.PUBLIC_WE_CHAT_IMG_BASE64);
WeChatCode.Source = ImageUtil.Base64ToBitmapImage(Constants.WE_CHAT_CODE_IMG_BASE64);
ZFBCode.Source = ImageUtil.Base64ToBitmapImage(Constants.ZFB_CODE_IMG_BASE64);
}
}
}

View File

@@ -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>

View File

@@ -7,6 +7,7 @@ using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -27,8 +28,9 @@ namespace GeekDesk.Control.UserControls.Config
/// </summary>
public partial class MotionControl : UserControl
{
private static bool hotkeyFinished = true; //热键设置结束
public static bool hotkeyFinished = true; //热键设置结束
private static KeyEventArgs prevKeyTemp; //上一个按键
private static List<KeyEventArgs> keysTemp = new List<KeyEventArgs>();//存储一次快捷键集合
private static AppConfig appConfig = MainWindow.appData.AppConfig;
public MotionControl()
@@ -44,24 +46,50 @@ 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);
}
}
else
@@ -72,15 +100,32 @@ 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);
}
}
}
@@ -138,94 +183,113 @@ namespace GeekDesk.Control.UserControls.Config
}
private void HotKeyUp(object sender, KeyEventArgs e)
[MethodImpl(MethodImplOptions.Synchronized)]
private void HotKeyUp(object sender, KeyEventArgs e)
{
hotkeyFinished = true;
ConfigWindow cw = (ConfigWindow)Window.GetWindow(this);
try
string tag = (sender as TextBox).Tag.ToString();
bool main = false;
if ("Main".Equals(tag))
{
if (cw.mainWindow.hotKeyId != -1)
main = true;
}
lock(this)
{
bool allKeyUp = true;
//判断所有键是否都松开
foreach (KeyEventArgs key in keysTemp)
{
Hotkey.UnRegist(new WindowInteropHelper(cw.mainWindow).Handle, Hotkey.keymap[cw.mainWindow.hotKeyId]);
if (key.KeyStates == KeyStates.Down)
{
allKeyUp = false;
break;
}
}
cw.mainWindow.hotKeyId = Hotkey.Regist(cw.mainWindow, appConfig.HotkeyModifiers, appConfig.Hotkey, () =>
if (allKeyUp && !hotkeyFinished)
{
if (cw.mainWindow.Visibility == Visibility.Collapsed)
keysTemp.Clear();
hotkeyFinished = true;
if (main)
{
cw.mainWindow.ShowApp();
}
else
if (MainWindow.hotKeyId != -1)
{
Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
}
MainWindow.RegisterHotKey(false);
} else
{
cw.mainWindow.Visibility = Visibility.Collapsed;
if (MainWindow.toDoHotKeyId != -1)
{
Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
}
MainWindow.RegisterCreateToDoHotKey(false);
}
});
} catch (Exception)
{
HandyControl.Controls.Growl.WarningGlobal("当前快捷键已被其它程序占用(" + appConfig.HotkeyStr + ")!");
}
}
}
private void ShowApp(MainWindow mainWindow)
{
if (appConfig.FollowMouse)
{
ShowAppAndFollowMouse(mainWindow);
}
else
{
this.Visibility = Visibility.Visible;
}
Keyboard.Focus(this);
}
//private void ShowApp(MainWindow mainWindow)
//{
// if (appConfig.FollowMouse)
// {
// ShowAppAndFollowMouse(mainWindow);
// }
// else
// {
// this.Visibility = Visibility.Visible;
// }
// Keyboard.Focus(this);
//}
/// <summary>
/// 随鼠标位置显示面板 (鼠标始终在中间)
/// </summary>
private void ShowAppAndFollowMouse(MainWindow mainWindow)
{
//获取鼠标位置
System.Windows.Point p = MouseUtil.GetMousePosition();
double left = SystemParameters.VirtualScreenLeft;
double top = SystemParameters.VirtualScreenTop;
double width = SystemParameters.VirtualScreenWidth;
double height = SystemParameters.VirtualScreenHeight;
double right = width - Math.Abs(left);
double bottom = height - Math.Abs(top);
///// <summary>
///// 随鼠标位置显示面板 (鼠标始终在中间)
///// </summary>
//private void ShowAppAndFollowMouse(MainWindow mainWindow)
//{
// //获取鼠标位置
// System.Windows.Point p = MouseUtil.GetMousePosition();
// double left = SystemParameters.VirtualScreenLeft;
// double top = SystemParameters.VirtualScreenTop;
// double width = SystemParameters.VirtualScreenWidth;
// double height = SystemParameters.VirtualScreenHeight;
// double right = width - Math.Abs(left);
// double bottom = height - Math.Abs(top);
if (p.X - mainWindow.Width / 2 < left)
{
//判断是否在最左边缘
mainWindow.Left = left;
}
else if (p.X + mainWindow.Width / 2 > right)
{
//判断是否在最右边缘
mainWindow.Left = right - mainWindow.Width;
}
else
{
mainWindow.Left = p.X - mainWindow.Width / 2;
}
// if (p.X - mainWindow.Width / 2 < left)
// {
// //判断是否在最左边缘
// mainWindow.Left = left;
// }
// else if (p.X + mainWindow.Width / 2 > right)
// {
// //判断是否在最右边缘
// mainWindow.Left = right - mainWindow.Width;
// }
// else
// {
// mainWindow.Left = p.X - mainWindow.Width / 2;
// }
if (p.Y - mainWindow.Height / 2 < top)
{
//判断是否在最上边缘
mainWindow.Top = top;
}
else if (p.Y + mainWindow.Height / 2 > bottom)
{
//判断是否在最下边缘
mainWindow.Top = bottom - mainWindow.Height;
}
else
{
mainWindow.Top = p.Y - mainWindow.Height / 2;
}
// if (p.Y - mainWindow.Height / 2 < top)
// {
// //判断是否在最上边缘
// mainWindow.Top = top;
// }
// else if (p.Y + mainWindow.Height / 2 > bottom)
// {
// //判断是否在最下边缘
// mainWindow.Top = bottom - mainWindow.Height;
// }
// else
// {
// mainWindow.Top = p.Y - mainWindow.Height / 2;
// }
mainWindow.Visibility = Visibility.Visible;
}
// mainWindow.Visibility = Visibility.Visible;
//}
}
}

View File

@@ -20,7 +20,8 @@
<SolidColorBrush Opacity="0"/>
</Setter.Value>
</Setter>
<EventSetter Event="MouseLeftButtonDown" Handler="MenuClick"/>
<EventSetter Event="MouseRightButtonDown" Handler="MenuClick"/>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
@@ -74,12 +75,13 @@
</ContextMenu>
</hc:Card.ContextMenu>
<WrapPanel Orientation="Horizontal">
<ListBox x:Name="menus"
<ListBox x:Name="MenuListBox"
ItemsSource="{Binding MenuList}"
Tag="{Binding AppConfig.MenuCardWidth}"
BorderThickness="0" Foreground="{x:Null}"
SelectedIndex="{Binding AppConfig.SelectedMenuIndex}"
VirtualizingPanel.VirtualizationMode="Recycling"
SelectionChanged="menus_SelectionChanged"
>
<ListBox.Resources>
<ContextMenu x:Key="menuDialog" Width="200">
@@ -108,6 +110,9 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
<StackPanel.Background>
<SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
</StackPanel.Background>
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
HorizontalAlignment="Left"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}}"

View File

@@ -25,7 +25,13 @@ namespace GeekDesk.Control.UserControls.PannelCard
public LeftCardControl()
{
InitializeComponent();
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
if (appData.AppConfig.SelectedMenuIndex >= appData.MenuList.Count || appData.AppConfig.SelectedMenuIndex == -1)
{
appData.AppConfig.SelectedMenuIcons = appData.MenuList[0].IconList;
} else
{
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
}
}
@@ -46,7 +52,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
var dragged = menuList[fromS];
menuList.Remove(dragged);
menuList.Insert(to, dragged);
menus.SelectedIndex = to;
MenuListBox.SelectedIndex = to;
MainWindow.appData.MenuList = menuList;
}
);
@@ -73,14 +79,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
TextBlock tb = sender as TextBlock;
if (tb.Visibility == Visibility.Collapsed)
{
if (menus.SelectedIndex != -1)
if (MenuListBox.SelectedIndex != -1)
{
menuSelectIndexTemp = menus.SelectedIndex;
menus.SelectedIndex = -1;
menuSelectIndexTemp = MenuListBox.SelectedIndex;
MenuListBox.SelectedIndex = -1;
}
else
{
menus.SelectedIndex = menuSelectIndexTemp;
MenuListBox.SelectedIndex = menuSelectIndexTemp;
}
}
}
@@ -94,9 +100,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
MenuInfo info = new MenuInfo() { MenuEdit = Visibility.Collapsed, MenuId = System.Guid.NewGuid().ToString(), MenuName = "NewMenu" };
appData.MenuList.Add(info);
menus.Items.Refresh();
menus.SelectedIndex = appData.MenuList.Count - 1;
appData.AppConfig.SelectedMenuIndex = menus.SelectedIndex;
MenuListBox.Items.Refresh();
MenuListBox.SelectedIndex = appData.MenuList.Count - 1;
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
appData.AppConfig.SelectedMenuIcons = info.IconList;
}
@@ -124,14 +130,20 @@ namespace GeekDesk.Control.UserControls.PannelCard
//如果删除以后没有菜单的话 先创建一个
CreateMenu(null, null);
}
appData.MenuList.Remove(menuInfo);
if (menus.SelectedIndex == -1)
int index = appData.MenuList.IndexOf(menuInfo);
if(index == 0)
{
// 选中下一个菜单
menus.SelectedIndex = 0;
appData.AppConfig.SelectedMenuIndex = menus.SelectedIndex;
appData.AppConfig.SelectedMenuIcons = appData.MenuList[0].IconList;
index = 0;
} else
{
index = index - 1;
}
appData.MenuList.Remove(menuInfo);
// 选中下一个菜单
MenuListBox.SelectedIndex = index;
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
appData.AppConfig.SelectedMenuIcons = appData.MenuList[index].IconList;
}
/// <summary>
@@ -189,5 +201,17 @@ namespace GeekDesk.Control.UserControls.PannelCard
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
IconfontWindow.Show(SvgToGeometry.GetIconfonts(), menuInfo);
}
private void menus_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//设置对应菜单的图标列表
if (MenuListBox.SelectedIndex == -1)
{
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count-1].IconList;
} else
{
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
}
}
}
}

View File

@@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
@@ -172,7 +173,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
string path = (string)obj;
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Jpeg);
string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Jpeg);
IconInfo iconInfo = new IconInfo
{

View File

@@ -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"

View File

@@ -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>

View File

@@ -29,12 +29,12 @@
<Grid MouseDown="DragMove">
<TextBox x:Name="CheckSettingUrl" Visibility="Collapsed" Text="{Binding IsSettingUrl}" TextChanged="CheckSettingUrl_TextChanged"/>
<hc:TabControl x:Name="MyTabControl" IsAnimationEnabled="True" SelectionChanged="TabControl_SelectionChanged" ShowContextMenu="True" IsTabFillEnabled="True" Margin="20,30,20,20" Height="350" VerticalAlignment="Top">
<hc:TabItem Tag="System" IsSelected="True" Header="系统图标" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" >
<hc:TabItem Tag="System" IsSelected="True" Header="系统图标" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource SystemIcon}" >
<hc:SimplePanel Background="AliceBlue">
<uc:IconPannel x:Name="SystemIcon"/>
</hc:SimplePanel>
</hc:TabItem>
<hc:TabItem Tag="Custom" Header="自定义图标" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource CalendarGeometry}">
<hc:TabItem Tag="Custom" Header="自定义图标" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource CustomIcon}">
<hc:SimplePanel Background="AliceBlue">
<uc:IconPannel x:Name="CustomIcon"/>
<hc:LoadingCircle x:Name="LoadingEle"/>

View File

@@ -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"

View File

@@ -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,34 @@ namespace GeekDesk.Control.Windows
{
if (window == null || !window.Activate())
{
window = new BacklogInfoWindow();
window = new ToDoInfoWindow();
window.Show();
}
windowType = NEW_BACKLOG;
window.Show();
windowType = NEW_TODO;
window.Visibility = Visibility.Visible;
}
public static System.Windows.Window GetThis()
{
if (window == null || !window.Activate())
{
window = new ToDoInfoWindow();
window.Show();
}
window.Visibility = Visibility.Collapsed;
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();
}
}

View File

@@ -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"

View File

@@ -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();
}

View File

@@ -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());
}
}
}

View File

@@ -82,6 +82,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=4.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@@ -113,26 +114,27 @@
<Compile Include="Command\DelegateCommandBase.cs" />
<Compile Include="Constant\AppHideType.cs" />
<Compile Include="Constant\Constants.cs" />
<Compile Include="Constant\DefaultConstant.cs" />
<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>
@@ -164,10 +166,12 @@
<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" />
<Compile Include="Util\ConsoleManager.cs" />
@@ -186,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" />
@@ -198,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>
@@ -206,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>
@@ -302,15 +306,9 @@
<ItemGroup>
<Resource Include="Resource\Iconfont\iconfont.js" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\公众号.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\BacklogImg.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\Taskbar.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\TitleLogo.png" />
</ItemGroup>

View File

@@ -109,7 +109,7 @@
<uc:RightCardControl Grid.Row="1" Grid.Column="1"/>
<hc:NotifyIcon Icon="/Resource/Image/Taskbar.png" Text="GeekDesk" Click="NotifyIcon_Click">
<hc:NotifyIcon Icon="/Taskbar.ico" Text="GeekDesk" Click="NotifyIcon_Click">
<hc:NotifyIcon.ContextMenu>
<ContextMenu Width="130">
<MenuItem Header="打开面板" Click="ShowApp"/>

View File

@@ -1,6 +1,7 @@
using DraggAnimatedPanelExample;
using GeekDesk.Constant;
using GeekDesk.Control;
using GeekDesk.Control.UserControls.Config;
using GeekDesk.Control.Windows;
using GeekDesk.Task;
using GeekDesk.Util;
@@ -29,16 +30,21 @@ namespace GeekDesk
{
public static AppData appData = CommonCode.GetAppDataByFile();
public int hotKeyId = -1;
//public static ToDoInfoWindow toDoInfoWindow = (ToDoInfoWindow)ToDoInfoWindow.GetThis();
public static ToDoInfoWindow toDoInfoWindow;
public static int hotKeyId = -1;
public static int toDoHotKeyId = -1;
public static MainWindow mainWindow;
public HotKeyManager hkm = new HotKeyManager();
public MainWindow()
{
LoadData();
InitializeComponent();
mainWindow = this;
this.Topmost = true;
this.Loaded += Window_Loaded;
this.SizeChanged += MainWindow_Resize;
BacklogTask.BackLogCheck();
ToDoTask.BackLogCheck();
}
private void LoadData()
@@ -51,6 +57,7 @@ namespace GeekDesk
this.Width = appData.AppConfig.WindowWidth;
this.Height = appData.AppConfig.WindowHeight;
}
void Window_Loaded(object sender, RoutedEventArgs e)
@@ -58,28 +65,92 @@ namespace GeekDesk
if (!appData.AppConfig.StartedShowPanel)
{
this.Visibility = Visibility.Collapsed;
} else
{
ShowApp();
}
RegisterHotKey(true);
//RegisterCreateToDoHotKey(true);
}
/// <summary>
/// 注册当前窗口的热键
/// </summary>
public static void RegisterHotKey(bool first)
{
try
{
HotKey hk = hkm.Register(Key.Y, ModifierKeys.Control);
hkm.KeyPressed += DisplayWindowHotKeyPress;
////加载完毕注册热键
//hotKeyId = Hotkey.Regist(this, appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
//{
// if (this.Visibility == Visibility.Collapsed)
// {
// ShowApp();
// }
// else
// {
// this.Visibility = Visibility.Collapsed;
// }
//});
} catch (Exception)
{
HandyControl.Controls.Growl.WarningGlobal("启动快捷键已被其它程序占用(" + appData.AppConfig.HotkeyStr + ")!");
if (appData.AppConfig.HotkeyModifiers != 0)
{
//加载完毕注册热键
hotKeyId = Hotkey.Regist(new WindowInteropHelper(MainWindow.mainWindow).Handle, appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
{
if (MotionControl.hotkeyFinished)
{
if (mainWindow.Visibility == Visibility.Collapsed)
{
ShowApp();
}
else
{
mainWindow.Visibility = Visibility.Collapsed;
}
}
});
}
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(MainWindow.mainWindow).Handle, appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
{
if (MotionControl.hotkeyFinished)
{
ToDoInfoWindow.ShowNone();
}
});
}
if (!first)
{
HandyControl.Controls.Growl.Success("新建待办任务快捷键注册成功(" + appData.AppConfig.ToDoHotkeyStr + ")!", "HotKeyGrowl");
}
}
catch (Exception)
{
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)
@@ -180,22 +251,22 @@ namespace GeekDesk
{
ShowApp();
}
public void ShowApp()
public static void ShowApp()
{
if (appData.AppConfig.FollowMouse)
{
ShowAppAndFollowMouse();
} else
{
this.Visibility = Visibility.Visible;
mainWindow.Visibility = Visibility.Visible;
}
Keyboard.Focus(this);
Keyboard.Focus(mainWindow);
}
/// <summary>
/// 随鼠标位置显示面板 (鼠标始终在中间)
/// </summary>
private void ShowAppAndFollowMouse()
private static void ShowAppAndFollowMouse()
{
//获取鼠标位置
System.Windows.Point p = MouseUtil.GetMousePosition();
@@ -207,38 +278,38 @@ namespace GeekDesk
double bottom = height - Math.Abs(top);
if (p.X - this.Width / 2 < left)
if (p.X - mainWindow.Width / 2 < left)
{
//判断是否在最左边缘
this.Left = left;
mainWindow.Left = left;
}
else if (p.X + this.Width / 2 > right)
else if (p.X + mainWindow.Width / 2 > right)
{
//判断是否在最右边缘
this.Left = right - this.Width;
mainWindow.Left = right - mainWindow.Width;
}
else
{
this.Left = p.X - this.Width / 2;
mainWindow.Left = p.X - mainWindow.Width / 2;
}
if (p.Y - this.Height / 2 < top)
if (p.Y - mainWindow.Height / 2 < top)
{
//判断是否在最上边缘
this.Top = top;
mainWindow.Top = top;
}
else if (p.Y + this.Height / 2 > bottom)
else if (p.Y + mainWindow.Height / 2 > bottom)
{
//判断是否在最下边缘
this.Top = bottom - this.Height;
mainWindow.Top = bottom - mainWindow.Height;
}
else
{
this.Top = p.Y - this.Height / 2;
mainWindow.Top = p.Y - mainWindow.Height / 2;
}
this.Visibility = Visibility.Visible;
mainWindow.Visibility = Visibility.Visible;
}
@@ -318,7 +389,7 @@ namespace GeekDesk
/// <param name="e"></param>
private void BacklogMenuClick(object sender, RoutedEventArgs e)
{
BacklogWindow.Show();
ToDoWindow.Show();
}
/// <summary>
/// 禁用设置按钮右键菜单

View File

@@ -24,5 +24,14 @@
M512 64C262.4 64 64 262.4 64 512s198.4 448 448 448 448-198.4 448-448S761.6 64 512 64z m256 544h-256c-19.2 0-32-12.8-32-32V256c0-19.2 12.8-32 32-32s32 12.8 32 32v288h224c19.2 0 32 12.8 32 32s-12.8 32-32 32z
</Geometry>
<Geometry x:Key="SystemIcon">
M768 665.6H256a102.4 102.4 0 0 1-102.4-102.4V256A102.4 102.4 0 0 1 256 153.6h512A102.4 102.4 0 0 1 870.4 256v307.2A102.4 102.4 0 0 1 768 665.6zM409.6 460.8a51.2 51.2 0 0 0-51.2 51.2 51.2 51.2 0 0 0 51.2 51.2h204.8a51.2 51.2 0 0 0 51.2-51.2 51.2 51.2 0 0 0-51.2-51.2zM307.2 768h409.6q51.2 0 51.2 51.2t-51.2 51.2H307.2q-51.2 0-51.2-51.2t51.2-51.2z
M460.8 819.251v-153.6q0-51.2 51.2-51.2t51.2 51.2v153.6q0 51.2-51.2 51.2t-51.2-51.2z
</Geometry>
<Geometry x:Key="CustomIcon">
M760.844227 482.947384l227.272092-215.929406a116.216042 116.216042 0 0 0 0-164.329483l-56.713429-56.713429a116.216042 116.216042 0 0 0-162.144622-2.068645l-221.995883 210.792657-215.673731-230.363439-1.766484-1.836213A75.958805 75.958805 0 0 0 222.392061 22.057805L60.526358 183.923508a75.912319 75.912319 0 0 0-1.30162 105.593896l212.442925 226.946687-200.867807 190.803497a116.216042 116.216042 0 0 0-33.098329 57.73613L3.7432 909.971609a76.888533 76.888533 0 0 0 96.529044 91.276079l139.738169-41.163722a116.843609 116.843609 0 0 0 47.2302-27.217797l198.032135-188.153772 238.521805 254.838537 1.766484 1.836213a75.958805 75.958805 0 0 0 107.430109 0.441621l161.865703-161.865703a75.912319 75.912319 0 0 0 1.30162-105.593896zM283.475213 833.129562L177.90456 727.558909a36.886972 36.886972 0 0 0-11.482145-7.600529L690.74271 221.833181l110.428483 110.428483a34.399948 34.399948 0 0 0 5.578371 3.718913z m537.452708-734.95025a41.233452 41.233452 0 0 1 57.550184 0.743783l56.713428 56.713428a41.419397 41.419397 0 0 1-0.743783 59.03775l-75.610156 71.658811a35.492379 35.492379 0 0 0-4.648642-7.158908l-109.196593-109.057134zM247.169321 380.630781a37.189133 37.189133 0 0 0 25.892934-10.877822l56.225322-56.225321a37.491295 37.491295 0 0 0-52.994516-52.994515l-56.225321 56.225321a37.189133 37.189133 0 0 0-10.459443 23.731316l-95.62256-102.270117c-0.604323-0.604323-0.604323-1.208647-0.418378-1.348106l161.865704-161.91219c0.139459-0.139459 0.790269-0.139459 1.464322 0.488107l215.999136 230.758573-166.862994 158.518682zM79.074438 929.309958a1.8827 1.8827 0 0 1-2.324321-2.324321l33.958328-144.96789a41.558857 41.558857 0 0 1 6.22918-13.457818 37.189133 37.189133 0 0 0 7.902691 11.877279l103.432277 103.432278a41.070749 41.070749 0 0 1-9.297283 4.160534l-139.784656 41.186965z m700.922193 19.524295c-0.139459 0.139459-0.790269 0.139459-1.464322-0.488107l-147.12951-157.170575a36.58481 36.58481 0 0 0 16.502678-9.041608l56.225321-56.225322a37.491295 37.491295 0 1 0-52.994515-52.994515l-56.225321 56.225321a37.189133 37.189133 0 0 0-8.553501 13.945925l-46.742092-49.972898L706.478362 534.593793 941.443956 785.620444c0.557837 0.604323 0.557837 1.208647 0.418378 1.348106l-161.819217 161.865703z
</Geometry>
</ResourceDictionary>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -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))
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

24
Thread/UpdateThread.cs Normal file
View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GeekDesk.Thread
{
public class UpdateThread
{
public static void Update()
{
System.Threading.Thread t = new System.Threading.Thread(new ThreadStart(updateApp));
t.IsBackground = true;
t.Start();
}
private static void updateApp()
{
}
}
}

View File

@@ -30,24 +30,22 @@ namespace GeekDesk.Util
/// <param name="fsModifiers">组合键</param>
/// <param name="key">快捷键</param>
/// <param name="callBack">回调函数</param>
public static int Regist(Window window, HotkeyModifiers fsModifiers, Key key, HotKeyCallBackHanlder callBack)
public static int Regist(IntPtr windowHandle, HotkeyModifiers fsModifiers, Key key, HotKeyCallBackHanlder callBack)
{
var hwnd = new WindowInteropHelper(window).Handle;
var _hwndSource = HwndSource.FromHwnd(hwnd);
_hwndSource.AddHook(WndProc);
HwndSource hs = HwndSource.FromHwnd(windowHandle);
hs.AddHook(WndProc);
int id = keyid++;
var vk = KeyInterop.VirtualKeyFromKey(key);
keymap[id] = callBack;
if (!RegisterHotKey(hwnd, id, fsModifiers, (uint)vk)) throw new Exception("RegisterHotKey Failed");
int vk = KeyInterop.VirtualKeyFromKey(key);
keymap.Add(id, callBack);
if (!RegisterHotKey(windowHandle, id, fsModifiers, (uint)vk)) throw new Exception("RegisterHotKey Failed");
return id;
}
/// <summary>
/// 快捷键消息处理
/// </summary>
static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
static IntPtr WndProc(IntPtr windowHandle, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == WM_HOTKEY)
{
@@ -65,16 +63,21 @@ namespace GeekDesk.Util
/// </summary>
/// <param name="hWnd">持有快捷键窗口的句柄</param>
/// <param name="callBack">回调函数</param>
public static void UnRegist(IntPtr hWnd, HotKeyCallBackHanlder callBack)
public static void UnRegist(IntPtr windowHandle, HotKeyCallBackHanlder callBack)
{
foreach (KeyValuePair<int, HotKeyCallBackHanlder> var in keymap)
List<int> list = new List<int>(keymap.Keys);
for (int i=0; i < list.Count; i++)
{
if (var.Value == callBack)
UnregisterHotKey(hWnd, var.Key);
if (keymap[list[i]] == callBack)
{
HwndSource hs = HwndSource.FromHwnd(windowHandle);
hs.RemoveHook(WndProc);
UnregisterHotKey(windowHandle, list[i]);
keymap.Remove(list[i]);
}
}
}
const int WM_HOTKEY = 0x312;
static int keyid = 10;
public static Dictionary<int, HotKeyCallBackHanlder> keymap = new Dictionary<int, HotKeyCallBackHanlder>();

View File

@@ -19,9 +19,9 @@ namespace GeekDesk.ViewModel
{
private SortType menuSortType = SortType.CUSTOM; //菜单排序类型
private SortType iconSortType = SortType.CUSTOM; //图表排序类型
private double windowWidth = (double)DefaultConstant.WINDOW_WIDTH; //窗口宽度
private double windowHeight = (double)DefaultConstant.WINDOW_HEIGHT; //窗口高度
private double menuCardWidth = (double)DefaultConstant.MENU_CARD_WIDHT;//菜单栏宽度
private double windowWidth = (double)MainWindowEnum.WINDOW_WIDTH; //窗口宽度
private double windowHeight = (double)MainWindowEnum.WINDOW_HEIGHT; //窗口高度
private double menuCardWidth = (double)MainWindowEnum.MENU_CARD_WIDHT;//菜单栏宽度
private int selectedMenuIndex = 0; //上次选中菜单索引
private bool followMouse = true; //面板跟随鼠标 默认是
private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
@@ -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

View File

@@ -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");
}
}

View File

@@ -20,8 +20,8 @@ namespace GeekDesk.ViewModel
private BitmapImage bitmapImage; //位图
private byte[] imageByteArr; //图片 byte数组
private string content; //显示信息
private int imageWidth = (int)DefaultConstant.IMAGE_WIDTH; //图片宽度
private int imageHeight = (int)DefaultConstant.IMAGE_HEIGHT; //图片高度
private int imageWidth = (int)MainWindowEnum.IMAGE_WIDTH; //图片宽度
private int imageHeight = (int)MainWindowEnum.IMAGE_HEIGHT; //图片高度
private bool adminStartUp = false; //始终管理员方式启动 默认否
private byte[] defaultImage; //默认图标

View File

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