50 Commits

Author SHA1 Message Date
liufei
56584e1c99 已知问题修复 2022-03-25 15:29:06 +08:00
liufei
05b63d107d 屏幕靠边优化 2022-03-25 15:28:50 +08:00
liufei
eaa37aacae 贴边隐藏优化 2022-03-25 15:28:35 +08:00
liufei
0c9cd85b82 增加搜索功能 2022-03-25 15:28:13 +08:00
liufei
3e0d0c502b 修复拾色工具的bug 2022-03-25 15:25:49 +08:00
liufei
5a89b40244 优化修改菜单图标时的样式及逻辑 2022-01-26 10:20:36 +08:00
liufei
0495b8a121 BUG 2022-01-22 15:11:36 +08:00
liufei
1ef3129017 增加图标排序 2022-01-22 14:20:04 +08:00
liufei
ca3d6b50e3 增加鼠标悬停切换菜单 2022-01-22 14:18:16 +08:00
liufei
683b4bc870 修改包名 防止跟系统包名冲突 2022-01-22 11:08:31 +08:00
liufei
abdc4b6046 修复失去焦点方式关闭窗口的bug 2022-01-20 17:13:37 +08:00
liufei
ff2a103682 优化修改菜单名时的样式 2022-01-20 15:47:40 +08:00
liufei
9c687117f9 优化修改菜单名时的样式 2022-01-20 15:47:27 +08:00
liufei
d61bf2af11 修改错别字 2022-01-20 15:47:06 +08:00
liufei
6fcc599eff 修改默认窗口大小 2022-01-20 15:46:52 +08:00
liufei
9bf0e6ad23 修改程序集版本信息 2022-01-13 09:53:10 +08:00
liufei
fadf020ecf 更新信息 2022-01-13 09:49:19 +08:00
liufei
c062f332ff 修复遮挡任务栏 2022-01-13 09:49:10 +08:00
liufei
4d416e673e 修复无法拖动图标 2022-01-13 09:49:00 +08:00
liufei
a03fb713e4 修改样式和待办中保存无法删除原有任务的bug 2022-01-10 17:56:52 +08:00
liufei
489a27a0ef 2.4.11 2022-01-10 17:29:16 +08:00
liufei
e112dfebea windir 转义 2022-01-10 17:27:29 +08:00
liufei
9ca443acf6 优化代码 2022-01-10 17:27:12 +08:00
liufei
dd17bbc2b3 增加 服务 选项 2022-01-10 16:23:42 +08:00
liufei
c9bb1c2fad 优化样式细节 2022-01-10 11:50:21 +08:00
liufei
8decd923ff 关闭窗口时 将数据设置为null 2022-01-09 17:44:25 +08:00
liufei
65d57b69b6 释放启动进程 2022-01-09 17:42:44 +08:00
liufei
28a523fb04 增加数据持活 2022-01-09 17:37:25 +08:00
liufei
a38ecab5fa 捕获异常, 写出日志 2022-01-09 17:36:15 +08:00
liufei
145564bfc5 捕获异常, 写出日志 2022-01-09 17:33:49 +08:00
liufei
fdd8c8bb10 更新日志 2022-01-09 17:11:05 +08:00
liufei
fce6f47fbe 修改为非开发模式 2022-01-09 17:06:50 +08:00
liufei
c9bc4282c0 增加启动参数 2022-01-09 16:19:27 +08:00
liufei
54200c8254 修复cron任务重复执行bug 2022-01-09 16:17:58 +08:00
liufei
72bcbee888 修改样式 2022-01-09 16:17:43 +08:00
liufei
de02248e75 增加启动参数 2022-01-09 16:17:13 +08:00
liufei
78b5b52c2a 增加启动参数 2022-01-09 16:12:15 +08:00
liufei
b66c9cd082 更新日志说明 2022-01-09 16:12:07 +08:00
liufei
83cdaa4491 修改程序集信息 2022-01-09 16:08:35 +08:00
liufei
9e3c6f67c8 修改错误样式 2022-01-09 16:08:29 +08:00
liufei
1a24222f3f 优化版本 2022-01-09 16:02:43 +08:00
liufei
1b9e4fc79d 优化贴边隐藏动画 2022-01-09 16:00:47 +08:00
liufei
9eaca05012 增加 教程链接 2022-01-09 16:00:02 +08:00
liufei
d82ce80374 修复遮罩层过大 2022-01-09 15:42:19 +08:00
liufei
4444e6000c 提取方法 2022-01-09 15:39:14 +08:00
liufei
46f6de321c 增加日志写入 2022-01-09 15:39:00 +08:00
liufei
c3e46bc751 优化贴边隐藏动画 2022-01-09 15:38:46 +08:00
liufei
b23a1d91c5 修改公共样式 2022-01-09 15:38:30 +08:00
liufei
edacf3249c 增加双击打开 修复重复进程导致不能关闭程序 2022-01-09 15:38:18 +08:00
liufei
ab13cff769 增加 添加系统和开始菜单项目功能 2022-01-09 15:37:37 +08:00
64 changed files with 1472 additions and 823 deletions

View File

@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections> <configSections>
<section <section name="SystemIcons" type="System.Configuration.DictionarySectionHandler" />
name="SystemIcons"
type="System.Configuration.DictionarySectionHandler" />
</configSections> </configSections>
<SystemIcons> <SystemIcons>
<add key="Calculator" value="计算器" /> <add key="Calculator" value="计算器" />
@@ -16,6 +14,7 @@
<add key="Mstsc" value="远程桌面连接" /> <add key="Mstsc" value="远程桌面连接" />
<add key="Control" value="控制面板" /> <add key="Control" value="控制面板" />
<add key="CMD" value="命令行" /> <add key="CMD" value="命令行" />
<add key="Services" value="服务" />
</SystemIcons> </SystemIcons>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
@@ -45,7 +44,7 @@
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<appSettings> <appSettings>
<add key="Version" value="2.4.10" /> <add key="Version" value="2.4.13" />
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" /> <add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" /> <add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" /> <add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
@@ -53,7 +52,6 @@
<add key="ClientSettingsProvider.ServiceUri" value="" /> <add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" /> <add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
</appSettings> </appSettings>
<system.web> <system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider"> <membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers> <providers>

View File

@@ -5,8 +5,8 @@ namespace GeekDesk.Constant
{ {
public enum CommonEnum public enum CommonEnum
{ {
WINDOW_WIDTH = 950, //默认窗体宽度 WINDOW_WIDTH = 850, //默认窗体宽度
WINDOW_HEIGHT = 650, //默认窗体高度 WINDOW_HEIGHT = 600, //默认窗体高度
MENU_CARD_WIDHT = 165, //默认菜单栏宽度 MENU_CARD_WIDHT = 165, //默认菜单栏宽度
IMAGE_WIDTH = 45, //默认图标宽度 IMAGE_WIDTH = 45, //默认图标宽度
IMAGE_HEIGHT = 45, //默认图标高度 IMAGE_HEIGHT = 45, //默认图标高度

View File

@@ -13,7 +13,7 @@ namespace GeekDesk.Constant
public static string APP_DIR = AppDomain.CurrentDomain.BaseDirectory.Trim(); public static string APP_DIR = AppDomain.CurrentDomain.BaseDirectory.Trim();
// 是否为开发模式 // 是否为开发模式
public static bool DEV = false; public static bool DEV = true;
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk"; public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
@@ -26,8 +26,9 @@ namespace GeekDesk.Constant
public static string ERROR_FILE_PATH = APP_DIR + "Error.log"; public static string ERROR_FILE_PATH = APP_DIR + "Error.log";
//系统图标路径 //阴影宽度
public static string SYSTEM_ICON_PATH = "GeekDesk.Resource.Image.SystemIcon.*"; public static readonly int SHADOW_WIDTH = 20;
//系统图标 //系统图标
public static Hashtable SYSTEM_ICONS = (Hashtable)ConfigurationManager.GetSection("SystemIcons"); public static Hashtable SYSTEM_ICONS = (Hashtable)ConfigurationManager.GetSection("SystemIcons");

View File

@@ -3,7 +3,9 @@
public enum SortType public enum SortType
{ {
CUSTOM = 1, //自定义排序 CUSTOM = 1, //自定义排序
NAME = 2, //按名称排 COUNT_UP = 2, //按使用次数升
COUNT = 3 //按使用次数 COUNT_LOW = 3, //按使用次数
NAME_UP = 4, //按名称升序
NAME_LOW = 5, //按名称降序
} }
} }

View File

@@ -64,7 +64,8 @@ namespace GeekDesk.Control.Other
{ {
Growl.SuccessGlobal("下次任务将在 " + minutes + " 分钟后提醒您!"); Growl.SuccessGlobal("下次任务将在 " + minutes + " 分钟后提醒您!");
} }
} else }
else
{ {
appData.ToDoList.Remove(info); //执行任务删除 appData.ToDoList.Remove(info); //执行任务删除
appData.HiToDoList.Add(info); //添加历史任务 appData.HiToDoList.Add(info); //添加历史任务

View File

@@ -37,7 +37,8 @@ namespace GeekDesk.Control.Other
if (!StringUtil.IsEmpty(IconUrl.Text) && !StringUtil.IsEmpty(JsonUrl.Text)) if (!StringUtil.IsEmpty(IconUrl.Text) && !StringUtil.IsEmpty(JsonUrl.Text))
{ {
IconfontWindow.vm.IsSettingUrl = "true"; IconfontWindow.vm.IsSettingUrl = "true";
} else }
else
{ {
IconfontWindow.vm.IsSettingUrl = "false"; IconfontWindow.vm.IsSettingUrl = "false";
} }

View File

@@ -75,7 +75,8 @@ namespace GeekDesk.Control.Other
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName); info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
CommonCode.SaveAppData(MainWindow.appData); CommonCode.SaveAppData(MainWindow.appData);
} }
} catch (Exception e1) }
catch (Exception e1)
{ {
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!"); HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
LogUtil.WriteErrorLog(e1, "修改图标失败!"); LogUtil.WriteErrorLog(e1, "修改图标失败!");

View File

@@ -89,10 +89,10 @@ namespace GeekDesk.Control.Other
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName); info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
CommonCode.SaveAppData(MainWindow.appData); CommonCode.SaveAppData(MainWindow.appData);
} }
} catch (Exception e1) } catch (Exception ex)
{ {
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!"); HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
LogUtil.WriteErrorLog(e1, "修改图标失败!"); LogUtil.WriteErrorLog(ex, "修改图标失败!");
} }
} }

View File

@@ -4,7 +4,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d" mc:Ignorable="d"
Background="Transparent" Background="Transparent"
@@ -62,17 +61,9 @@
</hc:Poptip.Instance> </hc:Poptip.Instance>
</hc:Shield> </hc:Shield>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center" Text="这是个人开发的程序,所有人可任意修改和免费使用(商用请联系作者)" TextWrapping="Wrap"/> <TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center"
Text="这是个人开发的程序,所有人可任意修改和免费使用(商用请联系作者)" TextWrapping="Wrap"/>
<!--<hc:UniformSpacingPanel Spacing="10" Visibility="Visible" 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> </StackPanel>
</hc:SimplePanel> </hc:SimplePanel>
</Grid> </Grid>

View File

@@ -41,7 +41,7 @@
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="鼠标中呼出" Click="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}"> <CheckBox Content="鼠标中呼出" Click="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}">
<CheckBox.Background> <CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0"> <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/> <GradientStop Color="#FF9EA3A6"/>
@@ -60,6 +60,16 @@
</CheckBox> </CheckBox>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="悬停切换菜单" IsChecked="{Binding HoverMenu}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="贴边隐藏" IsChecked="{Binding MarginHide}" Click="MarginHide_Changed"> <CheckBox Content="贴边隐藏" IsChecked="{Binding MarginHide}" Click="MarginHide_Changed">
<CheckBox.Background> <CheckBox.Background>

View File

@@ -1,6 +1,6 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Control.Windows; using GeekDesk.Control.Windows;
using GeekDesk.Thread; using GeekDesk.MyThread;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Data; using HandyControl.Data;
@@ -71,7 +71,8 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.Hotkey = 0; appConfig.Hotkey = 0;
appConfig.HotkeyStr = ""; appConfig.HotkeyStr = "";
appConfig.HotkeyModifiers = 0; appConfig.HotkeyModifiers = 0;
} else }
else
{ {
appConfig.ToDoHotkey = 0; appConfig.ToDoHotkey = 0;
appConfig.ToDoHotkeyStr = ""; appConfig.ToDoHotkeyStr = "";
@@ -90,7 +91,8 @@ namespace GeekDesk.Control.UserControls.Config
{ {
appConfig.HotkeyStr = GetKeyName(downKey); appConfig.HotkeyStr = GetKeyName(downKey);
appConfig.HotkeyModifiers = GetModifierKeys(downKey); appConfig.HotkeyModifiers = GetModifierKeys(downKey);
} else }
else
{ {
appConfig.ToDoHotkeyStr = GetKeyName(downKey); appConfig.ToDoHotkeyStr = GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey); appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
@@ -111,7 +113,8 @@ namespace GeekDesk.Control.UserControls.Config
{ {
appConfig.Hotkey = downKey; appConfig.Hotkey = downKey;
appConfig.HotkeyStr += downKey.ToString(); appConfig.HotkeyStr += downKey.ToString();
} else }
else
{ {
appConfig.ToDoHotkey = downKey; appConfig.ToDoHotkey = downKey;
appConfig.ToDoHotkeyStr += downKey.ToString(); appConfig.ToDoHotkeyStr += downKey.ToString();
@@ -125,7 +128,8 @@ namespace GeekDesk.Control.UserControls.Config
{ {
appConfig.HotkeyStr += GetKeyName(downKey); appConfig.HotkeyStr += GetKeyName(downKey);
appConfig.HotkeyModifiers |= GetModifierKeys(downKey); appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
} else }
else
{ {
appConfig.ToDoHotkeyStr += GetKeyName(downKey); appConfig.ToDoHotkeyStr += GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey); appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
@@ -143,7 +147,8 @@ namespace GeekDesk.Control.UserControls.Config
if (key == Key.LeftCtrl || key == Key.RightCtrl) if (key == Key.LeftCtrl || key == Key.RightCtrl)
{ {
return "Ctrl + "; return "Ctrl + ";
} else if (key == Key.LWin || key == Key.RWin) }
else if (key == Key.LWin || key == Key.RWin)
{ {
return "Win + "; return "Win + ";
} }
@@ -221,7 +226,8 @@ namespace GeekDesk.Control.UserControls.Config
GlobalHotKey.Dispose(MainWindow.hotKeyId); GlobalHotKey.Dispose(MainWindow.hotKeyId);
} }
MainWindow.RegisterHotKey(false); MainWindow.RegisterHotKey(false);
} else }
else
{ {
if (MainWindow.toDoHotKeyId != -1) if (MainWindow.toDoHotKeyId != -1)
{ {
@@ -254,7 +260,8 @@ namespace GeekDesk.Control.UserControls.Config
if (appConfig.MarginHide) if (appConfig.MarginHide)
{ {
MarginHide.StartHide(); MarginHide.StartHide();
} else }
else
{ {
MarginHide.StopHide(); MarginHide.StopHide();
} }
@@ -281,7 +288,8 @@ namespace GeekDesk.Control.UserControls.Config
if (appConfig.MouseMiddleShow) if (appConfig.MouseMiddleShow)
{ {
MouseHookThread.MiddleHook(); MouseHookThread.MiddleHook();
} else }
else
{ {
MouseHookThread.Dispose(); MouseHookThread.Dispose();
} }

View File

@@ -13,6 +13,7 @@
<UserControl.Resources> <UserControl.Resources>
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/> <cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
<cvt:SortTypeConvert x:Key="SortTypeConvert"/>
</UserControl.Resources> </UserControl.Resources>
<Grid MouseDown="DragMove" Background="Transparent"> <Grid MouseDown="DragMove" Background="Transparent">
<hc:SimplePanel Margin="20" > <hc:SimplePanel Margin="20" >
@@ -40,6 +41,45 @@
</CheckBox.Background> </CheckBox.Background>
</CheckBox> </CheckBox>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<TextBlock Text="排序方式" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton x:Name="CustomSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="自定义"
Tag="1"
hc:IconElement.Geometry="{StaticResource CustomSort}"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=1}"/>
<RadioButton x:Name="CountUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
Tag="2"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=2}"/>
<RadioButton x:Name="CountLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
Tag="3"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=3}"/>
<RadioButton x:Name="NameUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Tag="4"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=4}"/>
<RadioButton x:Name="NameLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Tag="5"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=5}"/>
</hc:UniformSpacingPanel>
<TextBlock Text="更新源" Margin="0,25,0,0"/> <TextBlock Text="更新源" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0"> <hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" <RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"

View File

@@ -26,6 +26,13 @@ namespace GeekDesk.Control.UserControls.Config
public OtherControl() public OtherControl()
{ {
InitializeComponent(); InitializeComponent();
this.Loaded += OtherControl_Loaded;
}
private void OtherControl_Loaded(object sender, RoutedEventArgs e)
{
Sort_Check();
} }
private void SelfStartUpBox_Click(object sender, RoutedEventArgs e) private void SelfStartUpBox_Click(object sender, RoutedEventArgs e)
@@ -46,5 +53,70 @@ namespace GeekDesk.Control.UserControls.Config
Window.GetWindow(this).DragMove(); Window.GetWindow(this).DragMove();
} }
} }
private void SortType_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
RadioButton rb = sender as RadioButton;
SortType type = (SortType)int.Parse(rb.Tag.ToString());
SortType resType = type;
switch (type)
{
case SortType.CUSTOM:
break;
case SortType.COUNT_UP:
if (rb.IsChecked == true)
{
CountLowSort.IsChecked = true;
CountUpSort.Visibility = Visibility.Collapsed;
CountLowSort.Visibility = Visibility.Visible;
resType = SortType.COUNT_LOW;
}
break;
case SortType.COUNT_LOW:
if (rb.IsChecked == true)
{
CountUpSort.IsChecked = true;
CountLowSort.Visibility = Visibility.Collapsed;
CountUpSort.Visibility = Visibility.Visible;
resType = SortType.COUNT_UP;
}
break;
case SortType.NAME_UP:
if (rb.IsChecked == true)
{
NameLowSort.IsChecked = true;
NameUpSort.Visibility = Visibility.Collapsed;
NameLowSort.Visibility = Visibility.Visible;
resType = SortType.NAME_LOW;
}
break;
case SortType.NAME_LOW:
if (rb.IsChecked == true)
{
NameUpSort.IsChecked = true;
NameLowSort.Visibility = Visibility.Collapsed;
NameUpSort.Visibility = Visibility.Visible;
resType = SortType.NAME_UP;
}
break;
}
MainWindow.appData.AppConfig.IconSortType = resType;
CommonCode.SortIconList();
}
private void Sort_Check()
{
if (NameLowSort.IsChecked == true)
{
NameUpSort.Visibility = Visibility.Collapsed;
NameLowSort.Visibility = Visibility.Visible;
}
if (CountLowSort.IsChecked == true)
{
CountUpSort.Visibility = Visibility.Collapsed;
CountLowSort.Visibility = Visibility.Visible;
}
}
} }
} }

View File

@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.Config"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d" mc:Ignorable="d"
Background="Transparent" Background="Transparent"
@@ -133,19 +132,26 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" /> <TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Width="100"/> <TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Width="100"/>
<Button Content="选择" Click="ColorButton_Click"/> <Button Content="选择" Margin="0,-10,0,0" Click="ColorButton_Click"/>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
</StackPanel> </StackPanel>
</Grid> </Grid>
<StackPanel x:Name="ColorPanel" Visibility="Collapsed" VerticalAlignment="Center"> <StackPanel x:Name="ColorPanel" Panel.ZIndex="1"
Visibility="Collapsed"
Height="500"
Width="450"
VerticalAlignment="Center">
<StackPanel.Background> <StackPanel.Background>
<SolidColorBrush Color="AliceBlue" Opacity="0"/> <SolidColorBrush Color="AliceBlue" Opacity="0"/>
</StackPanel.Background> </StackPanel.Background>
<hc:ColorPicker
Name="ColorPicker" <hc:ColorPicker Name="MyColorPicker"
Canceled="ColorPicker_Canceled" ToggleButton.Checked="MyColorPicker_Checked"
SelectedColorChanged="ColorPicker_SelectedColorChanged"/> Canceled="MyColorPicker_Canceled"
Confirmed="MyColorPicker_Confirmed"
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>
</StackPanel> </StackPanel>
</Grid> </Grid>

View File

@@ -6,13 +6,17 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
@@ -27,6 +31,8 @@ namespace GeekDesk.Control.UserControls.Config
{ {
private static AppConfig appConfig = MainWindow.appData.AppConfig; private static AppConfig appConfig = MainWindow.appData.AppConfig;
private System.Windows.Controls.Primitives.ToggleButton toggleButton = null;
public ThemeControl() public ThemeControl()
{ {
InitializeComponent(); InitializeComponent();
@@ -53,10 +59,10 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.BacImgName = ofd.FileName; appConfig.BacImgName = ofd.FileName;
} }
} }
catch (Exception e1) catch (Exception ex)
{ {
LogUtil.WriteErrorLog(ex, "修改背景失败,已重置为默认背景!");
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!"); HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
LogUtil.WriteErrorLog(e1, "修改背景失败!");
} }
} }
@@ -70,10 +76,10 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64); appConfig.BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
appConfig.BacImgName = "系统默认"; appConfig.BacImgName = "系统默认";
} }
catch (Exception e1) catch (Exception ex)
{ {
LogUtil.WriteErrorLog(ex, "修改背景失败2,已重置为默认背景!");
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!"); HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
LogUtil.WriteErrorLog(e1, "修改默认背景失败!");
} }
} }
@@ -84,16 +90,24 @@ namespace GeekDesk.Control.UserControls.Config
ColorPanel.Visibility = Visibility.Visible; ColorPanel.Visibility = Visibility.Visible;
} }
private void ColorPicker_Canceled(object sender, EventArgs e) /// <summary>
/// 取消按钮事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MyColorPicker_Canceled(object sender, EventArgs e)
{ {
ColorPanel.Visibility = Visibility.Collapsed; MyColorPickerClose(sender);
}
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
MyColorPickerClose(sender);
} }
private void ColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e) private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{ {
SolidColorBrush scb = ColorPicker.SelectedBrush; SolidColorBrush scb = MyColorPicker.SelectedBrush;
appConfig.TextColor = scb.ToString(); appConfig.TextColor = scb.ToString();
ColorPanel.Visibility = Visibility.Collapsed;
} }
/// <summary> /// <summary>
@@ -143,5 +157,27 @@ namespace GeekDesk.Control.UserControls.Config
} }
} }
} }
private void MyColorPicker_Checked(object sender, RoutedEventArgs e)
{
toggleButton = e.OriginalSource as System.Windows.Controls.Primitives.ToggleButton;
}
private void MyColorPickerClose(object sender)
{
if (toggleButton != null && toggleButton.IsChecked == true)
{
HandyControl.Controls.ColorPicker cp = sender as HandyControl.Controls.ColorPicker;
const BindingFlags InstanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
Type type = cp.GetType();
toggleButton.IsChecked = false;
MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags);
mi.Invoke(cp, new object[] { null, null });
}
ColorPanel.Visibility = Visibility.Collapsed;
}
} }
} }

View File

@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel" xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
@@ -21,8 +20,8 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="FocusVisualStyle" Value="{x:Null}" />
<EventSetter Event="MouseLeftButtonDown" Handler="MenuClick"/> <EventSetter Event="MouseEnter" Handler="Menu_MouseEnter"/>
<EventSetter Event="MouseRightButtonDown" Handler="MenuClick"/> <!--<EventSetter Event="Unselected" Handler="ListBoxItem_Unselected"/>-->
<Style.Triggers> <Style.Triggers>
<MultiTrigger> <MultiTrigger>
<MultiTrigger.Conditions> <MultiTrigger.Conditions>
@@ -43,24 +42,38 @@
</Storyboard> </Storyboard>
</BeginStoryboard> </BeginStoryboard>
</MultiTrigger.ExitActions> </MultiTrigger.ExitActions>
<MultiTrigger.Setters>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="Black"/>
</MultiTrigger.Setters>
</MultiTrigger> </MultiTrigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFECECEC"/>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#ECECEC"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
<!--<Trigger Property="IsSelected" Value="False">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger> </Trigger>
<Trigger Property="IsSelected" Value="True"> <Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFECECEC"/> <Setter Property="Background" Value="#ECECEC"/>
<Setter Property="Foreground" Value="Black"/> <Setter Property="Foreground" Value="Black"/>
</Trigger> </Trigger>
<MultiDataTrigger> <Trigger Property="IsMouseOver" Value="False">
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEdit}" Value="True"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
</MultiDataTrigger.Setters> <Setter Property="Foreground" Value="Black"/>
</MultiDataTrigger> </Trigger>-->
<!--<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property=""></Condition>
</MultiTrigger.Conditions>
</MultiTrigger>-->
</Style.Triggers> </Style.Triggers>
</Style> </Style>
@@ -94,7 +107,7 @@
BorderThickness="0" Foreground="{x:Null}" BorderThickness="0" Foreground="{x:Null}"
SelectedIndex="{Binding AppConfig.SelectedMenuIndex}" SelectedIndex="{Binding AppConfig.SelectedMenuIndex}"
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.VirtualizationMode="Recycling"
SelectionChanged="menus_SelectionChanged" SelectionChanged="Menu_SelectionChanged"
> >
<ListBox.Resources> <ListBox.Resources>
<ContextMenu x:Key="MenuDialog" Width="200"> <ContextMenu x:Key="MenuDialog" Width="200">
@@ -122,7 +135,7 @@
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}"> <StackPanel Tag="{Binding}">
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}" <TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}" Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
@@ -137,7 +150,9 @@
BorderThickness="0" BorderThickness="0"
IsVisibleChanged="MenuEditWhenVisibilityChanged" IsVisibleChanged="MenuEditWhenVisibilityChanged"
Visibility="{Binding MenuEdit}"/> Visibility="{Binding MenuEdit}"/>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal"
IsVisibleChanged="MenuWhenVisibilityChanged"
Visibility="{Binding NotMenuEdit}">
<Button Background="Transparent" <Button Background="Transparent"
BorderThickness="0" BorderThickness="0"
hc:IconElement.Geometry="{Binding MenuGeometry}" hc:IconElement.Geometry="{Binding MenuGeometry}"
@@ -151,8 +166,6 @@
HorizontalAlignment="Center" HorizontalAlignment="Center"
TextAlignment="Center" TextAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
IsVisibleChanged="MenuWhenVisibilityChanged"
Visibility="{Binding NotMenuEdit}"
/> />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>

View File

@@ -1,16 +1,18 @@
using DraggAnimatedPanelExample; using DraggAnimatedPanelExample;
using GeekDesk.Control.Windows; using GeekDesk.Control.Windows;
using GeekDesk.MyThread;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
namespace GeekDesk.Control.UserControls.PannelCard namespace GeekDesk.Control.UserControls.PannelCard
{ {
@@ -22,6 +24,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
private int menuSelectIndexTemp = -1; private int menuSelectIndexTemp = -1;
private AppData appData = MainWindow.appData; private AppData appData = MainWindow.appData;
//是否正在修改菜单
private static bool IS_EDIT = false;
public LeftCardControl() public LeftCardControl()
{ {
InitializeComponent(); InitializeComponent();
@@ -60,13 +65,13 @@ namespace GeekDesk.Control.UserControls.PannelCard
} }
} }
////菜单点击事件 //////菜单点击事件
private void MenuClick(object sender, MouseButtonEventArgs e) //private void MenuClick(object sender, MouseButtonEventArgs e)
{ //{
//设置对应菜单的图标列表 // //设置对应菜单的图标列表
MenuInfo mi = (MenuInfo)(((StackPanel)sender).Tag); // MenuInfo mi = (MenuInfo)(((StackPanel)sender).Tag);
appData.AppConfig.SelectedMenuIcons = mi.IconList; // appData.AppConfig.SelectedMenuIcons = mi.IconList;
} //}
/// <summary> /// <summary>
/// 当修改菜单元素可见时 设置原菜单为不可见 并且不可选中 /// 当修改菜单元素可见时 设置原菜单为不可见 并且不可选中
@@ -76,9 +81,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
/// <param name="e"></param> /// <param name="e"></param>
private void MenuWhenVisibilityChanged(object sender, DependencyPropertyChangedEventArgs e) private void MenuWhenVisibilityChanged(object sender, DependencyPropertyChangedEventArgs e)
{ {
TextBlock tb = sender as TextBlock; StackPanel sp = sender as StackPanel;
if (tb.Visibility == Visibility.Collapsed)
//ListBoxItem lbi = (sp.TemplatedParent as ContentPresenter).TemplatedParent as ListBoxItem;
if (sp.Visibility == Visibility.Collapsed)
{ {
//SolidColorBrush scb = new SolidColorBrush(Colors.Red);
//lbi.MouseEnter += Lbi_MouseEnter;
if (MenuListBox.SelectedIndex != -1) if (MenuListBox.SelectedIndex != -1)
{ {
menuSelectIndexTemp = MenuListBox.SelectedIndex; menuSelectIndexTemp = MenuListBox.SelectedIndex;
@@ -88,9 +98,33 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
MenuListBox.SelectedIndex = menuSelectIndexTemp; MenuListBox.SelectedIndex = menuSelectIndexTemp;
} }
} else
{
//SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
//SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
//lbi.MouseEnter += (s, me) =>
//{
// lbi.Background = bac;
//};
//lbi.MouseLeave += Lbi_MouseLeave;
//lbi.Selected += (s, me) =>
//{
// lbi.MouseLeave -= Lbi_MouseLeave;
// lbi.Background = bac;
// lbi.Foreground = fontColor;
//};
} }
} }
//private void Lbi_MouseEnter(object sender, MouseEventArgs e)
//{
// ListBoxItem lbi = sender as ListBoxItem;
// lbi.Background = Brushes.Transparent;
//}
/// <summary> /// <summary>
/// 新建菜单 /// 新建菜单
/// </summary> /// </summary>
@@ -104,6 +138,27 @@ namespace GeekDesk.Control.UserControls.PannelCard
MenuListBox.SelectedIndex = appData.MenuList.Count - 1; MenuListBox.SelectedIndex = appData.MenuList.Count - 1;
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex; appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
appData.AppConfig.SelectedMenuIcons = info.IconList; appData.AppConfig.SelectedMenuIcons = info.IconList;
//ItemCollection ic = MenuListBox.Items;
//SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
//SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
//foreach (var icItem in ic)
//{
// ListBoxItem lbi = icItem as ListBoxItem;
// lbi.MouseEnter += (s, me) =>
// {
// lbi.Background = bac;
// };
// lbi.MouseLeave += Lbi_MouseLeave;
// lbi.Selected += (s, me) =>
// {
// lbi.MouseLeave -= Lbi_MouseLeave;
// lbi.Background = bac;
// lbi.Foreground = fontColor;
// };
//}
} }
/// <summary> /// <summary>
@@ -115,6 +170,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo; MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
menuInfo.MenuEdit = (int)Visibility.Visible; menuInfo.MenuEdit = (int)Visibility.Visible;
IS_EDIT = true;
} }
/// <summary> /// <summary>
@@ -153,6 +209,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
/// <param name="e"></param> /// <param name="e"></param>
private void LostFocusOrEnterDown(object sender, EventArgs e) private void LostFocusOrEnterDown(object sender, EventArgs e)
{ {
bool done = true;
TextBox menuBox = null; TextBox menuBox = null;
if (e.GetType() == typeof(KeyEventArgs)) if (e.GetType() == typeof(KeyEventArgs))
{ {
@@ -160,13 +217,17 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (eKey.Key == Key.Enter) if (eKey.Key == Key.Enter)
{ {
menuBox = ((TextBox)sender); menuBox = ((TextBox)sender);
} else
{
done = false;
} }
} } else if (e.GetType() == typeof(RoutedEventArgs))
else if (e.GetType() == typeof(RoutedEventArgs))
{ {
menuBox = ((TextBox)sender); menuBox = ((TextBox)sender);
} }
if (done)
{
if (menuBox != null) if (menuBox != null)
{ {
MenuInfo menuInfo = menuBox.Tag as MenuInfo; MenuInfo menuInfo = menuBox.Tag as MenuInfo;
@@ -174,6 +235,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
menuInfo.MenuName = text; menuInfo.MenuName = text;
menuInfo.MenuEdit = Visibility.Collapsed; menuInfo.MenuEdit = Visibility.Collapsed;
} }
IS_EDIT = false;
MenuListBox.SelectedIndex = menuSelectIndexTemp;
}
} }
/// <summary> /// <summary>
@@ -184,6 +248,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void MenuEditWhenVisibilityChanged(object sender, DependencyPropertyChangedEventArgs e) private void MenuEditWhenVisibilityChanged(object sender, DependencyPropertyChangedEventArgs e)
{ {
TextBox box = sender as TextBox; TextBox box = sender as TextBox;
MenuInfo mi = box.Tag as MenuInfo;
if (box.Visibility == Visibility.Visible) if (box.Visibility == Visibility.Visible)
{ {
Keyboard.Focus(box); Keyboard.Focus(box);
@@ -202,18 +267,58 @@ namespace GeekDesk.Control.UserControls.PannelCard
IconfontWindow.Show(SvgToGeometry.GetIconfonts(), menuInfo); IconfontWindow.Show(SvgToGeometry.GetIconfonts(), menuInfo);
} }
private void menus_SelectionChanged(object sender, SelectionChangedEventArgs e) private void Menu_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
appData.AppConfig.SelectedMenuIcons = null;
//设置对应菜单的图标列表 //设置对应菜单的图标列表
if (MenuListBox.SelectedIndex == -1) if (MenuListBox.SelectedIndex == -1)
{ {
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count - 1].IconList; //appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count - 1].IconList;
} }
else else
{ {
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList; appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
} }
} }
//private void ListBoxItem_Unselected(object sender, RoutedEventArgs e)
//{
// //添加Leave效果
// ListBoxItem lbi = sender as ListBoxItem;
// //lbi.Background = Brushes.Transparent;
// //lbi.MouseLeave += Lbi_MouseLeave;
//}
//private void Lbi_MouseLeave(object sender, MouseEventArgs e)
//{
// ListBoxItem lbi = sender as ListBoxItem;
// lbi.Background = Brushes.Transparent;
//}
/// <summary>
/// 鼠标悬停切换菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Menu_MouseEnter(object sender, MouseEventArgs e)
{
if (appData.AppConfig.HoverMenu && !IS_EDIT)
{
new Thread(() =>
{
Thread.Sleep(200);
this.Dispatcher.Invoke(() =>
{
ListBoxItem lbi = sender as ListBoxItem;
if (lbi.IsMouseOver)
{
int index = MenuListBox.ItemContainerGenerator.IndexFromContainer(lbi);
MenuListBox.SelectedIndex = index;
}
});
}).Start();
}
}
} }
} }

View File

@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard" xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel" xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
@@ -12,6 +12,14 @@
> >
<UserControl.Resources> <UserControl.Resources>
<!--右侧栏样式动画--> <!--右侧栏样式动画-->
<!--<Style x:Key="PanelStyle" TargetType="hc:SimpleStackPanel">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Cursor" Value="Hand"/>
</Trigger>
</Style.Triggers>
</Style>-->
<Style x:Key="ImageStyle" TargetType="Image"> <Style x:Key="ImageStyle" TargetType="Image">
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/> <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/> <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
@@ -31,9 +39,14 @@
</Style> </Style>
<cvt:OpcityConvert x:Key="OpcityConvert"/> <cvt:OpcityConvert x:Key="OpcityConvert"/>
<cvt:SearchResWidth x:Key="SearchResWidth"/>
<temp:SearchIconList x:Key="SearchIconList"/>
</UserControl.Resources> </UserControl.Resources>
<!--右侧栏--> <!--右侧栏-->
<Grid>
<hc:Card AllowDrop="True" <hc:Card AllowDrop="True"
x:Name="WrapCard"
Visibility="Visible"
Drop="Wrap_Drop" Drop="Wrap_Drop"
BorderThickness="1" BorderThickness="1"
Effect="{DynamicResource EffectShadow2}" Effect="{DynamicResource EffectShadow2}"
@@ -50,6 +63,8 @@
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/> <MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
</ContextMenu> </ContextMenu>
</hc:Card.ContextMenu> </hc:Card.ContextMenu>
<Grid>
<StackPanel Panel.ZIndex="1" Margin="0,-10,-300,0" hc:Growl.GrowlParent="True" hc:Growl.Token="MainWindowGrowl"/>
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling" <WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True" VirtualizingPanel.IsContainerVirtualizable="True"
@@ -86,12 +101,8 @@
<ListBox.ItemContainerStyle> <ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}"> <Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/> <Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
<!--<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"/>
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"/>-->
</Style> </Style>
</ListBox.ItemContainerStyle> </ListBox.ItemContainerStyle>
<!--Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"-->
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
@@ -99,12 +110,9 @@
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}" Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}" Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
HorizontalAlignment="Center" HorizontalAlignment="Center"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="{Binding Content}" hc:Poptip.Content="{Binding Content}"
hc:Poptip.Placement="BottomLeft" hc:Poptip.Placement="BottomLeft"
Background="#00FFFFFF" Background="#00FFFFFF"
MouseLeftButtonDown="IconClick"
MouseEnter="StackPanel_MouseEnter" MouseEnter="StackPanel_MouseEnter"
MouseLeave="StackPanel_MouseLeave" MouseLeave="StackPanel_MouseLeave"
> >
@@ -125,5 +133,87 @@
</ListBox> </ListBox>
</WrapPanel> </WrapPanel>
</Grid>
</hc:Card> </hc:Card>
<hc:Card
x:Name="VerticalCard"
Visibility="Hidden"
BorderThickness="1"
Effect="{DynamicResource EffectShadow2}"
Margin="5,0,5,5" Grid.ColumnSpan="2">
<hc:Card.Background>
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
</hc:Card.Background>
<hc:Card.BorderBrush>
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
</hc:Card.BorderBrush>
<Grid>
<StackPanel Panel.ZIndex="1" Margin="0,-10,-300,0" hc:Growl.GrowlParent="True" hc:Growl.Token="MainWindowGrowl"/>
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
>
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
BorderThickness="0"
Padding="0,10,0,0"
>
<ListBox.Background>
<SolidColorBrush Opacity="0"/>
</ListBox.Background>
<ListBox.Resources>
<ContextMenu x:Key="IconDialog" Width="200">
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
</ContextMenu>
</ListBox.Resources>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel Tag="{Binding}"
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}}"
HorizontalAlignment="Left"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="{Binding Content}"
hc:Poptip.Placement="BottomLeft"
Background="#00FFFFFF"
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
Margin="25,20,0,0"
>
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
<TextBlock
Margin="10,5,0,0"
MaxHeight="40"
FontSize="13"
TextWrapping="Wrap"
TextTrimming="WordEllipsis"
TextAlignment="Left"
VerticalAlignment="Center"
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
Text="{Binding Name}"/>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</WrapPanel>
</Grid>
</hc:Card>
</Grid>
</UserControl> </UserControl>

View File

@@ -26,6 +26,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
private AppData appData = MainWindow.appData; private AppData appData = MainWindow.appData;
private volatile static bool DROP_ICON = false;
private Thread dropCheckThread = null;
public RightCardControl() public RightCardControl()
{ {
InitializeComponent(); InitializeComponent();
@@ -42,6 +45,34 @@ namespace GeekDesk.Control.UserControls.PannelCard
_swap = new DelegateCommand<int[]>( _swap = new DelegateCommand<int[]>(
(indexes) => (indexes) =>
{ {
DROP_ICON = true;
if (appData.AppConfig.IconSortType != SortType.CUSTOM
&& (dropCheckThread == null || !dropCheckThread.IsAlive))
{
dropCheckThread = new Thread(() =>
{
do
{
DROP_ICON = false;
Thread.Sleep(1000);
} while (DROP_ICON);
MainWindow.appData.AppConfig.IconSortType = SortType.CUSTOM;
App.Current.Dispatcher.Invoke(() =>
{
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
|| MainWindow.mainWindow.Opacity != 1)
{
Growl.WarningGlobal("已将图标排序规则重置为自定义!");
}
else
{
Growl.Warning("已将图标排序规则重置为自定义!", "MainWindowGrowl");
}
});
});
dropCheckThread.Start();
}
int fromS = indexes[0]; int fromS = indexes[0];
int to = indexes[1]; int to = indexes[1];
ObservableCollection<IconInfo> iconList = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList; ObservableCollection<IconInfo> iconList = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
@@ -60,6 +91,23 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (appData.AppConfig.DoubleOpen)
{
IconClick(sender, e);
}
}
private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (!appData.AppConfig.DoubleOpen)
{
IconClick(sender, e);
}
}
/// <summary> /// <summary>
/// 图标点击事件 /// 图标点击事件
/// </summary> /// </summary>
@@ -78,7 +126,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
StartIconApp(icon, IconStartType.DEFAULT_STARTUP); StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
} }
} else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1) }
else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
{ {
IconInfo icon = (IconInfo)((SimpleStackPanel)sender).Tag; IconInfo icon = (IconInfo)((SimpleStackPanel)sender).Tag;
if (icon.AdminStartUp) if (icon.AdminStartUp)
@@ -119,14 +168,15 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
try try
{ {
Process p = new Process(); using (Process p = new Process())
{
string startArg = icon.StartArg; string startArg = icon.StartArg;
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg)) if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
{ {
StartSystemApp(startArg, type); StartSystemApp(startArg, type);
} else }
else
{ {
p.StartInfo.FileName = icon.Path; p.StartInfo.FileName = icon.Path;
if (!StringUtil.IsEmpty(startArg)) if (!StringUtil.IsEmpty(startArg))
@@ -146,9 +196,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
case IconStartType.ADMIN_STARTUP: case IconStartType.ADMIN_STARTUP:
//p.StartInfo.Arguments = "1";//启动参数 //p.StartInfo.Arguments = "1";//启动参数
p.StartInfo.Verb = "runas"; p.StartInfo.Verb = "runas";
p.StartInfo.CreateNoWindow = false; //设置显示窗口 //p.StartInfo.CreateNoWindow = false; //设置显示窗口
p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程 p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
p.StartInfo.ErrorDialog = false; //p.StartInfo.ErrorDialog = false;
if (appData.AppConfig.AppHideType == AppHideType.START_EXE) if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
{ {
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口 //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
@@ -209,7 +259,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
} }
p.Start(); p.Start();
} }
}
icon.Count++; icon.Count++;
} }
catch (Exception e) catch (Exception e)
@@ -255,7 +305,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (type == IconStartType.ADMIN_STARTUP) if (type == IconStartType.ADMIN_STARTUP)
{ {
Process.Start("mstsc", "-admin"); Process.Start("mstsc", "-admin");
} else }
else
{ {
Process.Start("mstsc"); Process.Start("mstsc");
} }
@@ -266,15 +317,21 @@ namespace GeekDesk.Control.UserControls.PannelCard
case "CMD": case "CMD":
if (type == IconStartType.ADMIN_STARTUP) if (type == IconStartType.ADMIN_STARTUP)
{ {
Process process = new Process(); using (Process process = new Process())
{
process.StartInfo.FileName = "cmd.exe"; process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Verb = "runas"; process.StartInfo.Verb = "runas";
process.Start(); process.Start();
} else }
}
else
{ {
Process.Start("cmd"); Process.Start("cmd");
} }
break; break;
case "Services":
Process.Start("services.msc");
break;
} }
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口 //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide) if (appData.AppConfig.MarginHide)
@@ -304,8 +361,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
string path = (string)obj; string path = (string)obj;
IconInfo iconInfo = CommonCode.GetIconInfoByPath(path); IconInfo iconInfo = CommonCode.GetIconInfoByPath(path);
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo); MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
CommonCode.SaveAppData(MainWindow.appData);
} }
CommonCode.SortIconList();
CommonCode.SaveAppData(MainWindow.appData);
} }
/// <summary> /// <summary>
@@ -428,7 +486,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
ThreadStart ts = new ThreadStart(crs.Remove); ThreadStart ts = new ThreadStart(crs.Remove);
System.Threading.Thread t = new System.Threading.Thread(ts); System.Threading.Thread t = new System.Threading.Thread(ts);
t.Start(); t.Start();
} else }
else
{ {
img.BeginAnimation(WidthProperty, null); img.BeginAnimation(WidthProperty, null);
img.BeginAnimation(HeightProperty, null); img.BeginAnimation(HeightProperty, null);
@@ -511,5 +570,18 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
SystemItemWindow.Show(); SystemItemWindow.Show();
} }
public void VisibilitySearchCard(Visibility vb)
{
VerticalCard.Visibility = vb;
if (vb == Visibility.Visible)
{
WrapCard.Visibility = Visibility.Collapsed;
} else
{
WrapCard.Visibility = Visibility.Visible;
}
}
} }
} }

View File

@@ -53,6 +53,7 @@ namespace GeekDesk.Control.UserControls.SystemItem
iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite); iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite);
} }
menuInfo.IconList.Add(iconInfo); menuInfo.IconList.Add(iconInfo);
CommonCode.SortIconList();
CommonCode.SaveAppData(MainWindow.appData); CommonCode.SaveAppData(MainWindow.appData);
} }
} }

View File

@@ -84,5 +84,20 @@ namespace GeekDesk.Control.UserControls.Backlog
Menu.IsOpen = true; Menu.IsOpen = true;
} }
/// <summary>
/// 选中时颜色变化
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DataGridRow_Selected(object sender, RoutedEventArgs e)
{
Color c = Color.FromRgb(91, 192, 222);
SolidColorBrush b = new SolidColorBrush
{
Color = c,
Opacity = 0.9
};
((DataGridRow)sender).Background = b;
}
} }
} }

View File

@@ -95,6 +95,7 @@ namespace GeekDesk.Control.Windows
{ {
if (e.Key == Key.Escape) if (e.Key == Key.Escape)
{ {
this.DataContext = null;
this.Close(); this.Close();
} }
} }

View File

@@ -57,6 +57,7 @@ namespace GeekDesk.Control.Windows
private void Close_Click(object sender, RoutedEventArgs e) private void Close_Click(object sender, RoutedEventArgs e)
{ {
this.DataContext = null;
this.Close(); this.Close();
} }
@@ -73,13 +74,15 @@ namespace GeekDesk.Control.Windows
LoadingEle.Visibility = Visibility.Visible; LoadingEle.Visibility = Visibility.Visible;
CustomIcon.Visibility = Visibility.Collapsed; CustomIcon.Visibility = Visibility.Collapsed;
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig), "IconUrlDialog"); HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig), "IconUrlDialog");
} else }
else
{ {
if (customIcons == null) if (customIcons == null)
{ {
vm.Iconfonts = null; vm.Iconfonts = null;
LoadingOnlineIcon(); LoadingOnlineIcon();
} else }
else
{ {
vm.Iconfonts = customIcons; vm.Iconfonts = customIcons;
LoadingEle.Visibility = Visibility.Collapsed; LoadingEle.Visibility = Visibility.Collapsed;
@@ -121,6 +124,7 @@ namespace GeekDesk.Control.Windows
} }
break; break;
} }
this.DataContext = null;
this.Close(); this.Close();
} }
@@ -148,7 +152,8 @@ namespace GeekDesk.Control.Windows
if (CheckSettingUrl.Text == "true") if (CheckSettingUrl.Text == "true")
{ {
LoadingOnlineIcon(); LoadingOnlineIcon();
} else }
else
{ {
LoadingEle.IsRunning = true; LoadingEle.IsRunning = true;
CustomIcon.Visibility = Visibility.Collapsed; CustomIcon.Visibility = Visibility.Collapsed;
@@ -179,6 +184,7 @@ namespace GeekDesk.Control.Windows
{ {
if (e.Key == Key.Escape) if (e.Key == Key.Escape)
{ {
this.DataContext = null;
this.Close(); this.Close();
} }
} }

View File

@@ -29,9 +29,9 @@ namespace GeekDesk.Control.Windows
{ {
private static AppConfig appConfig = MainWindow.appData.AppConfig; private static AppConfig appConfig = MainWindow.appData.AppConfig;
private static SystemItemViewModel vm; private static SystemItemViewModel vm;
private static List<IconInfo> systemIcons; private List<IconInfo> systemIcons;
private static List<IconInfo> startMenuIcons; private List<IconInfo> startMenuIcons;
private static List<IconInfo> storeIcons; private List<IconInfo> storeIcons;
private SystemItemWindow() private SystemItemWindow()
{ {
@@ -56,6 +56,7 @@ namespace GeekDesk.Control.Windows
private void Close_Click(object sender, RoutedEventArgs e) private void Close_Click(object sender, RoutedEventArgs e)
{ {
this.DataContext = null;
this.Close(); this.Close();
} }
@@ -149,13 +150,24 @@ namespace GeekDesk.Control.Windows
/// </summary> /// </summary>
/// <param name="path"></param> /// <param name="path"></param>
/// <param name="listInfos"></param> /// <param name="listInfos"></param>
private void GetInfos(string path, List<IconInfo> listInfos) private void GetInfos(string filePath, List<IconInfo> listInfos)
{ {
DirectoryInfo di = new DirectoryInfo(path); DirectoryInfo di = new DirectoryInfo(filePath);
FileSystemInfo[] fileInfoArr = di.GetFileSystemInfos(); string[] filePaths = Directory.GetFiles(filePath);
foreach(FileSystemInfo fi in fileInfoArr) string[] dirPaths = Directory.GetDirectories(filePath);
string[] paths = new string[filePaths.Length + dirPaths.Length];
filePaths.CopyTo(paths, 0);
if (filePaths == null || filePaths.Length == 0)
{
dirPaths.CopyTo(paths, 0);
} else
{
dirPaths.CopyTo(paths, filePaths.Length - 1);
}
foreach (string path in paths)
{ {
path = fi.FullName;
if (File.Exists(path)) if (File.Exists(path))
{ {
string ext = Path.GetExtension(path).ToLower(); string ext = Path.GetExtension(path).ToLower();
@@ -178,6 +190,13 @@ namespace GeekDesk.Control.Windows
GetInfos(path, listInfos); GetInfos(path, listInfos);
} }
} }
//FileSystemInfo[] fileInfoArr = di.GetFileSystemInfos();
//foreach(FileSystemInfo fi in fileInfoArr)
//{
// string path = fi.FullName;
//}
} }
/// <summary> /// <summary>
@@ -270,6 +289,7 @@ namespace GeekDesk.Control.Windows
{ {
if (e.Key == Key.Escape) if (e.Key == Key.Escape)
{ {
this.DataContext = null;
this.Close(); this.Close();
} }
} }

View File

@@ -30,6 +30,7 @@
<Border.Resources> <Border.Resources>
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}"> <Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
<Setter Property="Width" Value="67"/> <Setter Property="Width" Value="67"/>
<Setter Property="Margin" Value="0,5,0,0"/>
<Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Center"/> <Setter Property="TextAlignment" Value="Center"/>
@@ -67,13 +68,15 @@
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=2}"/> IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel x:Name="SetTimePanel" Visibility="Visible" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0"> <hc:UniformSpacingPanel x:Name="SetTimePanel" Height="30" Visibility="Visible" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<WrapPanel VerticalAlignment="Center">
<TextBlock Text="指定时间:" Style="{StaticResource LeftTB}"/> <TextBlock Text="指定时间:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red" Margin="-10,0,0,0"/> <TextBlock Text="*" Foreground="Red"/>
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="-5.2,0,0,0"/> </WrapPanel>
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="1.6,0,0,0"/>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel x:Name="CronPanel" Visibility="Collapsed" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0"> <hc:UniformSpacingPanel x:Name="CronPanel" Height="30" Visibility="Collapsed" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<WrapPanel VerticalAlignment="Center"> <WrapPanel VerticalAlignment="Center">
<TextBlock Text="CRON:" Style="{StaticResource LeftTB}"/> <TextBlock Text="CRON:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red" /> <TextBlock Text="*" Foreground="Red" />
@@ -84,8 +87,10 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0"> <hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<WrapPanel VerticalAlignment="Center">
<TextBlock Text="完成时间:" Style="{StaticResource LeftTB}"/> <TextBlock Text="完成时间:" Style="{StaticResource LeftTB}"/>
<TextBlock x:Name="DoneTime" Text="{Binding DoneTime, Mode=OneWay}" Width="200"/> </WrapPanel>
<TextBlock x:Name="DoneTime" VerticalAlignment="Center" Margin="5,6,0,0" Text="{Binding DoneTime, Mode=OneWay}" Width="200"/>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>

View File

@@ -151,7 +151,14 @@ namespace GeekDesk.Control.Windows
}; };
if (windowType != NEW_TODO) if (windowType != NEW_TODO)
{ {
appData.HiToDoList.Remove(this.DataContext as ToDoInfo); ToDoInfo tdi = this.DataContext as ToDoInfo;
if (appData.HiToDoList.Contains(tdi))
{
appData.HiToDoList.Remove(tdi);
} else if (appData.ToDoList.Contains(tdi))
{
appData.ToDoList.Remove(tdi);
}
} }
appData.ToDoList.Add(info); appData.ToDoList.Add(info);
@@ -247,6 +254,7 @@ namespace GeekDesk.Control.Windows
{ {
if (e.Key == Key.Escape) if (e.Key == Key.Escape)
{ {
this.DataContext = null;
this.Close(); this.Close();
} }
} }

View File

@@ -102,6 +102,7 @@ namespace GeekDesk.Control.Windows
{ {
if (e.Key == Key.Escape) if (e.Key == Key.Escape)
{ {
this.DataContext = null;
this.Close(); this.Close();
} }
} }

View File

@@ -38,9 +38,9 @@ namespace GeekDesk.Control.Windows
InitializeComponent(); InitializeComponent();
DataHandle(jo); DataHandle(jo);
} }
catch (Exception e) catch (Exception)
{ {
LogUtil.WriteErrorLog(e, "更新信息格式化失败!");
} }
} }
@@ -111,6 +111,7 @@ namespace GeekDesk.Control.Windows
{ {
if (e.Key == Key.Escape) if (e.Key == Key.Escape)
{ {
this.DataContext = null;
this.Close(); this.Close();
} }
} }

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace GeekDesk.Converts
{
class SearchResWidth : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double menuLeftWidth = double.Parse(value.ToString());
return MainWindow.mainWindow.Width - menuLeftWidth;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}

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
{
public class SortTypeConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (SortType)value == (SortType)int.Parse(parameter.ToString());
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
bool isChecked = (bool)value;
if (!isChecked)
{
return null;
}
return (SortType)int.Parse(parameter.ToString());
}
}
}

View File

@@ -27,7 +27,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@@ -73,6 +72,9 @@
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="NPinyin.Core, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\NPinyin.Core.3.0.0\lib\net45\NPinyin.Core.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.3.3.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL"> <Reference Include="Quartz, Version=3.3.3.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>packages\Quartz.3.3.3\lib\net472\Quartz.dll</HintPath> <HintPath>packages\Quartz.3.3.3\lib\net472\Quartz.dll</HintPath>
</Reference> </Reference>
@@ -188,7 +190,9 @@
<Compile Include="Control\Windows\UpdateWindow.xaml.cs"> <Compile Include="Control\Windows\UpdateWindow.xaml.cs">
<DependentUpon>UpdateWindow.xaml</DependentUpon> <DependentUpon>UpdateWindow.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Converts\SearchResWidth.cs" />
<Compile Include="Converts\DoubleToGridLength.cs" /> <Compile Include="Converts\DoubleToGridLength.cs" />
<Compile Include="Converts\SortTypeConvert.cs" />
<Compile Include="Converts\MenuInfoConvert.cs" /> <Compile Include="Converts\MenuInfoConvert.cs" />
<Compile Include="Converts\TodoTaskExecConvert.cs" /> <Compile Include="Converts\TodoTaskExecConvert.cs" />
<Compile Include="Converts\IntToCornerRadius.cs" /> <Compile Include="Converts\IntToCornerRadius.cs" />
@@ -199,9 +203,9 @@
<Compile Include="Converts\HideTypeConvert.cs" /> <Compile Include="Converts\HideTypeConvert.cs" />
<Compile Include="Interface\IWindowCommon.cs" /> <Compile Include="Interface\IWindowCommon.cs" />
<Compile Include="Task\ToDoTask.cs" /> <Compile Include="Task\ToDoTask.cs" />
<Compile Include="Thread\MouseHookThread.cs" /> <Compile Include="MyThread\MouseHookThread.cs" />
<Compile Include="Thread\DispatcherBuild.cs" /> <Compile Include="MyThread\DispatcherBuild.cs" />
<Compile Include="Thread\UpdateThread.cs" /> <Compile Include="MyThread\UpdateThread.cs" />
<Compile Include="Util\AeroGlassHelper.cs" /> <Compile Include="Util\AeroGlassHelper.cs" />
<Compile Include="Util\GlobalHotKey.cs" /> <Compile Include="Util\GlobalHotKey.cs" />
<Compile Include="Util\CommonCode.cs" /> <Compile Include="Util\CommonCode.cs" />
@@ -222,9 +226,9 @@
<Compile Include="Util\ShowWindowFollowMouse.cs" /> <Compile Include="Util\ShowWindowFollowMouse.cs" />
<Compile Include="Util\StringUtil.cs" /> <Compile Include="Util\StringUtil.cs" />
<Compile Include="Util\SvgToGeometry.cs" /> <Compile Include="Util\SvgToGeometry.cs" />
<Compile Include="Util\SystemIcon.cs" />
<Compile Include="ViewModel\AppConfig.cs" /> <Compile Include="ViewModel\AppConfig.cs" />
<Compile Include="ViewModel\AppData.cs" /> <Compile Include="ViewModel\AppData.cs" />
<Compile Include="ViewModel\Temp\SearchIconList.cs" />
<Compile Include="ViewModel\ToDoInfo.cs" /> <Compile Include="ViewModel\ToDoInfo.cs" />
<Compile Include="ViewModel\IconfontInfo.cs" /> <Compile Include="ViewModel\IconfontInfo.cs" />
<Compile Include="ViewModel\IconInfo.cs" /> <Compile Include="ViewModel\IconInfo.cs" />
@@ -385,35 +389,22 @@
<Isolated>False</Isolated> <Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes> <EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference> </COMReference>
<COMReference Include="Shell32"> </ItemGroup>
<Guid>{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}</Guid> <ItemGroup>
<VersionMajor>1</VersionMajor> <Resource Include="Resource\Image\SystemIcon\Services.png" />
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resource\Image\SystemIcon\Calculator.png" /> <Resource Include="Resource\Image\SystemIcon\Calculator.png" />
<Resource Include="Resource\Image\SystemIcon\CMD.png" />
<Resource Include="Resource\Image\SystemIcon\Computer.png" /> <Resource Include="Resource\Image\SystemIcon\Computer.png" />
<Resource Include="Resource\Image\SystemIcon\Control.png" />
<Resource Include="Resource\Image\SystemIcon\GroupPolicy.png" /> <Resource Include="Resource\Image\SystemIcon\GroupPolicy.png" />
<Resource Include="Resource\Image\SystemIcon\Mstsc.png" />
<Resource Include="Resource\Image\SystemIcon\Network.png" /> <Resource Include="Resource\Image\SystemIcon\Network.png" />
<Resource Include="Resource\Image\SystemIcon\Notepad.png" />
<Resource Include="Resource\Image\SystemIcon\RecycleBin.png" /> <Resource Include="Resource\Image\SystemIcon\RecycleBin.png" />
<Resource Include="Resource\Image\SystemIcon\Registry.png" /> <Resource Include="Resource\Image\SystemIcon\Registry.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<Resource Include="Resource\Image\SystemIcon\Notepad.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\SystemIcon\Mstsc.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\SystemIcon\Control.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\SystemIcon\CMD.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@@ -3,11 +3,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GeekDesk"
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard" xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
mc:Ignorable="d" mc:Ignorable="d"
xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
x:Name="window" x:Name="window"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
Title="GeekDesk" Title="GeekDesk"
@@ -18,33 +16,42 @@
Background="Transparent" Background="Transparent"
ShowInTaskbar="False" ShowInTaskbar="False"
Opacity="0" Opacity="0"
Deactivated="Window_Deactivated" Deactivated="App_LostFocus"
SizeChanged="Window_SizeChanged" SizeChanged="Window_SizeChanged"
KeyDown="OnKeyDown" KeyDown="OnKeyDown"
Focusable="True" Focusable="True"
MouseDown="MainWindow_MouseDown"
> >
<WindowChrome.WindowChrome> <WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/> <WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
</WindowChrome.WindowChrome> </WindowChrome.WindowChrome>
<Window.Resources> <Window.Resources>
<RoutedUICommand x:Key="SearchItem" Text="SearchItem"/>
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/> <cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
<cvt:OpcityConvert x:Key="OpcityConvert"/> <cvt:OpcityConvert x:Key="OpcityConvert"/>
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/> <cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/> <cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
</Window.Resources> </Window.Resources>
<Window.InputBindings>
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchItem}"/>
</Window.InputBindings>
<Window.CommandBindings>
<CommandBinding Command="{StaticResource SearchItem}" CanExecute="SearchItem"/>
</Window.CommandBindings>
<Window.Effect> <Window.Effect>
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray" <DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
RenderingBias="Quality" ShadowDepth="2"/> RenderingBias="Quality" ShadowDepth="2"/>
</Window.Effect> </Window.Effect>
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0" <Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
Background="AliceBlue" LostFocus="App_LostFocus" Background="AliceBlue"
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}" Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True"
hc:Dialog.Token="IconInfoDialog" hc:Dialog.Token="IconInfoDialog"
Focusable="True"
> >
<hc:DialogContainer> <hc:DialogContainer Focusable="True">
<Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"> <Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0">
<!--背景图片--> <!--背景图片-->
@@ -62,6 +69,7 @@
</VisualBrush> </VisualBrush>
</Border.Background> </Border.Background>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition> <RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
@@ -69,9 +77,11 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition x:Name="LeftColumn" MinWidth="80" Width="{Binding AppConfig.MenuCardWidth, Mode=TwoWay, Converter={StaticResource DoubleToGridLength}}" MaxWidth="200"></ColumnDefinition> <ColumnDefinition x:Name="LeftColumn" MinWidth="80" Width="{Binding AppConfig.MenuCardWidth, Mode=TwoWay, Converter={StaticResource DoubleToGridLength}}" MaxWidth="200"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition x:Name="RightColumn" Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!--获取焦点用-->
<TextBox x:Name="EmptyTextBox" Width="0"/>
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove"> <DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
@@ -123,7 +133,21 @@
<!--分割线--> <!--分割线-->
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/> <GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
<uc:RightCardControl Grid.Row="1" Grid.Column="1"/> <!--搜索输入框-->
<TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
x:Name="SearchBox"
Visibility="Collapsed"
LostFocus="SearchBox_LostFocus"
Margin="-100,5,0,0"
Height="32"
FontSize="16"
Width="400"
BorderThickness="0"
TextChanged="SearchBox_TextChanged"
/>
<uc:RightCardControl x:Name="RightCard" Grid.Row="1" Grid.Column="1"/>
<hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon" <hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}"> Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">

View File

@@ -1,28 +1,22 @@
using DraggAnimatedPanelExample; using GeekDesk.Constant;
using GeekDesk.Constant;
using GeekDesk.Control;
using GeekDesk.Control.UserControls.Config; using GeekDesk.Control.UserControls.Config;
using GeekDesk.Control.Windows; using GeekDesk.Control.Windows;
using GeekDesk.Interface; using GeekDesk.Interface;
using GeekDesk.Task; using GeekDesk.Task;
using GeekDesk.Thread; using GeekDesk.MyThread;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using Gma.System.MouseKeyHook;
using HandyControl.Data;
using System; using System;
using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using static GeekDesk.Util.ShowWindowFollowMouse; using static GeekDesk.Util.ShowWindowFollowMouse;
using System.Collections.ObjectModel;
using NPinyin;
using GeekDesk.ViewModel.Temp;
namespace GeekDesk namespace GeekDesk
{ {
@@ -48,6 +42,7 @@ namespace GeekDesk
this.SizeChanged += MainWindow_Resize; this.SizeChanged += MainWindow_Resize;
ToDoTask.BackLogCheck(); ToDoTask.BackLogCheck();
////实例化隐藏 Hide类进行时间timer设置 ////实例化隐藏 Hide类进行时间timer设置
MarginHide.ReadyHide(this); MarginHide.ReadyHide(this);
if (appData.AppConfig.MarginHide) if (appData.AppConfig.MarginHide)
@@ -56,11 +51,65 @@ namespace GeekDesk
} }
} }
/// <summary>
/// 显示搜索框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchItem(object sender, CanExecuteRoutedEventArgs e)
{
RightCard.VisibilitySearchCard(Visibility.Visible);
SearchBox.Visibility = Visibility.Visible;
SearchBox.Focus();
}
/// <summary>
/// 搜索开始
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
{
string inputText = SearchBox.Text.ToLower();
if (!string.IsNullOrEmpty(inputText))
{
SearchIconList.IconList.Clear();
ObservableCollection<MenuInfo> menuList = appData.MenuList;
foreach (MenuInfo menu in menuList)
{
ObservableCollection<IconInfo> iconList = menu.IconList;
foreach (IconInfo icon in iconList)
{
string pyName = Pinyin.GetInitials(icon.Name).ToLower();
if (icon.Name.Contains(inputText) || pyName.Contains(inputText)) {
SearchIconList.IconList.Add(icon);
}
}
}
} else
{
SearchIconList.IconList.Clear();
}
}
/// <summary>
/// 隐藏搜索框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchBox_LostFocus(object sender, RoutedEventArgs e)
{
SearchIconList.IconList.Clear();
RightCard.VisibilitySearchCard(Visibility.Collapsed);
SearchBox.Visibility = Visibility.Collapsed;
SearchBox.Text = "";
}
/// <summary> /// <summary>
/// 加载缓存数据 /// 加载缓存数据
/// </summary> /// </summary>
private void LoadData() private void LoadData()
{ {
GC.KeepAlive(appData); // 持活
this.DataContext = appData; this.DataContext = appData;
if (appData.MenuList.Count == 0) if (appData.MenuList.Count == 0)
{ {
@@ -83,11 +132,13 @@ namespace GeekDesk
if (appData.AppConfig.AppAnimation) if (appData.AppConfig.AppAnimation)
{ {
this.Opacity = 0; this.Opacity = 0;
} else }
else
{ {
this.Visibility = Visibility.Collapsed; this.Visibility = Visibility.Collapsed;
} }
} else }
else
{ {
ShowApp(); ShowApp();
} }
@@ -159,45 +210,8 @@ namespace GeekDesk
} }
} }
/// <summary>
/// 淡入淡出效果
/// </summary>
/// <param name="opacity"></param>
/// <param name="milliseconds"></param>
/// <param name="visibility"></param>
public static void FadeStoryBoard(int opacity, int milliseconds, Visibility visibility)
{
if (appData.AppConfig.AppAnimation)
{
DoubleAnimation opacityAnimation = new DoubleAnimation
{
From = mainWindow.Opacity,
To = opacity,
Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
};
opacityAnimation.Completed += (s, e) =>
{
mainWindow.BeginAnimation(OpacityProperty, null);
if (visibility == Visibility.Visible)
{
mainWindow.Opacity = 1;
} else
{
mainWindow.Opacity = 0;
}
};
Timeline.SetDesiredFrameRate(opacityAnimation, 60);
mainWindow.BeginAnimation(OpacityProperty, opacityAnimation);
} else
{
//防止关闭动画后 窗体仍是0透明度
mainWindow.Opacity = 1;
mainWindow.Visibility = visibility;
}
}
/// <summary> /// <summary>
/// 注册新建待办的热键 /// 注册新建待办的热键
/// </summary> /// </summary>
@@ -298,7 +312,8 @@ namespace GeekDesk
if (appData.AppConfig.AppAnimation) if (appData.AppConfig.AppAnimation)
{ {
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed); FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
} else }
else
{ {
this.Visibility = Visibility.Collapsed; this.Visibility = Visibility.Collapsed;
} }
@@ -335,13 +350,15 @@ namespace GeekDesk
// return; // return;
//} //}
//修改贴边隐藏状态为未隐藏 //修改贴边隐藏状态为未隐藏
mainWindow.Activate();
MarginHide.IS_HIDE = false; MarginHide.IS_HIDE = false;
if (appData.AppConfig.FollowMouse) if (appData.AppConfig.FollowMouse)
{ {
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false); ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
} }
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible); FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
Keyboard.Focus(mainWindow); mainWindow.Focus();
} }
public static void HideApp() public static void HideApp()
@@ -349,6 +366,50 @@ namespace GeekDesk
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed); FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
} }
/// <summary>
/// 淡入淡出效果
/// </summary>
/// <param name="opacity"></param>
/// <param name="milliseconds"></param>
/// <param name="visibility"></param>
public static void FadeStoryBoard(int opacity, int milliseconds, Visibility visibility)
{
if (appData.AppConfig.AppAnimation)
{
DoubleAnimation opacityAnimation = new DoubleAnimation
{
From = mainWindow.Opacity,
To = opacity,
Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
};
opacityAnimation.Completed += (s, e) =>
{
mainWindow.BeginAnimation(OpacityProperty, null);
if (visibility == Visibility.Visible)
{
mainWindow.Opacity = 1;
}
else
{
mainWindow.Opacity = 0;
CommonCode.SortIconList();
}
};
Timeline.SetDesiredFrameRate(opacityAnimation, 60);
mainWindow.BeginAnimation(OpacityProperty, opacityAnimation);
}
else
{
//防止关闭动画后 窗体仍是0透明度
mainWindow.Opacity = 1;
mainWindow.Visibility = visibility;
if (visibility == Visibility.Collapsed)
{
CommonCode.SortIconList();
}
}
}
@@ -434,26 +495,19 @@ namespace GeekDesk
SettingButton.ContextMenu = null; SettingButton.ContextMenu = null;
} }
private void App_LostFocus(object sender, RoutedEventArgs e) private void App_LostFocus(object sender, EventArgs e)
{ {
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS) if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS
&& this.Opacity == 1)
{ {
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口 //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide && !MarginHide.IS_HIDE) if (!appData.AppConfig.MarginHide || (appData.AppConfig.MarginHide && !MarginHide.IS_HIDE))
{ {
this.Visibility = Visibility.Collapsed; HideApp();
} }
} }
} }
private void Window_Deactivated(object sender, EventArgs e)
{
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
{
this.Visibility = Visibility.Collapsed;
}
}
private void Window_SizeChanged(object sender, SizeChangedEventArgs e) private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
{ {
if (this.DataContext != null) if (this.DataContext != null)
@@ -517,9 +571,16 @@ namespace GeekDesk
HideApp(); HideApp();
} }
} }
/// <summary>
/// 为了让修改菜单的textBox失去焦点
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MainWindow_MouseDown(object sender, MouseButtonEventArgs e)
{
EmptyTextBox.Focus();
} }
}
} }

View File

@@ -6,7 +6,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Threading; using System.Windows.Threading;
namespace GeekDesk.Thread namespace GeekDesk.MyThread
{ {
public class DispatcherBuild public class DispatcherBuild
{ {

View File

@@ -1,5 +1,4 @@
using GeekDesk.Control.UserControls.Config; using GeekDesk.Control.UserControls.Config;
using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using Gma.System.MouseKeyHook; using Gma.System.MouseKeyHook;
using System; using System;
@@ -11,12 +10,12 @@ using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;
namespace GeekDesk.Thread namespace GeekDesk.MyThread
{ {
public class MouseHookThread public class MouseHookThread
{ {
private static AppConfig appConfig = MainWindow.appData.AppConfig; private static AppConfig appConfig = MainWindow.appData.AppConfig;
private static IKeyboardMouseEvents m_GlobalHook = null; private static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
private static Dispatcher dispatcher; private static Dispatcher dispatcher;
@@ -24,9 +23,7 @@ namespace GeekDesk.Thread
public static void MiddleHook() public static void MiddleHook()
{ {
//使用dispatcher来单独监听UI线程 防止程序卡顿 //使用dispatcher来单独监听UI线程 防止程序卡顿
if (dispatcher != null) return;
dispatcher = DispatcherBuild.Build(); dispatcher = DispatcherBuild.Build();
m_GlobalHook = Hook.GlobalEvents();
dispatcher.Invoke((Action)(() => dispatcher.Invoke((Action)(() =>
{ {
m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt; m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt;
@@ -34,17 +31,10 @@ namespace GeekDesk.Thread
} }
public static void Dispose() public static void Dispose()
{
try
{ {
m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt; m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt;
m_GlobalHook.Dispose(); m_GlobalHook.Dispose();
m_GlobalHook = null;
dispatcher.InvokeShutdown(); dispatcher.InvokeShutdown();
dispatcher = null;
}
catch { }
} }
/// <summary> /// <summary>
@@ -60,9 +50,7 @@ namespace GeekDesk.Thread
{ {
MainWindow.mainWindow.Dispatcher.Invoke((Action)(() => MainWindow.mainWindow.Dispatcher.Invoke((Action)(() =>
{ {
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
|| MainWindow.mainWindow.Opacity == 0
|| MarginHide.IS_HIDE)
{ {
MainWindow.ShowApp(); MainWindow.ShowApp();
} }

View File

@@ -12,7 +12,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
namespace GeekDesk.Thread namespace GeekDesk.MyThread
{ {
public class UpdateThread public class UpdateThread
{ {
@@ -59,9 +59,9 @@ namespace GeekDesk.Thread
})); }));
} }
} }
} catch (Exception e) } catch (Exception ex)
{ {
LogUtil.WriteErrorLog(e, "检测更新失败!"); LogUtil.WriteErrorLog(ex, "获取更新失败!");
} }
} }
} }

View File

@@ -49,5 +49,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.1.0")] [assembly: AssemblyVersion("2.4.1.3")]
[assembly: AssemblyFileVersion("2.4.1.0")] [assembly: AssemblyFileVersion("2.4.1.3")]

View File

@@ -37,6 +37,7 @@
M512 0c282.775704 0 512 229.224296 512 512S794.775704 1024 512 1024 0 794.775704 0 512 229.224296 0 512 0zM303.407407 455.111111a56.888889 56.888889 0 1 0 0 113.777778 56.888889 56.888889 0 0 0 0-113.777778z m208.592593 0a56.888889 56.888889 0 1 0 0 113.777778 56.888889 56.888889 0 0 0 0-113.777778z m208.592593 0a56.888889 56.888889 0 1 0 0 113.777778 56.888889 56.888889 0 0 0 0-113.777778z M512 0c282.775704 0 512 229.224296 512 512S794.775704 1024 512 1024 0 794.775704 0 512 229.224296 0 512 0zM303.407407 455.111111a56.888889 56.888889 0 1 0 0 113.777778 56.888889 56.888889 0 0 0 0-113.777778z m208.592593 0a56.888889 56.888889 0 1 0 0 113.777778 56.888889 56.888889 0 0 0 0-113.777778z m208.592593 0a56.888889 56.888889 0 1 0 0 113.777778 56.888889 56.888889 0 0 0 0-113.777778z
</Geometry> </Geometry>
<!--更新源-->
<Geometry x:Key="Gitee"> <Geometry x:Key="Gitee">
M512 0C230.4 0 0 230.4 0 512s230.4 512 512 512 512-230.4 512-512S793.6 0 512 0z m284.8 313.6c0 12.8-12.8 25.6-25.6 25.6H416c-41.6 0-76.8 35.2-76.8 76.8v243.2c0 12.8 12.8 25.6 25.6 25.6h240c41.6 0 76.8-35.2 76.8-76.8v-12.8c0-12.8-12.8-25.6-25.6-25.6H480c-12.8 0-25.6-12.8-25.6-25.6v-64c0-12.8 12.8-25.6 25.6-25.6h291.2c12.8 0 25.6 12.8 25.6 25.6v144c0 92.8-76.8 169.6-169.6 169.6H252.8c-12.8 0-25.6-12.8-25.6-25.6V412.8C227.2 310.4 310.4 224 416 224h355.2c12.8 0 25.6 12.8 25.6 25.6v64z M512 0C230.4 0 0 230.4 0 512s230.4 512 512 512 512-230.4 512-512S793.6 0 512 0z m284.8 313.6c0 12.8-12.8 25.6-25.6 25.6H416c-41.6 0-76.8 35.2-76.8 76.8v243.2c0 12.8 12.8 25.6 25.6 25.6h240c41.6 0 76.8-35.2 76.8-76.8v-12.8c0-12.8-12.8-25.6-25.6-25.6H480c-12.8 0-25.6-12.8-25.6-25.6v-64c0-12.8 12.8-25.6 25.6-25.6h291.2c12.8 0 25.6 12.8 25.6 25.6v144c0 92.8-76.8 169.6-169.6 169.6H252.8c-12.8 0-25.6-12.8-25.6-25.6V412.8C227.2 310.4 310.4 224 416 224h355.2c12.8 0 25.6 12.8 25.6 25.6v64z
</Geometry> </Geometry>
@@ -44,6 +45,23 @@
<Geometry x:Key="GitHub"> <Geometry x:Key="GitHub">
M1021.72444445 512a495.16088889 495.16088889 0 0 1-97.57582223 299.64515555 500.62222222 500.62222222 0 0 1-250.85724444 184.22897778 30.58346667 30.58346667 0 0 1-26.2144-4.73315555 25.85031111 25.85031111 0 0 1-8.00995556-20.02488889v-139.81013334a119.05706667 119.05706667 0 0 0-34.58844444-94.29902222 473.31555555 473.31555555 0 0 0 67.72053333-11.65084444 248.30862222 248.30862222 0 0 0 62.2592-26.2144 187.50577778 187.50577778 0 0 0 53.52106667-43.69066667 209.35111111 209.35111111 0 0 0 36.40888889-69.90506667 334.2336 334.2336 0 0 0 13.83537778-100.12444444 191.87484445 191.87484445 0 0 0-52.7928889-136.53333333 176.21902222 176.21902222 0 0 0-5.09724444-135.44106667 87.01724445 87.01724445 0 0 0-53.52106666 7.28177778 341.87946667 341.87946667 0 0 0-61.16693334 29.12711111l-25.12213333 15.65582222a473.31555555 473.31555555 0 0 0-254.86222223 0c-7.28177778-5.09724445-16.384-10.55857778-28.03484444-17.84035555A371.00657778 371.00657778 0 0 0 300.82844445 220.72888889a94.29902222 94.29902222 0 0 0-57.16195556-9.10222222 178.40355555 178.40355555 0 0 0-4.73315556 136.53333333 197.70026667 197.70026667 0 0 0-52.4288 137.26151111A327.68 327.68 0 0 0 200.33991111 584.81777778a223.55057778 223.55057778 0 0 0 36.40888889 69.90506667 172.94222222 172.94222222 0 0 0 53.52106667 44.41884444 304.7424 304.7424 0 0 0 62.2592 26.2144 471.13102222 471.13102222 0 0 0 68.08462222 11.65084444 105.22168889 105.22168889 0 0 0-32.768 68.44871112 112.86755555 112.86755555 0 0 1-30.21937778 9.4663111 190.41848889 190.41848889 0 0 1-36.40888889 3.2768A78.6432 78.6432 0 0 1 274.61404445 803.27111111a124.5184 124.5184 0 0 1-36.4088889-41.50613333 109.22666667 109.22666667 0 0 0-32.03982222-34.58844445 91.7504 91.7504 0 0 0-32.768-16.01991111h-13.1072a47.33155555 47.33155555 0 0 0-19.29671111 2.91271111q-5.46133333 3.2768-3.2768 7.64586667a50.24426667 50.24426667 0 0 0 6.18951111 9.10222222 62.98737778 62.98737778 0 0 0 8.73813334 8.37404445l4.73315555 2.91271111a88.83768889 88.83768889 0 0 1 29.12711111 25.12213333 179.49582222 179.49582222 0 0 1 20.75306667 33.49617778l6.5536 15.29173333a82.28408889 82.28408889 0 0 0 29.12711111 41.14204445 109.22666667 109.22666667 0 0 0 44.05475556 18.93262222 223.18648889 223.18648889 0 0 0 45.8752 4.73315556 207.16657778 207.16657778 0 0 0 36.40888888-2.54862223l15.29173334-2.54862222v95.39128889a26.2144 26.2144 0 0 1-8.73813334 20.02488889 31.67573333 31.67573333 0 0 1-26.57848888 4.73315555 498.43768889 498.43768889 0 0 1-249.40088889-185.32124444A486.78684445 486.78684445 0 0 1 2.27555555 512a497.70951111 497.70951111 0 0 1 68.44871112-254.86222222A504.6272 504.6272 0 0 1 257.13777778 70.72426667 497.70951111 497.70951111 0 0 1 512 2.27555555a497.70951111 497.70951111 0 0 1 254.86222222 68.44871112A504.6272 504.6272 0 0 1 953.27573333 257.13777778 496.98133333 496.98133333 0 0 1 1021.72444445 512z M1021.72444445 512a495.16088889 495.16088889 0 0 1-97.57582223 299.64515555 500.62222222 500.62222222 0 0 1-250.85724444 184.22897778 30.58346667 30.58346667 0 0 1-26.2144-4.73315555 25.85031111 25.85031111 0 0 1-8.00995556-20.02488889v-139.81013334a119.05706667 119.05706667 0 0 0-34.58844444-94.29902222 473.31555555 473.31555555 0 0 0 67.72053333-11.65084444 248.30862222 248.30862222 0 0 0 62.2592-26.2144 187.50577778 187.50577778 0 0 0 53.52106667-43.69066667 209.35111111 209.35111111 0 0 0 36.40888889-69.90506667 334.2336 334.2336 0 0 0 13.83537778-100.12444444 191.87484445 191.87484445 0 0 0-52.7928889-136.53333333 176.21902222 176.21902222 0 0 0-5.09724444-135.44106667 87.01724445 87.01724445 0 0 0-53.52106666 7.28177778 341.87946667 341.87946667 0 0 0-61.16693334 29.12711111l-25.12213333 15.65582222a473.31555555 473.31555555 0 0 0-254.86222223 0c-7.28177778-5.09724445-16.384-10.55857778-28.03484444-17.84035555A371.00657778 371.00657778 0 0 0 300.82844445 220.72888889a94.29902222 94.29902222 0 0 0-57.16195556-9.10222222 178.40355555 178.40355555 0 0 0-4.73315556 136.53333333 197.70026667 197.70026667 0 0 0-52.4288 137.26151111A327.68 327.68 0 0 0 200.33991111 584.81777778a223.55057778 223.55057778 0 0 0 36.40888889 69.90506667 172.94222222 172.94222222 0 0 0 53.52106667 44.41884444 304.7424 304.7424 0 0 0 62.2592 26.2144 471.13102222 471.13102222 0 0 0 68.08462222 11.65084444 105.22168889 105.22168889 0 0 0-32.768 68.44871112 112.86755555 112.86755555 0 0 1-30.21937778 9.4663111 190.41848889 190.41848889 0 0 1-36.40888889 3.2768A78.6432 78.6432 0 0 1 274.61404445 803.27111111a124.5184 124.5184 0 0 1-36.4088889-41.50613333 109.22666667 109.22666667 0 0 0-32.03982222-34.58844445 91.7504 91.7504 0 0 0-32.768-16.01991111h-13.1072a47.33155555 47.33155555 0 0 0-19.29671111 2.91271111q-5.46133333 3.2768-3.2768 7.64586667a50.24426667 50.24426667 0 0 0 6.18951111 9.10222222 62.98737778 62.98737778 0 0 0 8.73813334 8.37404445l4.73315555 2.91271111a88.83768889 88.83768889 0 0 1 29.12711111 25.12213333 179.49582222 179.49582222 0 0 1 20.75306667 33.49617778l6.5536 15.29173333a82.28408889 82.28408889 0 0 0 29.12711111 41.14204445 109.22666667 109.22666667 0 0 0 44.05475556 18.93262222 223.18648889 223.18648889 0 0 0 45.8752 4.73315556 207.16657778 207.16657778 0 0 0 36.40888888-2.54862223l15.29173334-2.54862222v95.39128889a26.2144 26.2144 0 0 1-8.73813334 20.02488889 31.67573333 31.67573333 0 0 1-26.57848888 4.73315555 498.43768889 498.43768889 0 0 1-249.40088889-185.32124444A486.78684445 486.78684445 0 0 1 2.27555555 512a497.70951111 497.70951111 0 0 1 68.44871112-254.86222222A504.6272 504.6272 0 0 1 257.13777778 70.72426667 497.70951111 497.70951111 0 0 1 512 2.27555555a497.70951111 497.70951111 0 0 1 254.86222222 68.44871112A504.6272 504.6272 0 0 1 953.27573333 257.13777778 496.98133333 496.98133333 0 0 1 1021.72444445 512z
</Geometry> </Geometry>
<!--更新源-->
<!--排序方式-->
<Geometry x:Key="CustomSort">
M950.896028 907.262252 799.11209 753.232157c-12.108782-12.302187-31.893384-12.434194-44.163849-0.325411-12.286838 12.103666-12.434194 31.878035-0.325411 44.163849l151.783938 154.030096c6.110161 6.206352 14.177907 9.31311 22.24463 9.31311 7.919367 0 15.839757-2.989077 21.919219-8.987698C962.857455 939.323459 963.004811 919.54909 950.896028 907.262252z
M884.039341 602.546226c30.65723-17.944697 39.848567-39.624463 42.156122-54.645574 2.26253-14.700817 0.147356-37.530778-22.773679-62.84021-44.830021-49.441039-119.794363-128.689964-142.222165-152.352897-5.586229-32.177863-24.425296-139.980101-37.535895-206.1655-4.869914-24.50716-19.174712-44.387953-39.248909-54.53915-19.896142-10.060123-43.38102-9.739828-66.149583 0.919952-61.168128 28.716019-160.318312 77.455069-189.568497 91.861174-32.803103-3.975545-145.002488-17.466814-211.030297-24.145933-21.283746-2.170432-42.202171 5.363148-57.380872 20.608364-15.971763 16.038278-24.099884 38.928614-21.751397 61.238736 7.060813 67.115584 20.99415 179.407066 25.055652 211.919551-14.049994 29.635971-62.535265 132.146693-90.514503 194.163141-13.837146 30.555923-8.352225 53.30402-1.311879 67.004043 9.378601 18.249643 27.083845 31.165814 48.677653 35.461653 64.594157 12.617365 177.831174 32.345686 211.060997 38.104853 23.967878 22.915919 104.747669 99.984179 153.59826 144.738475 19.759019 18.116613 38.028105 22.941502 51.890834 22.941502 3.360538 0 6.461155-0.284479 9.261944-0.726547 14.365172-2.292206 34.922371-11.127432 51.245128-40.153512 33.336246-59.07342 87.722924-160.679539 103.425557-190.086289 28.390607-15.70775 124.57218-69.067029 183.102225-103.293551C884.029108 602.551342 884.034225 602.551342 884.039341 602.546226zM852.482625 548.642548c-68.234057 39.898709-188.638311 106.333794-189.842743 106.998943-5.301749 2.922563-9.642614 7.324826-12.484336 12.672624-0.681522 1.276063-68.345598 128.328737-107.075691 196.964954-2.948145 5.236258-5.428639 7.848759-6.699586 8.860808-1.514493-0.568958-4.666276-2.272763-9.06854-6.308683-57.065693-52.281737-158.473291-149.420101-159.490457-150.396335-4.493338-4.306072-10.17678-7.172353-16.312524-8.230452-1.428535-0.243547-143.858432-24.786523-218.98548-39.45664-2.917446-0.579191-4.793166-1.942235-5.195326-2.725064-0.457418-0.889253-0.873903-4.900613 2.673899-12.728906 32.568766-72.198346 93.310176-200.045105 93.920066-201.331401 2.562359-5.383614 3.523243-11.391445 2.780323-17.309224-0.178055-1.408069-17.827017-141.622508-26.047236-219.706911-0.381693-3.634784 1.183965-7.90504 3.89368-10.623965 2.115174-2.124384 4.122901-2.592035 5.779633-2.592035 0.37146 0 0.721431 0.020466 1.057075 0.056282 76.915787 7.777127 217.582527 24.954345 218.995713 25.127284 6.019087 0.726547 12.164041-0.310062 17.619286-2.99931 1.245364-0.615007 125.360126-61.899792 196.786898-95.439676 4.895497-2.297322 9.063423-2.922563 11.437493-1.733481 2.699482 1.367137 5.118578 5.67321 6.17156 10.959609 15.310707 77.302597 38.628786 212.590839 38.862099 213.947743 1.046842 6.089695 3.883447 11.732206 8.138354 16.211217 0.950651 0.9967 95.328136 100.345406 147.737786 158.14788 5.880941 6.491855 7.284917 10.608615 7.345292 11.30037C864.163665 539.349905 861.291245 543.483038 852.482625 548.642548z
M348.905458 492.080322c-12.169157-12.220323-31.948643-12.266371-44.168965-0.085958-12.220323 12.169157-12.261255 31.943526-0.085958 44.168965l22.676465 22.768563c6.099928 6.125511 14.111392 9.190313 22.127973 9.190313 7.970532 0 15.94618-3.035126 22.040992-9.104355 12.220323-12.169157 12.261255-31.948643 0.085958-44.168965L348.905458 492.080322z
M508.766352 376.774179c6.105045 6.125511 14.116509 9.190313 22.127973 9.190313 7.970532 0 15.94618-3.035126 22.040992-9.104355 12.220323-12.174274 12.261255-31.948643 0.085958-44.168965l-22.681582-22.768563c-12.17939-12.220323-31.948643-12.256138-44.168965-0.085958-12.220323 12.174274-12.261255 31.948643-0.085958 44.168965L508.766352 376.774179z
M564.67878 441.515692c-16.851806 3.680832-27.53103 20.322861-23.856337 37.174668 0.056282 0.248663 4.707209 25.564235-11.290137 41.621956-15.524578 15.575744-39.035038 11.153014-40.616046 10.832719-16.673751-3.715625-33.310663 6.668886-37.225833 23.352871-3.934612 16.790408 6.486738 33.596166 23.281239 37.535895 6.003737 1.408069 13.852496 2.409886 22.748097 2.409886 22.895453 0 52.745295-6.634094 76.067466-30.04734 32.16763-32.289404 32.777521-77.43972 28.065196-99.023294C598.167498 448.51613 581.51933 437.856349 564.67878 441.515692z
</Geometry>
<Geometry x:Key="UpSort">
M470.016 976.896q-44.032 0-59.392-20.48t-15.36-65.536q0-20.48-0.512-64.512t-1.024-93.696-1.536-96.768-1.024-74.752q0-39.936-7.68-62.464t-35.328-21.504q-20.48 0-48.64-1.024t-49.664 0q-35.84 0-45.568-19.456t13.824-50.176q24.576-30.72 57.344-72.704t67.584-86.016 68.096-87.04 58.88-75.776q23.552-29.696 45.568-30.72t46.592 26.624q24.576 29.696 56.832 69.632t67.072 82.432 68.608 83.968 60.416 73.216q29.696 35.84 23.04 58.88t-43.52 23.04q-11.264 0-25.088 0.512t-29.184 1.024-30.208 1.024-27.136 0.512q-25.6 1.024-32.256 16.384t-5.632 41.984q0 29.696 0.512 77.824t1.024 100.352 1.536 101.376 1.024 79.872q0 13.312-2.048 27.648t-9.728 26.112-21.504 19.968-36.352 8.192q-27.648 0-52.736 0.512t-56.832 1.536z
</Geometry>
<Geometry x:Key="LowSort">
M564.224 44.032q43.008 0 58.368 20.48t15.36 65.536q0 20.48 0.512 64.512t0.512 93.696 0.512 96.768 0.512 74.752q0 38.912 7.68 61.952t35.328 22.016q19.456 0 48.128 1.024t49.152 1.024q35.84 0 45.568 18.944t-13.824 49.664q-24.576 30.72-57.344 72.704t-68.096 86.016-69.12 86.528-59.392 75.264q-23.552 29.696-45.568 30.72t-45.568-27.648q-24.576-29.696-57.344-69.632t-67.072-82.432-67.584-83.968-59.904-74.24q-29.696-35.84-22.528-58.88t44.032-23.04l24.576 0q14.336 0 29.696-0.512t30.208-1.536 26.112-1.024q26.624 0 32.768-15.36t6.144-41.984q0-29.696-0.512-77.824t-0.512-100.352-0.512-101.376-0.512-79.872q0-13.312 2.048-27.648t9.728-26.112 20.992-19.456 36.864-7.68q27.648 0 53.248-0.512t57.344-0.512z
</Geometry>
<!--排序方式-->
</ResourceDictionary> </ResourceDictionary>

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -1,9 +1,9 @@
{ {
"title": "GeekDesk版本更新", "title": "GeekDesk版本更新",
"subTitle": "V2.4.10", "subTitle": "V2.4.12",
"msgTitle": "本次更新内容如下", "msgTitle": "本次更新内容如下",
"msg": "['各位兄弟去给我点个免费Star呗','增加添加系统和开始菜单应用功能','增加项目启动参数','优化贴边隐藏动画效果(可能现在并不完美)','增加双击打开功能','其它已知问题修复(如果有人发现)']", "msg": "['各位兄弟去给我点个免费Star呗','这是个修复版本,主要修复上个版本的bug','修复图标无法拖动','修复界面遮挡任务栏']",
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases", "githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases", "giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
"version": "2.4.10" "version": "2.4.12"
} }

View File

@@ -1,9 +0,0 @@
{
"title": "GeekDesk<73><EFBFBD><E6B1BE><EFBFBD><EFBFBD>",
"subTitle": "V2.3.21",
"msgTitle": "<22><><EFBFBD>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
"msg": "['<27><><EFBFBD>д<EFBFBD><D0B4>ڿ<EFBFBD>Esc<73>˳<EFBFBD>','<27>޸<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BUG,<2C><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>D<EFBFBD>̵<EFBFBD><CCB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ','<27>޸<EFBFBD><DEB8><EFBFBD>֪<EFBFBD><D6AA><EFBFBD><EFBFBD>']",
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
"version": "2.3.21"
}

View File

@@ -1,6 +1,8 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
@@ -186,8 +188,39 @@ namespace GeekDesk.Util
/// <summary>
/// 排序图标
/// </summary>
public static void SortIconList()
{
if (MainWindow.appData.AppConfig.IconSortType != SortType.CUSTOM)
{
ObservableCollection<MenuInfo> menuList = MainWindow.appData.MenuList;
//List<IconInfo> list = new List<IconInfo>(menuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList);
List<IconInfo> list;
foreach (MenuInfo menuInfo in menuList)
{
list = new List<IconInfo>(menuInfo.IconList);
switch (MainWindow.appData.AppConfig.IconSortType)
{
case SortType.COUNT_UP:
list.Sort((x, y) => x.Count.CompareTo(y.Count));
break;
case SortType.COUNT_LOW:
list.Sort((x, y) => y.Count.CompareTo(x.Count));
break;
case SortType.NAME_UP:
list.Sort((x, y) => x.Name.CompareTo(y.Name));
break;
case SortType.NAME_LOW:
list.Sort((x, y) => y.Name.CompareTo(x.Name));
break;
}
menuInfo.IconList = new ObservableCollection<IconInfo>(list);
}
MainWindow.appData.AppConfig.SelectedMenuIcons = MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList;
}
}
} }
} }

View File

@@ -36,7 +36,7 @@ namespace GeekDesk.Util
public static BitmapImage GetBitmapImage(string filePath) public static BitmapImage GetBitmapImage(string filePath)
{ {
Icon ico = null; Icon ico;
//选中文件中的图标总数 //选中文件中的图标总数
var iconTotalCount = PrivateExtractIcons(filePath, 0, 0, 0, null, null, 0, 0); var iconTotalCount = PrivateExtractIcons(filePath, 0, 0, 0, null, null, 0, 0);
//用于接收获取到的图标指针 //用于接收获取到的图标指针
@@ -53,31 +53,18 @@ namespace GeekDesk.Util
{ {
ip = hIcons[0]; ip = hIcons[0];
ico = Icon.FromHandle(ip); ico = Icon.FromHandle(ip);
if (IsMinOrTransparent(ico))
{
ico = null;
} }
} else if (GetBlurExts().Contains(ext))
if (ico == null && GetBlurExts().Contains(ext))
{ {
ico = Icon.ExtractAssociatedIcon(filePath); ico = Icon.ExtractAssociatedIcon(filePath);
if (IsMinOrTransparent(ico))
{
ico = null;
} }
} else
if (ico == null)
{ {
ip = GetJumboIcon(GetIconIndex(filePath)); ip = GetJumboIcon(GetIconIndex(filePath));
ico = Icon.FromHandle(ip); ico = Icon.FromHandle(ip);
} }
return IconToBitmapImage(ico, ip); Bitmap bmp = ico.ToBitmap();
}
private static BitmapImage IconToBitmapImage(Icon icon, IntPtr iconIP)
{
Bitmap bmp = icon.ToBitmap();
MemoryStream strm = new MemoryStream(); MemoryStream strm = new MemoryStream();
ImageCodecInfo myImageCodecInfo = GetEncoderInfo("image/png"); ImageCodecInfo myImageCodecInfo = GetEncoderInfo("image/png");
@@ -86,51 +73,19 @@ namespace GeekDesk.Util
EncoderParameters myEncoderParameters = new EncoderParameters(1); EncoderParameters myEncoderParameters = new EncoderParameters(1);
myEncoderParameters.Param[0] = myEncoderParameter; myEncoderParameters.Param[0] = myEncoderParameter;
//bmp.Save("d:\\test.png");
bmp.Save(strm, myImageCodecInfo, myEncoderParameters); bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
BitmapImage bmpImage = new BitmapImage(); BitmapImage bmpImage = new BitmapImage();
bmpImage.BeginInit(); bmpImage.BeginInit();
strm.Seek(0, SeekOrigin.Begin); strm.Seek(0, SeekOrigin.Begin);
bmpImage.StreamSource = strm; bmpImage.StreamSource = strm;
bmpImage.EndInit(); bmpImage.EndInit();
if (iconIP != IntPtr.Zero) if (ip != IntPtr.Zero)
{ {
Shell32.DestroyIcon(iconIP); Shell32.DestroyIcon(ip);
} }
return bmpImage.Clone(); return bmpImage.Clone();
} }
private static bool IsMinOrTransparent(Icon ico)
{
Bitmap bm = ico.ToBitmap();
double w = bm.Width;
double h = bm.Height;
Color middleColor = bm.GetPixel((int)(w * 0.50), (int)(h * 0.50));
Color transparent = Color.FromArgb(0, 0, 0, 0);
//如果中间像素不为空 直接判断此icon不为空
if (middleColor != Color.Transparent && middleColor != transparent)
{
return false;
}
//判断中间一条横线像素 有不透明元素即判断 icon不为空
Color c;
int h2 = (int)h / 2;
for (int i=0; i<(int)w; i++)
{
c = bm.GetPixel(i, h2);
if (c!= Color.Transparent && c != transparent)
{
return false;
}
}
return true;
}
private static ImageCodecInfo GetEncoderInfo(String mimeType) private static ImageCodecInfo GetEncoderInfo(String mimeType)
{ {
int j; int j;
@@ -461,6 +416,7 @@ namespace GeekDesk.Util
int iOverlay, int iOverlay,
ref int piIndex); ref int piIndex);
}; };
} }
} }

View File

@@ -79,7 +79,8 @@ namespace GeekDesk.Util
|| !Regex.IsMatch(iconPath, HAVE_ICO)) || !Regex.IsMatch(iconPath, HAVE_ICO))
{ {
return null; return null;
} else }
else
{ {
return iconPath.Split(',')[0]; return iconPath.Split(',')[0];
} }

View File

@@ -53,10 +53,9 @@ namespace GeekDesk.Util
UnregisterHotKey(handleTemp[id].Handle, id); UnregisterHotKey(handleTemp[id].Handle, id);
GlobalHotKey.handleTemp[id].Dispose(); GlobalHotKey.handleTemp[id].Dispose();
GlobalHotKey.handleTemp.Remove(id); GlobalHotKey.handleTemp.Remove(id);
} catch (Exception e) } catch
{ {
//nothing //nothing
LogUtil.WriteErrorLog(e, "取消注册热键异常!");
} }

View File

@@ -93,20 +93,25 @@ namespace GeekDesk.Util
if (File.Exists(filePath) || IsSystemItem(filePath)) if (File.Exists(filePath) || IsSystemItem(filePath))
{ {
if (IsImage(filePath)) { if (IsImage(filePath))
{
//图片 //图片
return GetThumbnailByFile(filePath, 256, 256); return GetThumbnailByFile(filePath, 256, 256);
} else }
else
{ //其它文件 { //其它文件
return FileIcon.GetBitmapImage(filePath); return FileIcon.GetBitmapImage(filePath);
} }
} else if(Directory.Exists(filePath)) { }
else if (Directory.Exists(filePath))
{
if ((filePath.IndexOf("\\") == filePath.LastIndexOf("\\")) && filePath.IndexOf("\\") == filePath.Length - 1) if ((filePath.IndexOf("\\") == filePath.LastIndexOf("\\")) && filePath.IndexOf("\\") == filePath.Length - 1)
{ {
//磁盘 //磁盘
return ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_DISK_IMAGE_BASE64); return ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_DISK_IMAGE_BASE64);
} else }
else
{ {
//文件夹 //文件夹
return ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_DIR_IMAGE_BASE64); return ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_DIR_IMAGE_BASE64);

View File

@@ -1,15 +1,9 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
using System.Windows; using System.Windows;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Media; using GeekDesk.Constant;
namespace GeekDesk.Util namespace GeekDesk.Util
{ {
@@ -24,6 +18,7 @@ namespace GeekDesk.Util
RIGHT_HIDE = 6 RIGHT_HIDE = 6
} }
public class MarginHide public class MarginHide
{ {
private static Window window;//定义使用该方法的窗体 private static Window window;//定义使用该方法的窗体
@@ -33,9 +28,11 @@ namespace GeekDesk.Util
private static readonly int fadeShowTime = 200; private static readonly int fadeShowTime = 200;
private static readonly int taskTime = 250; private static readonly int taskTime = 250;
public static readonly int shadowWidth = 20;
private static double showMarginWidth = 1; private static double showMarginWidth = 1;
public static bool IS_RUN = false;
public static bool IS_HIDE = false; public static bool IS_HIDE = false;
private static Timer timer = null; private static Timer timer = null;
@@ -43,11 +40,6 @@ namespace GeekDesk.Util
public static void ReadyHide(Window window) public static void ReadyHide(Window window)
{ {
MarginHide.window = window; MarginHide.window = window;
if (timer != null) return;
timer = new Timer();//添加timer计时器隐藏功能
timer.Interval = taskTime;
timer.Tick += HideWindow;
timer.Start();
} }
@@ -77,7 +69,7 @@ namespace GeekDesk.Util
#region #region
private static void HideWindow(object o, EventArgs e) private static void HideWindow(object o, EventArgs e)
{ {
if (window.Visibility != Visibility.Visible || !IS_RUN) return; if (window.Visibility != Visibility.Visible) return;
double screenLeft = SystemParameters.VirtualScreenLeft; double screenLeft = SystemParameters.VirtualScreenLeft;
double screenTop = SystemParameters.VirtualScreenTop; double screenTop = SystemParameters.VirtualScreenTop;
@@ -122,7 +114,8 @@ namespace GeekDesk.Util
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - showMarginWidth, Window.LeftProperty, HideType.RIGHT_HIDE); HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - showMarginWidth, Window.LeftProperty, HideType.RIGHT_HIDE);
return; return;
} }
} else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth }
else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth
&& mouseY >= windowTop && mouseY <= windowTop + windowHeight && IS_HIDE) && mouseY >= windowTop && mouseY <= windowTop + windowHeight && IS_HIDE)
{ {
//上方显示 //上方显示
@@ -157,12 +150,21 @@ namespace GeekDesk.Util
public static void StartHide() public static void StartHide()
{ {
IS_RUN = true; if (timer != null) return;
timer = new Timer
{
Interval = taskTime
};//添加timer计时器隐藏功能
timer.Tick += HideWindow;
timer.Start();
} }
public static void StopHide() public static void StopHide()
{ {
IS_RUN = false; if (timer == null) return;
timer.Stop();
timer.Dispose();
timer = null;
//功能关闭 如果界面是隐藏状态 那么要显示界面 ↓ //功能关闭 如果界面是隐藏状态 那么要显示界面 ↓
if (IS_HIDE) if (IS_HIDE)
{ {
@@ -238,15 +240,26 @@ namespace GeekDesk.Util
To = to, To = to,
Duration = new Duration(TimeSpan.FromMilliseconds(hideTime)) Duration = new Duration(TimeSpan.FromMilliseconds(hideTime))
}; };
// 如果是显示 则贴屏幕侧不显示阴影
bool isShow = false;
int shadowWidthTemp = Constants.SHADOW_WIDTH;
if (hideType <= HideType.RIGHT_SHOW)
{
isShow = true;
if (hideType == HideType.RIGHT_SHOW)
{
shadowWidthTemp = -shadowWidthTemp;
}
}
da.Completed += (s, e) => da.Completed += (s, e) =>
{ {
if ("Top".Equals(property.Name)) if ("Top".Equals(property.Name))
{ {
window.Top = toTemp; window.Top = isShow ? toTemp - shadowWidthTemp : toTemp;
} }
else else
{ {
window.Left = toTemp; window.Left = isShow ? toTemp - shadowWidthTemp : toTemp;
} }
window.BeginAnimation(property, null); window.BeginAnimation(property, null);
}; };
@@ -261,7 +274,8 @@ namespace GeekDesk.Util
if (to == 0D) if (to == 0D)
{ {
time = fadeHideTime; time = fadeHideTime;
} else }
else
{ {
time = fadeShowTime; time = fadeShowTime;
} }

View File

@@ -48,11 +48,9 @@ namespace GeekDesk.Util
key.Close(); key.Close();
} }
#pragma warning disable CS0168 // 声明了变量“ex”但从未使用过
catch (Exception ex) catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”但从未使用过
{ {
LogUtil.WriteErrorLog(ex, "注册启动Error1!"); LogUtil.WriteErrorLog(ex, "设置开机/取消失败!started=" + started);
return false; return false;
} }
} }
@@ -63,25 +61,21 @@ namespace GeekDesk.Util
key.DeleteValue(exeName);//取消开机启动 key.DeleteValue(exeName);//取消开机启动
key.Close(); key.Close();
} }
#pragma warning disable CS0168 // 声明了变量“ex”但从未使用过
catch (Exception ex) catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”但从未使用过
{ {
LogUtil.WriteErrorLog(ex, "注册启动Error2!"); LogUtil.WriteErrorLog(ex, "取消开机启动失败!started=" + started);
return false; return false;
} }
} }
return true; return true;
} }
#pragma warning disable CS0168 // 声明了变量“ex”但从未使用过
catch (Exception ex) catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”但从未使用过
{ {
LogUtil.WriteErrorLog(ex, "取消/开机/失败!started=" + started);
if (key != null) if (key != null)
{ {
key.Close(); key.Close();
} }
LogUtil.WriteErrorLog(ex, "注册启动Error3!");
return false; return false;
} }
} }

View File

@@ -1,4 +1,5 @@
using System; using GeekDesk.Constant;
using System;
using System.Windows; using System.Windows;
namespace GeekDesk.Util namespace GeekDesk.Util
@@ -27,7 +28,7 @@ namespace GeekDesk.Util
double left = SystemParameters.VirtualScreenLeft; double left = SystemParameters.VirtualScreenLeft;
double top = SystemParameters.VirtualScreenTop; double top = SystemParameters.VirtualScreenTop;
double width = SystemParameters.VirtualScreenWidth; double width = SystemParameters.VirtualScreenWidth;
double height = SystemParameters.WorkArea.Height + 20; // 不遮挡任务栏 double height = SystemParameters.WorkArea.Height;
double right = width - Math.Abs(left); double right = width - Math.Abs(left);
double bottom = height - Math.Abs(top); double bottom = height - Math.Abs(top);
@@ -36,6 +37,7 @@ namespace GeekDesk.Util
switch (position) switch (position)
{ {
case MousePosition.LEFT_BOTTOM: case MousePosition.LEFT_BOTTOM:
afterWidth = 0; afterWidth = 0;
afterHeight = window.Height; afterHeight = window.Height;
@@ -72,12 +74,12 @@ namespace GeekDesk.Util
if (p.X - afterWidth < left) if (p.X - afterWidth < left)
{ {
//判断是否在最左边缘 //判断是否在最左边缘
window.Left = left; window.Left = left - Constants.SHADOW_WIDTH;
} }
else if (p.X + afterWidth > right) else if (p.X + afterWidth > right)
{ {
//判断是否在最右边缘 //判断是否在最右边缘
window.Left = right - window.Width; window.Left = right - window.Width + Constants.SHADOW_WIDTH;
} }
else else
{ {
@@ -88,12 +90,12 @@ namespace GeekDesk.Util
if (p.Y - afterHeight < top) if (p.Y - afterHeight < top)
{ {
//判断是否在最上边缘 //判断是否在最上边缘
window.Top = top; window.Top = top - Constants.SHADOW_WIDTH;
} }
else if (p.Y + afterHeight > bottom) else if (p.Y + afterHeight > bottom)
{ {
//判断是否在最下边缘 //判断是否在最下边缘
window.Top = bottom - window.Height; window.Top = bottom - window.Height + Constants.SHADOW_WIDTH;
} }
else else
{ {

View File

@@ -21,18 +21,15 @@ namespace GeekDesk.Util
string svgPath = "/GeekDesk;component/Resource/Iconfont/iconfont.js"; string svgPath = "/GeekDesk;component/Resource/Iconfont/iconfont.js";
string jsonPath = "/GeekDesk;component/Resource/Iconfont/iconfont.json"; string jsonPath = "/GeekDesk;component/Resource/Iconfont/iconfont.json";
Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream;
Stream jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream;
using (Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream, StreamReader streamReader = new StreamReader(svgStream);
jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream)
{
using (StreamReader streamReader = new StreamReader(svgStream))
{
string svgJsStr = streamReader.ReadToEnd(); string svgJsStr = streamReader.ReadToEnd();
JObject jo = ReadJson(jsonStream); JObject jo = ReadJson(jsonStream);
return GetIconfonts(svgJsStr, jo); return GetIconfonts(svgJsStr, jo);
} }
}
}
public static List<IconfontInfo> GetIconfonts(string svgJsStr, string jsonStr) public static List<IconfontInfo> GetIconfonts(string svgJsStr, string jsonStr)
{ {

View File

@@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public class SystemIcon
{
[DllImport("Shell32.dll")]
public static extern int ExtractIcon(IntPtr h, string strx, int ii);
public static Icon MyExtractIcon(string FileName, int iIndex, IntPtr h)
{
try
{
IntPtr hIcon = (IntPtr)ExtractIcon(h, FileName, iIndex);
if (!hIcon.Equals(null))
{
Icon icon = Icon.FromHandle(hIcon);
return icon;
}
}
catch (Exception ex)
{
}
return null;
}
}
}

View File

@@ -73,7 +73,23 @@ namespace GeekDesk.ViewModel
private bool doubleOpen = false; //双击打开项目 默认关闭 private bool doubleOpen = false; //双击打开项目 默认关闭
private bool hoverMenu = false; //悬停切换菜单 默认关闭
#region GetSet #region GetSet
public bool HoverMenu
{
get
{
return hoverMenu;
}
set
{
hoverMenu = value;
OnPropertyChanged("HoverMenu");
}
}
public bool DoubleOpen public bool DoubleOpen
{ {
get get
@@ -121,7 +137,8 @@ namespace GeekDesk.ViewModel
if (imageWidth == 0) if (imageWidth == 0)
{ {
return (int)CommonEnum.IMAGE_WIDTH; return (int)CommonEnum.IMAGE_WIDTH;
} else }
else
{ {
return imageWidth; return imageWidth;
} }
@@ -396,7 +413,8 @@ namespace GeekDesk.ViewModel
if (blurEffect) if (blurEffect)
{ {
BlurValue = 100; BlurValue = 100;
} else }
else
{ {
BlurValue = 0; BlurValue = 0;
} }
@@ -568,7 +586,8 @@ namespace GeekDesk.ViewModel
bacImgName = "系统默认"; bacImgName = "系统默认";
//Image image = ImageUtil.ByteArrayToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64)); //Image image = ImageUtil.ByteArrayToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64)); return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
} else }
else
{ {
return ImageUtil.ByteArrToImage(ImageByteArr); return ImageUtil.ByteArrToImage(ImageByteArr);
} }

View File

@@ -1,5 +1,4 @@
using GeekDesk.Util; using GeekDesk.Util;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
@@ -85,11 +84,6 @@ namespace GeekDesk.ViewModel
} }
} }
public override String ToString()
{
return JsonConvert.SerializeObject(this);
}
[field: NonSerializedAttribute()] [field: NonSerializedAttribute()]
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName) private void OnPropertyChanged(string propertyName)

View File

@@ -143,7 +143,8 @@ namespace GeekDesk.ViewModel
if (StringUtil.IsEmpty(Path)) if (StringUtil.IsEmpty(Path))
{ {
Content = Name + "\n使用次数: " + Count; Content = Name + "\n使用次数: " + Count;
} else }
else
{ {
Content = Path + "\n" + Name + "\n使用次数: " + Count; Content = Path + "\n" + Name + "\n使用次数: " + Count;
} }

View File

@@ -1,5 +1,4 @@
using Newtonsoft.Json; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -37,11 +36,5 @@ namespace GeekDesk.ViewModel
name = value; name = value;
} }
} }
public override String ToString()
{
return JsonConvert.SerializeObject(this);
}
} }
} }

View File

@@ -2,6 +2,7 @@
using GeekDesk.Util; using GeekDesk.Util;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Windows; using System.Windows;
@@ -23,6 +24,12 @@ namespace GeekDesk.ViewModel
private string geometryColor; //几何图标颜色 private string geometryColor; //几何图标颜色
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>(); private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
[field: NonSerializedAttribute()]
private static string[] NO_WRITE_ARR = new string[] { "IsEdit"};
public bool IsEdit public bool IsEdit
{ {
get get
@@ -108,7 +115,8 @@ namespace GeekDesk.ViewModel
{ {
IsEdit = true; IsEdit = true;
NotMenuEdit = Visibility.Collapsed; NotMenuEdit = Visibility.Collapsed;
} else }
else
{ {
IsEdit = false; IsEdit = false;
NotMenuEdit = Visibility.Visible; NotMenuEdit = Visibility.Visible;
@@ -153,6 +161,13 @@ namespace GeekDesk.ViewModel
private void OnPropertyChanged(string propertyName) private void OnPropertyChanged(string propertyName)
{ {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
foreach (string field in NO_WRITE_ARR)
{
if (field.Equals(propertyName))
{
return;
}
}
CommonCode.SaveAppData(MainWindow.appData); CommonCode.SaveAppData(MainWindow.appData);
} }
} }

View File

@@ -0,0 +1,31 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace GeekDesk.ViewModel.Temp
{
public class SearchIconList
{
private static ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
public static ObservableCollection<IconInfo> IconList
{
get
{
return iconList;
}
set
{
iconList = value;
OnPropertyChanged("IconList");
}
}
public static event PropertyChangedEventHandler PropertyChanged;
private static void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(null, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -1,6 +1,5 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Util; using GeekDesk.Util;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -130,10 +129,7 @@ namespace GeekDesk.ViewModel
// } // }
//} //}
public override String ToString()
{
return JsonConvert.SerializeObject(this);
}
[field: NonSerializedAttribute()] [field: NonSerializedAttribute()]

View File

@@ -6,6 +6,7 @@
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" /> <package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" />
<package id="MouseKeyHook" version="5.6.0" targetFramework="net472" /> <package id="MouseKeyHook" version="5.6.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" /> <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="NPinyin.Core" version="3.0.0" targetFramework="net472" />
<package id="Quartz" version="3.3.3" targetFramework="net472" /> <package id="Quartz" version="3.3.3" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" /> <package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="4.7.1" targetFramework="net472" /> <package id="System.Diagnostics.DiagnosticSource" version="4.7.1" targetFramework="net472" />