94 Commits

Author SHA1 Message Date
BookerLiu
087e98e6df 💥 发布吧 2023-04-24 17:03:25 +08:00
BookerLiu
8b2919c3b5 🚨 捕获异常, 取消崩溃通知 2023-04-23 21:46:55 +08:00
BookerLiu
1d6830b30b 🚨 捕获异常, 取消崩溃通知 2023-04-23 21:42:55 +08:00
BookerLiu
ac8302280f 🔀 禁用窗口最大化 2023-04-23 20:58:12 +08:00
BookerLiu
2df6582f83 💥 准备发行 2023-04-23 17:54:23 +08:00
BookerLiu
ece8787b8e 优化UI, 提取公共样式 2023-04-21 22:33:05 +08:00
BookerLiu
2e1cc7ee3c 优化UI, 提取公共代码 2023-04-21 21:56:49 +08:00
BookerLiu
f152aaf1f4 ♻️ 优化代码, 提取公共样式 2023-04-21 18:05:06 +08:00
BookerLiu
6fd1e65db7 更改部分样式 2023-04-21 17:35:18 +08:00
BookerLiu
ea39576709 💩 防止无法弹出更新窗口 2023-04-21 14:16:58 +08:00
BookerLiu
9485b801b6 💩 添加用户统计代码 2023-04-19 22:19:44 +08:00
BookerLiu
08424b0db0 🐛 防止点击关闭搜索框后打开列表项目 2023-04-19 16:51:56 +08:00
BookerLiu
9de5a19f7f 🎉 添加新手引导提示 2023-04-19 15:50:46 +08:00
BookerLiu
943e8bcefb 🎉 添加新手引导 2023-04-19 15:44:50 +08:00
BookerLiu
48732a0815 🎉 添加新手引导提示 2023-04-19 15:42:51 +08:00
BookerLiu
08b4596f31 🎉 添加新手引导提示 2023-04-18 18:13:25 +08:00
BookerLiu
4565dc5bd6 🐛 修复加密提示未显示的bug 2023-04-17 15:07:28 +08:00
BookerLiu
48fffa6da7 🥕 优化everything 搜索结果 2023-04-17 14:12:31 +08:00
BookerLiu
6072832654 🐛 修复列表显示不全的bug 2023-04-17 13:26:58 +08:00
BookerLiu
dd41635199 🐔 优化everything搜索 2023-04-14 21:30:15 +08:00
BookerLiu
85ad6a6bc4 优化everything搜索 2023-04-14 18:02:18 +08:00
BookerLiu
c34142923c 🧡优化拾色器 2023-04-14 17:44:39 +08:00
BookerLiu
29bb799f11 优化搜索结果显示UI 2023-04-14 14:26:42 +08:00
BookerLiu
41799251af 优化everything功能 2023-04-14 13:48:50 +08:00
BookerLiu
a7181f6973 🚀 减少everything搜索卡顿 2023-04-13 16:39:24 +08:00
BookerLiu
eba6d4770a 优化代码 2023-04-12 15:19:19 +08:00
BookerLiu
058ed5016a 🐛 优化代码 2023-04-07 16:10:29 +08:00
BookerLiu
77a6233e63 优化everything启动 2023-04-06 20:51:17 +08:00
BookerLiu
98f332dc2e ♻️ 开启虚拟化防止卡顿, 增加自适应宽度 2023-04-06 20:36:20 +08:00
BookerLiu
3a18882372 ⚰️ 虚拟化环绕panel 2023-04-06 18:10:49 +08:00
BookerLiu
26e4a7e4d5 文件监听优化 2023-04-06 16:09:33 +08:00
BookerLiu
280e66f457 🎉 every thing 2023-04-04 18:07:27 +08:00
BookerLiu
1fce566f4a EveryThing搜索优化 2023-04-04 17:59:06 +08:00
BookerLiu
3654ec393a 调整合适宽度 2023-04-04 13:47:08 +08:00
BookerLiu
b12bbe9183 🎉 主面板增加是否置顶选项 2023-04-04 13:33:36 +08:00
Demo_Liu
37dd2f7fb2 🐛 控制主面板热键调用频率 2023-04-03 21:18:32 +08:00
BookerLiu
4b5cc7b7eb 🎉 增加是否置于顶层开关 2023-03-31 18:17:24 +08:00
BookerLiu
a18a66352c 🎉 集成everything 2023-03-31 09:06:04 +08:00
BookerLiu
d0547da214 💥 集成everything 开发 2023-03-27 18:10:39 +08:00
BookerLiu
300fcb78da 🚸 删除空菜单不进行确认 2023-03-21 17:54:23 +08:00
BookerLiu
05afacd3ae feture 增加关联实时文件夹 2023-03-21 17:48:12 +08:00
BookerLiu
425d1a4ce5 feture 增加关联实时文件夹 2023-03-21 17:18:18 +08:00
BookerLiu
32adce1815 👥 菜单删除增加询问确认 2023-03-20 14:38:36 +08:00
BookerLiu
80a9975140 ⬆️ 升级依赖 2023-03-20 14:19:56 +08:00
BookerLiu
c1e83e8a39 Revert "新增关联文件夹菜单功能"
This reverts commit ce17e7174e.
2023-03-20 11:29:59 +08:00
Booker
5fa5d3436d Merge pull request #100 from 1062406901/master
新增可关联实时文件夹功能,修改一下bug
2023-03-20 11:07:57 +08:00
Booker
f4a060eb00 Merge pull request #91 from Hsxxxxxx/master
修复直接拖动新图标到菜单导致的异常
2023-03-20 11:05:45 +08:00
huangcan
6fda2ea107 修改多显示器的拾色器显示问题 2023-01-29 16:11:54 +08:00
huangcan
ce17e7174e 新增关联文件夹菜单功能 2023-01-29 15:03:38 +08:00
IamTheViolence
2fd078f722 Merge pull request #1 from BookerLiu/master
Create LICENSE
2023-01-29 11:38:39 +08:00
Hsxxxxxx
753a4e4fa2 修复直接拖动新图标到菜单导致的异常 2022-10-14 15:46:49 +08:00
Booker
ca38d44feb Create LICENSE 2022-09-06 14:53:21 +08:00
Booker
546985f132 Merge pull request #68 from BookerLiu/2.5.13
2.5.13
2022-09-02 16:55:04 +08:00
BookerLiu
ee47443c34 Merge branch '2.5.13' of https://github.com/BookerLiu/GeekDesk into 2.5.13 2022-09-02 16:52:56 +08:00
BookerLiu
ad2556a216 🐛 2022-09-02 15:35:40 +08:00
Booker
ab5529f1e8 Merge pull request #65 from BookerLiu/2.5.13 2022-09-02 11:30:16 +08:00
Booker
7589736751 Merge branch 'master' into 2.5.13 2022-09-02 11:30:08 +08:00
BookerLiu
de57b8d78d 🎉 2022-09-02 11:05:17 +08:00
BookerLiu
d9b0a4de89 🎉 更改logo 2022-09-02 10:56:21 +08:00
BookerLiu
d5e0dc98db 优化代码 2022-09-01 15:23:44 +08:00
BookerLiu
e82af431b5 🚑 修复可能导致输入法特定场景卡顿的问题 2022-08-30 09:06:27 +08:00
Booker
7360412c97 Merge pull request #63 from 1062406901/master
修改密码输入问题与拾色器问题
2022-07-26 11:19:51 +08:00
huangcan
3fa3a42bb3 提交修改:在使用DPI缩放时可以正确的使用取色器 2022-07-25 17:01:16 +08:00
huangcan
904e9a2999 提交更改:将每次点击加密菜单的dialog type值改成input 2022-07-25 12:56:12 +08:00
Booker
39bb8e0c67 Merge pull request #61 from 1062406901/master
更改待办无法编辑或删除的问题
2022-07-20 17:20:09 +08:00
huangcan
01350dff43 提交修改:代办窗口初始化时,初始化type属性为NEW 2022-07-14 11:36:07 +08:00
Booker
8efab6bdee Merge pull request #51 from BookerLiu/2.5.11
2.5.11
2022-06-17 11:10:28 +08:00
Booker
93e70e4525 Merge pull request #50 from BookerLiu/2.5.10
:bug:修改提示
2022-06-15 17:41:14 +08:00
Booker
6cfa9b1361 Merge pull request #49 from BookerLiu/2.5.10
2.5.10
2022-06-15 09:40:18 +08:00
Booker
50cebd48ce Merge pull request #48 from BookerLiu/2.4.16
🐛 修复无法点击切换菜单的bug
2022-05-27 16:24:43 +08:00
Booker
2fc38fdb5f Merge pull request #47 from BookerLiu/2.4.16
📝 更新信息
2022-05-27 15:33:00 +08:00
Booker
302e8bff8b Merge pull request #46 from BookerLiu/2.4.16
📝 更新信息
2022-05-27 15:09:24 +08:00
Booker
d72ea7a43a Merge pull request #45 from BookerLiu/2.4.16
2.4.16
2022-05-27 15:00:11 +08:00
Booker
efb8c537d3 Update README.md 2022-05-27 11:25:58 +08:00
Booker
524b134d16 Update README.md 2022-05-26 17:54:52 +08:00
Booker
5c17348312 Merge pull request #43 from Demo-Liu/2.4.15
2.4.15
2022-05-26 17:21:25 +08:00
Booker
bc7d125801 Merge branch 'master' into 2.4.15 2022-05-26 17:21:14 +08:00
Booker
bf5a6da448 Update Update.json 2022-05-26 16:23:17 +08:00
Booker
2d2f1672dd Merge pull request #39 from Demo-Liu/2.4.14
修改正确的版本号
2022-04-20 17:34:53 +08:00
Booker
072985d2b6 Merge pull request #38 from Demo-Liu/2.4.14
2.4.14
2022-04-20 17:13:40 +08:00
Booker
e5f1368c8b Update README.md 2022-03-01 21:48:55 +08:00
Booker
89ebbbed78 Update README.md 2022-03-01 21:44:40 +08:00
Booker
c1d6aec622 Update README.md 2022-03-01 20:53:56 +08:00
Booker
fbcd55b586 Update README.md 2022-01-27 15:43:24 +08:00
Demo-Liu
9053f4c25b Merge pull request #33 from Demo-Liu/2.4.12
2.4.12
2022-01-13 09:57:48 +08:00
Demo-Liu
13fbacba40 Merge pull request #32 from Demo-Liu/2.4.11
2.4.11
2022-01-10 19:08:14 +08:00
Demo-Liu
dee1caa435 Update README.md 2022-01-07 20:50:49 +08:00
Demo-Liu
dedf20528f Update README.md 2022-01-07 20:48:17 +08:00
Demo-Liu
33b9d3af42 Update README.md 2022-01-07 20:46:36 +08:00
Demo-Liu
4f59c2c64d Merge pull request #29 from Demo-Liu/2.3.21
修改编码
2021-12-20 16:52:51 +08:00
Demo-Liu
701734e048 Merge pull request #28 from Demo-Liu/2.3.21
2.3.21
2021-12-20 16:47:05 +08:00
Demo-Liu
78b685c9ed Update README.md
新版截图
2021-12-15 17:02:04 +08:00
Demo-Liu
746eda8b84 Merge pull request #27 from Demo-Liu/2.3.20
2.3.20
2021-12-13 12:18:48 +08:00
Demo-Liu
b4215fb27d Merge pull request #26 from Demo-Liu/2.3.20
2.3.20
2021-12-13 11:16:56 +08:00
102 changed files with 9096 additions and 1099 deletions

View File

@@ -2,9 +2,16 @@
<configuration>
<configSections>
<section name="SystemIcons" type="System.Configuration.DictionarySectionHandler" />
<section name="ShowSecondsSettings" type="System.Configuration.DictionarySectionHandler" />
<section name="SystemBGs" type="System.Collections.ObjectModel.ObservableCollection" />
<section name="GradientBGParam" type="GeekDesk.ViewModel.GradientBGParam" />
</configSections>
<ShowSecondsSettings>
<add key="Version" value="1.0.01" />
<add key="LProportion" value="0.82" />
<add key="TProportion" value="0.03" />
<add key="DelayTime" value="1500" />
</ShowSecondsSettings>
<SystemIcons>
<add key="Calculator" value="计算器" />
<add key="Computer" value="此电脑" />
@@ -26,7 +33,7 @@
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib" />
<probing privatePath="lib;Plugins\EveryThing\lib" />
<dependentAssembly>
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0" />
@@ -54,7 +61,7 @@
</assemblyBinding>
</runtime>
<appSettings>
<add key="Version" value="2.5.11" />
<add key="Version" value="2.5.14" />
<add key="GitHubUrl" value="https://github.com/BookerLiu/GeekDesk" />
<add key="GiteeUrl" value="https://gitee.com/BookerLiu/GeekDesk/tree/master" />
<add key="GitHubUpdateUrl" value="https://raw.githubusercontent.com/BookerLiu/GeekDesk/master/Update.json" />

View File

@@ -24,7 +24,6 @@ namespace GeekDesk
private void App_Startup(object sender, StartupEventArgs e)
{
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out bool ret);
if (!ret)
{
@@ -32,6 +31,10 @@ namespace GeekDesk
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out ret);
if (!ret)
{
MessageUtil.SendMsgByWName(
"GeekDesk_Main_" + Constants.MY_UUID,
"ShowApp"
);
Environment.Exit(0);
}
}
@@ -51,7 +54,7 @@ namespace GeekDesk
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogUtil.WriteErrorLog(e, "严重异常!");
MessageBox.Show("GeekDesk遇到未知问题崩溃!");
//MessageBox.Show("GeekDesk遇到未知问题崩溃!");
}
public static void DoEvents()
{

View File

@@ -13,7 +13,7 @@ namespace GeekDesk.Constant
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
public static string MY_UUID = "8400A17AEEF7C029";
/// <summary>
/// app数据文件路径
/// </summary>
@@ -26,10 +26,18 @@ namespace GeekDesk.Constant
public static string PW_FILE_BAK_PATH = APP_DIR + "bak\\pw.txt"; //密码文件路径
public static string UUID_FILE_BAK_PATH = APP_DIR + "bak\\uuid.txt"; //密码文件路径
public static string LOG_FILE_PATH = APP_DIR + "logs\\log.log"; //日志文件
public static string ERROR_FILE_PATH = APP_DIR + "logs\\error.log"; // 错误日志
/// <summary>
/// 插件文件夹
/// </summary>
public static string PLUGINS_PATH = APP_DIR + "plugins\\";
public static int SHADOW_WIDTH = 20;
//系统图标

14
Constant/MenuType.cs Normal file
View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Constant
{
public enum MenuType
{
NORMAL, //普通菜单
LINK, //关联菜单
}
}

View File

@@ -1,4 +1,6 @@
namespace GeekDesk.Constant
using System;
namespace GeekDesk.Constant
{
internal class RunTimeStatus
{
@@ -6,39 +8,83 @@
/// <summary>
/// 查询框是否在工作
/// </summary>
public static bool SEARCH_BOX_SHOW = false;
public static volatile bool SEARCH_BOX_SHOW = false;
/// <summary>
/// 查询框是否已经关闭了300毫秒 防止点击右侧区域关闭查询框时误打开列表
/// </summary>
public static volatile bool SEARCH_BOX_HIDED_300 = true;
/// <summary>
/// 贴边隐藏后 以非鼠标经过方式触发显示
/// </summary>
public static bool MARGIN_HIDE_AND_OTHER_SHOW = false;
public static volatile bool MARGIN_HIDE_AND_OTHER_SHOW = false;
/// <summary>
/// 是否锁定主面板 锁定后 不执行隐藏动作
/// </summary>
public static bool LOCK_APP_PANEL = false;
public static volatile bool LOCK_APP_PANEL = false;
/// <summary>
/// 是否弹出了菜单密码框
/// </summary>
public static bool SHOW_MENU_PASSWORDBOX = false;
public static volatile bool SHOW_MENU_PASSWORDBOX = false;
/// <summary>
/// 是否弹出了右键菜单
/// </summary>
public static bool SHOW_RIGHT_BTN_MENU = false;
public static volatile bool SHOW_RIGHT_BTN_MENU = false;
/// <summary>
/// 是否点击了面板功能按钮
/// </summary>
public static bool APP_BTN_IS_DOWN = false;
public static volatile bool APP_BTN_IS_DOWN = false;
/// <summary>
/// 是否正在编辑菜单
/// </summary>
public static bool IS_MENU_EDIT = false;
public static volatile bool IS_MENU_EDIT = false;
/// <summary>
/// 图标card 鼠标滚轮是否正在工作
/// 用来控制popup的显示 否则低性能机器会造成卡顿
/// </summary>
public static volatile bool ICONLIST_MOUSE_WHEEL = false;
/// <summary>
/// 控制多少毫秒后 关闭(ICONLIST_MOUSE_WHEEL)鼠标滚轮运行状态
/// </summary>
public static volatile int MOUSE_WHEEL_WAIT_MS = 100;
/// <summary>
/// 与关闭popup 配合使用, 避免线程结束后不显示popup
/// </summary>
public static volatile bool MOUSE_ENTER_ICON = false;
/// <summary>
/// 控制每次刷新搜索结果 鼠标移动后显示popup
/// </summary>
public static volatile int MOUSE_MOVE_COUNT = 0;
/// <summary>
/// everything 新的键入搜索
/// </summary>
public static volatile bool EVERYTHING_NEW_SEARCH = false;
/// <summary>
/// 键入多少毫秒后 没有新的键入开启搜索
/// </summary>
public static volatile int EVERYTHING_SEARCH_DELAY_TIME = 300;
/// <summary>
/// 控制主界面热键按下规定时间内只执行一次show hide
/// </summary>
public static volatile bool MAIN_HOT_KEY_DOWN = false;
/// <summary>
/// 控制主界面热键按下规定时间内只执行一次show hide
/// </summary>
public static volatile int MAIN_HOT_KEY_TIME = 300;
}
}

19
Constant/WidthTypeEnum.cs Normal file
View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Constant
{
public enum WidthTypeEnum
{
LEFT_CARD = 0, //左侧托盘宽度
RIGHT_CARD = 1, //右侧托盘宽度
RIGHT_CARD_HALF = 2, //右侧托盘宽度的一半
RIGHT_CARD_HALF_TEXT = 3, //右侧托盘宽度的一半 再减去左侧图像宽度
RIGHT_CARD_20 = 4, //右侧托盘宽度 - 20
RIGHT_CARD_40 = 5, //右侧托盘宽度 - 40
RIGHT_CARD_70 = 6, //右侧托盘宽度 - 70
}
}

View File

@@ -37,17 +37,17 @@
</hc:Card>
<hc:UniformSpacingPanel Spacing="20" HorizontalAlignment="Center" Margin="45.5,310,42.5,36">
<hc:TextBox x:Name="DelayTime" Height="20" Width="60" Text="10" PreviewTextInput="DelayTime_PreviewTextInput" PreviewLostKeyboardFocus="DelayTime_PreviewLostKeyboardFocus" />
<hc:TextBox x:Name="DelayTime" Style="{StaticResource MyTextBoxStyle}" Height="20" Width="60" Text="10" PreviewTextInput="DelayTime_PreviewTextInput" PreviewLostKeyboardFocus="DelayTime_PreviewLostKeyboardFocus" />
<ComboBox x:Name="DelayType" hc:DropDownElement.ConsistentWidth="False" SelectedIndex="0" Height="20" Width="60">
<ComboBox.Items>
<ComboBoxItem Content="分"/>
<ComboBoxItem Content="时"/>
</ComboBox.Items>
</ComboBox>
<Button Content="推迟提醒" Click="DelayButton_Click"/>
<Button Style="{StaticResource MyBtnStyle}" Content="推迟提醒" Click="DelayButton_Click"/>
</hc:UniformSpacingPanel>
<Button Click="BacklogDone_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
<Button Style="{StaticResource MyBtnStyle}" Click="BacklogDone_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
</Grid>
</Border>

View File

@@ -23,7 +23,7 @@
<TextBlock Text="SVG 图标地址:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red"/>
</WrapPanel>
<TextBox x:Name="IconUrl" Text="{Binding CustomIconUrl, Mode=OneWay}" Width="240" FontSize="14"/>
<TextBox x:Name="IconUrl" Style="{StaticResource MyTextBoxStyle}" Text="{Binding CustomIconUrl, Mode=OneWay}" Width="240" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="0,58.276,0,-58.276">
@@ -31,18 +31,18 @@
<TextBlock Text="JSON 配置地址:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red"/>
</WrapPanel>
<TextBox x:Name="JsonUrl" Text="{Binding CustomIconJsonUrl, Mode=OneWay}" Width="240" FontSize="14"/>
<TextBox x:Name="JsonUrl" Style="{StaticResource MyTextBoxStyle}" Text="{Binding CustomIconJsonUrl, Mode=OneWay}" Width="240" FontSize="14"/>
</hc:UniformSpacingPanel>
<TextBlock Text="注: 需配置正确的url方可加载远程图标!" Foreground="Red" Margin="10,95,-10,-92" />
<hc:UniformSpacingPanel Spacing="10" Margin="203,125,-203,-125">
<Button Content="取消" Command="hc:ControlCommands.Close" HorizontalAlignment="Stretch" Margin="-1,1,1,1" VerticalAlignment="Stretch"
<Button Style="{StaticResource MyBtnStyle}" Content="取消" Command="hc:ControlCommands.Close" HorizontalAlignment="Stretch" Margin="-1,1,1,1" VerticalAlignment="Stretch"
/>
<Button Content="教程" Click="Teach_Click"
Style="{StaticResource Btn1}"/>
Style="{StaticResource MyBtnStyle}"/>
<Button Content="保存" Click="Confirm_Click"
Command="hc:ControlCommands.Close"
Style="{StaticResource Btn1}"/>
Style="{StaticResource MyBtnStyle}"/>
</hc:UniformSpacingPanel>
</Grid>
<!--<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>-->

View File

@@ -49,6 +49,6 @@
</hc:Card>
</StackPanel>
<Button Click="Close_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
<Button Style="{StaticResource MyBtnStyle}" Click="Close_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
</Grid>
</Border>

View File

@@ -63,7 +63,7 @@
</ListBox>
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<Button Content="关闭" Style="{StaticResource Btn1}" Click="Close_Click" HorizontalAlignment="Stretch" Margin="524,360,-524,10" VerticalAlignment="Stretch"/>
<Button Content="关闭" Style="{StaticResource MyBtnStyle}" Click="Close_Click" HorizontalAlignment="Stretch" Margin="524,360,-524,10" VerticalAlignment="Stretch"/>
</hc:UniformSpacingPanel>
</Grid>
</Border>

View File

@@ -24,7 +24,7 @@
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top"/>
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
<TextBox x:Name="IconName" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
<TextBlock Text="相对路径:" Style="{StaticResource LeftTB}"/>
@@ -40,24 +40,19 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,15,0,0">
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
<Button Content="修改" Click="EditImage"/>
<Button Content="重置" Click="ReStoreImage"/>
<Button Style="{StaticResource MyBtnStyle}" Content="修改" Click="EditImage"/>
<Button Style="{StaticResource MyBtnStyle}" Content="重置" Click="ReStoreImage"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="4,15,0,0">
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox x:Name="IconIsAdmin" Style="{StaticResource MyCheckBoxStyle}"
Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
<TextBlock Text="启动参数:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="StartArg" Text="{Binding StartArg, Mode=OneWay}" Width="230" Height="100" TextWrapping="Wrap" FontSize="14"/>
<TextBox x:Name="StartArg" Style="{StaticResource MyTextBoxStyle}" Text="{Binding StartArg, Mode=OneWay}" Width="230" Height="100" TextWrapping="Wrap" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Margin="0,25,0,0" Spacing="10" Grid.ColumnSpan="4">
<Button Content="保存" Style="{StaticResource Btn1}" Click="SaveProperty" Margin="265,10,0,0"/>
<Button Content="保存" Style="{StaticResource MyBtnStyle}" Click="SaveProperty" Margin="265,10,0,0"/>
</hc:UniformSpacingPanel>
</StackPanel>
</hc:SimplePanel>

View File

@@ -23,23 +23,23 @@
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
<TextBox x:Name="IconName" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
<TextBlock Text="Url:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="IconUrl" Text="{Binding Path, Mode=OneWay}" Width="180" FontSize="14"/>
<TextBox x:Name="IconUrl" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Path, Mode=OneWay}" Width="180" FontSize="14"/>
</hc:UniformSpacingPanel>
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
<Button Content="修改" Click="EditImage"/>
<Button Content="重置" Click="ReStoreImage"/>
<Button Style="{StaticResource MyBtnStyle}" Content="修改" Click="EditImage"/>
<Button Style="{StaticResource MyBtnStyle}" Content="重置" Click="ReStoreImage"/>
</hc:UniformSpacingPanel>
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
<hc:UniformSpacingPanel Spacing="10">
<Button Content="保存" Click="SaveProperty" Style="{StaticResource Btn1}" Margin="224,-10,-224,0" />
<Button Content="保存" Click="SaveProperty" Style="{StaticResource MyBtnStyle}" Margin="224,-10,-224,0" />
</hc:UniformSpacingPanel>
</StackPanel>
</hc:SimplePanel>

View File

@@ -1,4 +1,5 @@
using GeekDesk.Control.Windows;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using System;
using System.Reflection;
@@ -64,14 +65,15 @@ namespace GeekDesk.Control.Other
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
SolidColorBrush scb = MyColorPicker.SelectedBrush;
Color c = scb.Color;
switch (colorType)
{
case ColorType.COLOR_1:
appConfig.GradientBGParam.Color1 = scb.ToString(); break;
appConfig.GradientBGParam.Color1 = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
case ColorType.COLOR_2:
appConfig.GradientBGParam.Color2 = scb.ToString(); break;
appConfig.GradientBGParam.Color2 = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
default:
appConfig.TextColor = scb.ToString(); break;
appConfig.TextColor = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
}
}

View File

@@ -64,7 +64,7 @@
</Grid>
<Grid Height="65" x:Name="HintGrid" Visibility="Collapsed" Margin="0,20,0,0" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, Event=Visibility}">
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Top" HorizontalAlignment="Center">
<hc:TextBox x:Name="HintBox" TextAlignment="Left" Width="220"/>
<hc:TextBox Style="{StaticResource MyTextBoxStyle}" x:Name="HintBox" TextAlignment="Left" Width="220"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="202,35,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
<TextBlock Text="跳过" MouseLeftButtonDown="NextTB_MouseLeftButtonDown" Style="{StaticResource NextTB}"/>

View File

@@ -105,6 +105,7 @@ namespace GeekDesk.Control.Other
if (!string.IsNullOrEmpty(appData.AppConfig.PasswordHint))
{
//显示提示信息
HintMsg.Text = "提示: " + appData.AppConfig.PasswordHint;
HintMsg.Visibility = Visibility.Visible;
}
}
@@ -169,7 +170,11 @@ namespace GeekDesk.Control.Other
new Thread(() =>
{
Thread.Sleep(time);
try
{
Dispatcher.Invoke(() =>
{
try
{
if (string.IsNullOrEmpty(P1.Password))
{
@@ -187,7 +192,11 @@ namespace GeekDesk.Control.Other
return;
}
P4.Focus();
}
catch (Exception ex) { }
});
}
catch (Exception e2) { }
}).Start();
}

View File

@@ -0,0 +1,196 @@
<UserControl x:Class="GeekDesk.Control.Other.SearchResControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GeekDesk.Control.Other"
xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:cst="clr-namespace:GeekDesk.Constant"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
>
<UserControl.Resources>
<Style x:Key="SearchListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border>
<Border.Style>
<Style TargetType="Border">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</Border.Style>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<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="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
<Setter Property="Source" Value="{Binding BitmapImage}"/>
</Style>
<Style x:Key="ImageStyleNoWrite" TargetType="Image">
<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="Source" Value="{Binding BitmapImage_NoWrite}"/>
</Style>
<cvt:OpcityConvert x:Key="OpcityConvert"/>
<cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
</UserControl.Resources>
<Grid>
<Grid>
<WrapPanel Orientation="Horizontal"
Margin="10"
Panel.ZIndex="1"
>
<UniformGrid x:Name="VerticalUFG"
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, Event=Loaded}"
xf:Animations.Secondary="{xf:Animate BasedOn={StaticResource FadeOut}, Event=None}"
xf:Animations.SecondaryBinding="{Binding Visibility,
Converter={StaticResource Visibility2BooleanConverter}, ConverterParameter='reverse',
ElementName=VerticalUFG}"
>
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
<ListBox VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
VirtualizingPanel.ScrollUnit="Pixel"
ItemsSource="{Binding}"
BorderThickness="0"
Padding="0,10,0,0"
x:Name="SearchListBox"
SelectionChanged="SearchListBox_SelectionChanged"
>
<ListBox.Template>
<ControlTemplate TargetType="ListBox">
<hc:ScrollViewer
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Auto"
IsInertiaEnabled="True"
CanContentScroll="True"
PreviewMouseWheel="VerticalIconList_PreviewMouseWheel"
ScrollChanged="VerticalCard_ScrollChanged"
>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
<ItemsPresenter/>
</Border>
</hc:ScrollViewer>
</ControlTemplate>
</ListBox.Template>
<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="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
</ContextMenu>
</ListBox.Resources>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource SearchListBoxItemStyle}">
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel
Orientation="Vertical"
Background="#00FFFFFF"
VirtualizationMode="Recycling"
IsVirtualizing="True"
IsContainerVirtualizable="True"
VirtualizingPanel.ScrollUnit="Pixel"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border CornerRadius="8">
<Border.Style>
<Style TargetType="Border">
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem }}}"
Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.68"/>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<WrapPanel Tag="{Binding}"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF}}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
hc:Poptip.HitMode="None"
hc:Poptip.Placement="BottomLeft"
Background="#00FFFFFF"
MouseEnter="SearchIcon_MouseEnter"
MouseLeave="SearchIcon_MouseLeave"
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
MouseMove="SearchIcon_MouseMove"
Margin="25,10,0,10"
>
<Image Style="{StaticResource ImageStyleNoWrite}" RenderOptions.BitmapScalingMode="HighQuality"/>
<StackPanel Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF_TEXT}}" >
<TextBlock
Margin="10,5,0,0"
MaxHeight="40"
FontSize="13"
TextTrimming="CharacterEllipsis"
TextAlignment="Left"
VerticalAlignment="Center"
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
Text="{Binding Name}"/>
<TextBlock
Margin="10,10,0,0"
MaxHeight="40"
FontSize="11"
TextTrimming="CharacterEllipsis"
TextAlignment="Left"
VerticalAlignment="Center"
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
Text="{Binding Path}"/>
</StackPanel>
</WrapPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--</hc:TransitioningContentControl>-->
</UniformGrid>
</WrapPanel>
</Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,331 @@
using GeekDesk.Constant;
using GeekDesk.Control.Windows;
using GeekDesk.Plugins.EveryThing;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using GeekDesk.ViewModel.Temp;
using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
namespace GeekDesk.Control.Other
{
/// <summary>
/// SearchResControl.xaml 的交互逻辑
/// </summary>
public partial class SearchResControl : UserControl
{
public SearchResControl(ObservableCollection<IconInfo> iconList)
{
this.DataContext = iconList;
InitializeComponent();
}
public void SearchListBoxIndexAdd()
{
//控制移动后 鼠标即使在图标上也不显示popup
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
if (SearchListBox.Items.Count > 0)
{
if (SearchListBox.SelectedIndex < SearchListBox.Items.Count - 1)
{
SearchListBox.SelectedIndex += 1;
}
}
}
public void SearchListBoxIndexSub()
{
//控制移动后 鼠标即使在图标上也不显示popup
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
if (SearchListBox.Items.Count > 0)
{
if (SearchListBox.SelectedIndex > 0)
{
SearchListBox.SelectedIndex -= 1;
}
}
}
public void StartupSelectionItem()
{
if (SearchListBox.SelectedItem != null)
{
IconInfo icon = SearchListBox.SelectedItem as IconInfo;
if (icon.AdminStartUp)
{
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
}
private void SearchListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
SearchListBox.ScrollIntoView(SearchListBox.SelectedItem);
}
/// <summary>
/// 查询结果ICON鼠标移动事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchIcon_MouseMove(object sender, MouseEventArgs e)
{
//控制首次刷新搜索结果后, 鼠标首次移动后显示popup
RunTimeStatus.MOUSE_MOVE_COUNT++;
//防止移动后不刷新popup content
IconInfo info = (sender as Panel).Tag as IconInfo;
MainWindow.mainWindow.RightCard.MyPoptipContent.Text = info.Content;
MainWindow.mainWindow.RightCard.MyPoptip.VerticalOffset = 30;
if (RunTimeStatus.MOUSE_MOVE_COUNT > 1 && !RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = true;
}
}
/// <summary>
/// 查询结果 ICON 鼠标进入事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchIcon_MouseEnter(object sender, MouseEventArgs e)
{
//显示popup
RunTimeStatus.MOUSE_ENTER_ICON = true;
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
new Thread(() =>
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
IconInfo info = (sender as Panel).Tag as IconInfo;
MainWindow.mainWindow.RightCard.MyPoptipContent.Text = info.Content;
MainWindow.mainWindow.RightCard.MyPoptip.VerticalOffset = 30;
Thread.Sleep(100);
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL && RunTimeStatus.MOUSE_MOVE_COUNT > 1)
{
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = true;
}
}));
}).Start();
}
}
/// <summary>
/// 查询结果ICON鼠标离开事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchIcon_MouseLeave(object sender, MouseEventArgs e)
{
RunTimeStatus.MOUSE_ENTER_ICON = false;
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
}
/// <summary>
/// 搜索结果icon 列表鼠标滚轮预处理时间
/// 主要使用自定义popup解决卡顿问题解决卡顿问题
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void VerticalIconList_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
//控制在滚动时不显示popup 否则会在低GPU性能机器上造成卡顿
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
if (RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 500;
}
else
{
RunTimeStatus.ICONLIST_MOUSE_WHEEL = true;
new Thread(() =>
{
while (RunTimeStatus.MOUSE_WHEEL_WAIT_MS > 0)
{
Thread.Sleep(1);
RunTimeStatus.MOUSE_WHEEL_WAIT_MS -= 1;
}
if (RunTimeStatus.MOUSE_ENTER_ICON)
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = true;
}));
}
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 100;
RunTimeStatus.ICONLIST_MOUSE_WHEEL = false;
}).Start();
}
}
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (MainWindow.appData.AppConfig.DoubleOpen)
{
IconClick(sender, e);
}
}
private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (!MainWindow.appData.AppConfig.DoubleOpen)
{
IconClick(sender, e);
}
}
/// <summary>
/// 图标点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void IconClick(object sender, MouseButtonEventArgs e)
{
if (MainWindow.appData.AppConfig.DoubleOpen && e.ClickCount >= 2)
{
IconInfo icon = (IconInfo)((Panel)sender).Tag;
if (icon.AdminStartUp)
{
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
else if (!MainWindow.appData.AppConfig.DoubleOpen && e.ClickCount == 1)
{
IconInfo icon = (IconInfo)((Panel)sender).Tag;
if (icon.AdminStartUp)
{
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
}
private static volatile bool EveryThingRuning = false;
private void VerticalCard_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
if (MainWindow.appData.AppConfig.EnableEveryThing == true && EveryThingUtil.HasNext())
{
HandyControl.Controls.ScrollViewer sv = sender as HandyControl.Controls.ScrollViewer;
if (sv.ExtentHeight - (sv.ActualHeight + sv.VerticalOffset) < 100
&& EveryThingUtil.HasNext()
&& !EveryThingRuning)
{
EveryThingRuning = true;
MainWindow.mainWindow.RightCard.Loading_RightCard.Visibility = Visibility.Visible;
int everyThingCount = Convert.ToInt32(MainWindow.mainWindow.EverythingSearchCount.Text);
ObservableCollection<IconInfo> resList = this.DataContext as ObservableCollection<IconInfo>;
ThreadPool.QueueUserWorkItem(state =>
{
ObservableCollection<IconInfo> searchRes = EveryThingUtil.NextPage();
this.Dispatcher.Invoke(() =>
{
everyThingCount += searchRes.Count;
MainWindow.mainWindow.EverythingSearchCount.Text = Convert.ToString(everyThingCount);
foreach (IconInfo info in searchRes)
{
resList.Add(info);
}
MainWindow.mainWindow.RightCard.Loading_RightCard.Visibility = Visibility.Collapsed;
EveryThingRuning = false;
});
});
}
}
}
/// <summary>
/// 管理员方式启动
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void IconAdminStart(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
/// <summary>
/// 打开文件所在位置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ShowInExplore(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
ProcessUtil.StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
}
private void SystemContextMenu(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
DirectoryInfo[] folders = new DirectoryInfo[1];
folders[0] = new DirectoryInfo(icon.Path);
ShellContextMenu scm = new ShellContextMenu();
System.Drawing.Point p = System.Windows.Forms.Cursor.Position;
p.X -= 80;
p.Y -= 80;
scm.ShowContextMenu(folders, p);
}
}
}

View File

@@ -52,6 +52,7 @@
<hc:Poptip.Content>
<Image x:Name="PublicWeChat" Width="150" Height="150" />
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</hc:Shield>
@@ -79,10 +80,10 @@
<!--<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"
Style="{StaticResource MyRadioBtnStyle}" 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"
Style="{StaticResource MyRadioBtnStyle}" Content="GitHub"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>-->
</StackPanel>

View File

@@ -25,63 +25,36 @@
<TextBlock Text="面板动作设置" VerticalAlignment="Center"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
x:Name="IconIsAdmin"
Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="鼠标中键呼出" Click="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
Content="鼠标中键呼出"
Click="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="双击启动" IsChecked="{Binding DoubleOpen}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
Content="双击启动" IsChecked="{Binding DoubleOpen}"/>
</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>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
Content="悬停切换菜单" IsChecked="{Binding HoverMenu}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="贴边隐藏" IsChecked="{Binding MarginHide}" Click="MarginHide_Changed">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
Content="贴边隐藏" IsChecked="{Binding MarginHide}"
Click="MarginHide_Changed"/>
</hc:UniformSpacingPanel>
@@ -90,26 +63,34 @@
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}"
Content="失去焦点后"
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="运行项目后"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Content="运行项目后"
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=2}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="手动关闭"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Content="手动关闭"
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
<TextBlock Text="搜索方式" VerticalAlignment="Center"/>
<TextBlock Text="搜索方式"
VerticalAlignment="Center"
/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="快捷键"
<RadioButton Margin="10,0,0,0"
hc:Poptip.Content="主面板显示时按下Ctrl+F开始搜索"
hc:Poptip.Placement="Top"
Style="{StaticResource MyRadioBtnStyle}" Content="快捷键"
IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=0}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="按键即搜"
<RadioButton Margin="10,0,0,0"
hc:Poptip.Content="主面板显示时按下按键直接搜索"
hc:Poptip.Placement="Top"
Style="{StaticResource MyRadioBtnStyle}" Content="按键即搜"
IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=1}"/>
</hc:UniformSpacingPanel>
@@ -119,6 +100,7 @@
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="主面板:" VerticalAlignment="Center" Margin="0,5,0,0" Width="55"/>
<hc:TextBox HorizontalAlignment="Left"
Style="{StaticResource MyTextBoxStyle}"
Tag="{x:Static cst:HotKeyType.Main}"
VerticalAlignment="Top"
IsReadOnly="True"
@@ -129,20 +111,17 @@
KeyUp="HotKeyUp"
InputMethod.IsInputMethodEnabled="False"
/>
<CheckBox Content="启用"
Style="{StaticResource MyCheckBoxStyle}"
Click="EnableHotKey_Click"
Tag="{x:Static cst:HotKeyType.Main}"
IsChecked="{Binding EnableAppHotKey}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
IsChecked="{Binding EnableAppHotKey}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="待办任务:" Margin="0,5,0,0" Width="55"/>
<hc:TextBox HorizontalAlignment="Left"
Style="{StaticResource MyTextBoxStyle}"
Tag="{x:Static cst:HotKeyType.ToDo}"
VerticalAlignment="Top"
IsReadOnly="True"
@@ -153,21 +132,18 @@
KeyUp="HotKeyUp"
InputMethod.IsInputMethodEnabled="False"
/>
<CheckBox Content="启用"
Style="{StaticResource MyCheckBoxStyle}"
Click="EnableHotKey_Click"
Tag="{x:Static cst:HotKeyType.ToDo}"
IsChecked="{Binding EnableTodoHotKey}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
IsChecked="{Binding EnableTodoHotKey}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="拾色器:" Margin="0,5,0,0" Width="55"/>
<hc:TextBox HorizontalAlignment="Left"
Style="{StaticResource MyTextBoxStyle}"
Tag="{x:Static cst:HotKeyType.ColorPicker}"
VerticalAlignment="Top"
IsReadOnly="True"
@@ -179,15 +155,10 @@
InputMethod.IsInputMethodEnabled="False"
/>
<CheckBox Content="启用"
Style="{StaticResource MyCheckBoxStyle}"
Tag="{x:Static cst:HotKeyType.ColorPicker}"
Click="EnableHotKey_Click"
IsChecked="{Binding EnableColorPickerHotKey}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
IsChecked="{Binding EnableColorPickerHotKey}"/>
</hc:UniformSpacingPanel>
</StackPanel>
</Grid>

View File

@@ -315,14 +315,17 @@ namespace GeekDesk.Control.UserControls.Config
/// <param name="e"></param>
private void MouseMiddle_Changed(object sender, RoutedEventArgs e)
{
if (appConfig.MouseMiddleShow)
{
MouseHookThread.MiddleHook();
}
else
{
//if (appConfig.MouseMiddleShow)
//{
// MouseHookThread.MiddleHook();
//}
//else
//{
// MouseHookThread.DisposeMiddle();
//}
MouseHookThread.Dispose();
}
MouseHookThread.Hook();
}
/// <summary>
@@ -339,7 +342,8 @@ namespace GeekDesk.Control.UserControls.Config
if (true == appConfig.EnableAppHotKey)
{
MainWindow.RegisterHotKey(false);
} else
}
else
{
if (MainWindow.hotKeyId != -1)
{

View File

@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
mc:Ignorable="d"
Background="Transparent"
d:DesignHeight="400" d:DesignWidth="500"
@@ -20,61 +20,71 @@
<StackPanel >
<TextBlock Text="程序设置" />
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<CheckBox x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
<CheckBox Content="性能模式" IsChecked="{Binding PMModel}"
<CheckBox Content="性能模式"
Style="{StaticResource MyCheckBoxStyle}"
IsChecked="{Binding PMModel}"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="开启性能模式将取消图标动画效果"
hc:Poptip.Placement="TopLeft">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
hc:Poptip.Placement="Top"
/>
</hc:UniformSpacingPanel>
<TextBlock Text="插件" Margin="0,20,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
<CheckBox Content="时钟显秒"
Style="{StaticResource MyCheckBoxStyle}"
Click="ShowSeconds_Click" IsChecked="{Binding SecondsWindow}"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="仅Win11有效"
hc:Poptip.Placement="Top"
/>
<CheckBox Content="EveryThing搜索"
Style="{StaticResource MyCheckBoxStyle}"
Click="EveryThing_Changed" IsChecked="{Binding EnableEveryThing}"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="勾选后若弹出用户帐户控制请选择是"
hc:Poptip.Placement="Top"
/>
</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="自定义"
<RadioButton x:Name="CustomSort" Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" 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}"
<RadioButton x:Name="CountUpSort" Margin="10,0,0,0"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
Style="{StaticResource MyRadioBtnStyle}" 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}"
<RadioButton x:Name="CountLowSort" Margin="10,0,0,0" Visibility="Collapsed"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
Style="{StaticResource MyRadioBtnStyle}" 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}"
<RadioButton x:Name="NameUpSort" Margin="10,0,0,0"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Style="{StaticResource MyRadioBtnStyle}" 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}"
<RadioButton x:Name="NameLowSort" Margin="10,0,0,0" Visibility="Collapsed"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Style="{StaticResource MyRadioBtnStyle}" Content="名称"
Tag="5"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=5}"/>
@@ -82,14 +92,14 @@
</hc:UniformSpacingPanel>
<TextBlock Text="更新源" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Content="Gitee"
hc:IconElement.Geometry="{StaticResource Gitee}"
Foreground="#B32225"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
<RadioButton Margin="10,0,0,0"
hc:IconElement.Geometry="{StaticResource GitHub}"
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
Style="{StaticResource MyRadioBtnStyle}" Content="GitHub"
Foreground="Black"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
@@ -98,9 +108,9 @@
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<Button Content="备份数据"
hc:Poptip.Content="当数据文件损坏时, 以便能够恢复部分数据 (损坏时将有操作提示)"
hc:Poptip.Placement="TopLeft"
hc:Poptip.Offset="10"
Style="{StaticResource Btn1}"
hc:Poptip.Placement="Top"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
Style="{StaticResource MyBtnStyle}"
Click="BakDataFile"/>
</hc:UniformSpacingPanel>
</StackPanel>

View File

@@ -1,6 +1,13 @@
using GeekDesk.Constant;
using GeekDesk.MyThread;
using GeekDesk.Plugins.EveryThing;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using ShowSeconds;
using System;
using System.Diagnostics;
using System.IO;
using System.Management;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@@ -112,5 +119,88 @@ namespace GeekDesk.Control.UserControls.Config
{
CommonCode.BakAppData();
}
private void ShowSeconds_Click(object sender, RoutedEventArgs e)
{
if (MainWindow.appData.AppConfig.SecondsWindow == true)
{
//StartSecondsWindow();
SecondsWindow.ShowWindow();
}
else
{
SecondsWindow.CloseWindow();
//StopSecondsWindow();
}
}
public static void StopSecondsWindow()
{
if (MessageUtil.CheckWindowIsRuning("ShowSeconds_Main_" + Constants.MY_UUID))
{
MessageUtil.SendMsgByWName(
"ShowSeconds_Main_" + Constants.MY_UUID,
"Shutdown"
);
}
}
public static void StartSecondsWindow()
{
try
{
using (var objOS = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem"))
{
foreach (ManagementObject objMgmt in objOS.Get())
{
if (objMgmt.Properties["Caption"].Value != null)
{
string caption = objMgmt.Properties["Caption"].Value.ToString(); ;
LogUtil.WriteLog("获取的系统版本号为:" + caption);
if (caption.Contains("Windows 11"))
{
//找到ShowSeconds插件
FileInfo fi = FileUtil.GetFileByNameWithDir("ShowSeconds.exe", Constants.PLUGINS_PATH);
if (fi == null)
{
HandyControl.Controls.MessageBox.Show("未安装程序插件:ShowSeconds");
}
else
{
//检查是否在运行
if (!MessageUtil.CheckWindowIsRuning("ShowSeconds_Main_" + Constants.MY_UUID))
{
using (Process p = new Process())
{
p.StartInfo.FileName = fi.FullName;
p.StartInfo.WorkingDirectory = fi.FullName.Substring(0, fi.FullName.LastIndexOf("\\"));
p.Start();
}
}
}
}
}
}
}
}
catch (Exception ex) { }
}
/// <summary>
/// EveryThing插件开关
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void EveryThing_Changed(object sender, RoutedEventArgs e)
{
if (MainWindow.appData.AppConfig.EnableEveryThing == true)
{
EveryThingUtil.EnableEveryThing(0);
} else
{
EveryThingUtil.DisableEveryThing(true);
}
}
}
}

View File

@@ -24,11 +24,11 @@
<TextBlock Text="背景风格" VerticalAlignment="Center"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="图 片"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Click="BGStyle_Changed" Content="图 片"
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="纯 色"
<RadioButton Margin="10,0,0,0"
Style="{StaticResource MyRadioBtnStyle}" Click="BGStyle_Changed" Content="纯 色"
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
@@ -49,18 +49,12 @@
hc:Poptip.Content="{Binding BacImgName}"
hc:Poptip.Placement="TopLeft"
/>
<Button Content="修改" Click="BGButton_Click"/>
<Button Content="默认" Click="DefaultButton_Click"/>
<Button Content="修改" Style="{StaticResource MyBtnStyle}" Click="BGButton_Click"/>
<Button Content="默认" Style="{StaticResource MyBtnStyle}" Click="DefaultButton_Click"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="20,10,0,0" Grid.ColumnSpan="4">
<CheckBox x:Name="IconIsAdmin" Content="毛玻璃效果" Click="BGStyle_Changed" IsChecked="{Binding BlurEffect}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="IconIsAdmin" Content="毛玻璃效果" Click="BGStyle_Changed" IsChecked="{Binding BlurEffect}"/>
</hc:UniformSpacingPanel>
</StackPanel>
</hc:TransitioningContentControl>
@@ -82,7 +76,10 @@
Margin="0,5,0,0"
VerticalAlignment="Center"
/>
<Button Content="设置" Tag="Color1" Click="ColorButton_Click"/>
<Button Style="{StaticResource MyBtnStyle}"
Content="设置"
Tag="Color1"
Click="ColorButton_Click"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="色彩2:" VerticalAlignment="Center" Margin="0,5,0,0"/>
@@ -92,10 +89,15 @@
Margin="0,5,0,0"
VerticalAlignment="Center"
/>
<Button Content="设置" Tag="Color2" Click="ColorButton_Click"/>
<Button Style="{StaticResource MyBtnStyle}"
Content="设置" Tag="Color2"
Click="ColorButton_Click"
/>
</hc:UniformSpacingPanel>
<Button Content="系统预设"
Style="{StaticResource MyBtnStyle}"
Margin="0,5,0,0"
hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
@@ -111,41 +113,24 @@
<hc:Divider LineStrokeDashArray="3,3" Margin="0,0,0,0" Height="20" LineStroke="Black" Grid.ColumnSpan="1"/>
<hc:UniformSpacingPanel Spacing="10" Margin="5,-10,0,0" Grid.ColumnSpan="4">
<CheckBox Content="主窗口动画" IsChecked="{Binding AppAnimation}" Click="Animation_Checked">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Content="列表展开动画" IsChecked="{Binding ItemSpradeAnimation}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="置于顶层" IsChecked="{Binding AlwaysTopmost}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="主窗口动画" IsChecked="{Binding AppAnimation}" Click="Animation_Checked"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="列表展开动画" IsChecked="{Binding ItemSpradeAnimation}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}"/>
</hc:UniformSpacingPanel>
@@ -232,7 +217,7 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Foreground="{Binding TextColor}" Width="100"/>
<Button Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
<Button Style="{StaticResource MyBtnStyle}" Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
</hc:UniformSpacingPanel>
</StackPanel>
</Grid>

View File

@@ -49,7 +49,7 @@ namespace GeekDesk.Control.UserControls.Config
OpenFileDialog ofd = new OpenFileDialog
{
Multiselect = false, //只允许选中单个文件
Filter = "图像文件(*.png, *.jpg)|*.png;*.jpg;*.gif"
Filter = "图像文件(*.png, *.jpg, *.gif)|*.png;*.jpg;*.gif"
};
if (ofd.ShowDialog() == true)
{

View File

@@ -139,6 +139,7 @@
<hc:Card.ContextMenu>
<ContextMenu Width="200">
<MenuItem Header="新建菜单" Click="CreateMenu"/>
<MenuItem Header="新建关联菜单" Click="CreateLinkMenu"/>
<MenuItem x:Name="AlterPW1" Header="修改密码" Click="AlterPassword"/>
</ContextMenu>
</hc:Card.ContextMenu>
@@ -158,6 +159,7 @@
<ListBox.Resources>
<ContextMenu x:Key="MenuDialog" Width="200">
<MenuItem Header="新建菜单" Click="CreateMenu"/>
<MenuItem Header="新建关联菜单" Click="CreateLinkMenu"/>
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
<MenuItem Header="加密此列表" Click="EncryptMenu" Tag="{Binding}"/>
<MenuItem x:Name="AlterPW2" Header="修改密码" Click="AlterPassword"/>
@@ -184,7 +186,7 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Tag="{Binding}">
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
<TextBox Style="{StaticResource MyTextBoxStyle}" Text="{Binding Path=MenuName, Mode=TwoWay}"
HorizontalAlignment="Left"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
FontSize="16"
@@ -197,7 +199,11 @@
Padding="2"
BorderThickness="0"
IsVisibleChanged="MenuEditWhenVisibilityChanged"
Visibility="{Binding MenuEdit}"/>
Visibility="{Binding MenuEdit}">
<TextBox.Background>
<SolidColorBrush Color="White" Opacity="0.6" />
</TextBox.Background>
</TextBox>
<StackPanel Orientation="Horizontal"
IsVisibleChanged="MenuWhenVisibilityChanged"
Visibility="{Binding NotMenuEdit}">

View File

@@ -4,14 +4,19 @@ using GeekDesk.Control.Other;
using GeekDesk.Control.Windows;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Microsoft.Win32;
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using WindowsAPICodePack.Dialogs;
namespace GeekDesk.Control.UserControls.PannelCard
{
@@ -22,13 +27,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
private int menuSelectIndexTemp = -1;
private AppData appData = MainWindow.appData;
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(255, 255, 255));
public LeftCardControl()
{
InitializeComponent();
bac.Opacity = 0.6;
this.Loaded += (s, e) =>
{
@@ -160,6 +166,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
private void Lbi_Selected(object sender, RoutedEventArgs e)
{
try
{
ListBoxItem lbi = sender as ListBoxItem;
@@ -169,6 +177,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
lbi.Background = bac;
lbi.Foreground = fontColor;
}
catch { }
}
private void Lbi_MouseLeave(object sender, MouseEventArgs e)
{
@@ -195,6 +206,77 @@ namespace GeekDesk.Control.UserControls.PannelCard
Lbi_Selected(obj, null);
}
/// <summary>
/// 创建实时文件菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CreateLinkMenu(object sender, RoutedEventArgs e)
{
try
{
CommonOpenFileDialog dialog = new CommonOpenFileDialog
{
IsFolderPicker = true,
Title = "选择关联文件夹"
};
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
string menuId = System.Guid.NewGuid().ToString();
string path = dialog.FileName;
MenuInfo menuInfo = new MenuInfo
{
MenuName = Path.GetFileNameWithoutExtension(path),
MenuId = menuId,
MenuType = MenuType.LINK,
LinkPath = path,
IsEncrypt = false,
};
appData.MenuList.Add(menuInfo);
MenuListBox.SelectedIndex = appData.MenuList.Count - 1;
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
appData.AppConfig.SelectedMenuIcons = menuInfo.IconList;
//首次触发不了Selected事件
object obj = MenuListBox.ItemContainerGenerator.ContainerFromIndex(MenuListBox.SelectedIndex);
SetListBoxItemEvent((ListBoxItem)obj);
Lbi_Selected(obj, null);
HandyControl.Controls.Growl.Success("菜单关联成功, 加载列表中, 稍后重新进入此菜单可查看列表!", "MainWindowGrowl");
FileWatcher.LinkMenuWatcher(menuInfo);
new Thread(() =>
{
DirectoryInfo dirInfo = new DirectoryInfo(menuInfo.LinkPath);
FileSystemInfo[] fileInfos = dirInfo.GetFileSystemInfos();
ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
foreach (FileSystemInfo fileInfo in fileInfos)
{
IconInfo iconInfo = CommonCode.GetIconInfoByPath_NoWrite(fileInfo.FullName);
iconList.Add(iconInfo);
}
this.Dispatcher.Invoke(() =>
{
menuInfo.IconList = iconList;
//foreach (IconInfo iconInfo in iconList)
//{
// menuInfo.IconList = iconList;
//}
});
}).Start();
}
}
catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "新建关联菜单失败!");
HandyControl.Controls.Growl.WarningGlobal("新建关联菜单失败!");
}
}
/// <summary>
/// 重命名菜单 将textbox 设置为可见
@@ -215,7 +297,26 @@ namespace GeekDesk.Control.UserControls.PannelCard
/// <param name="e"></param>
private void DeleteMenu(object sender, RoutedEventArgs e)
{
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
if (menuInfo.IconList != null && menuInfo.IconList.Count > 0)
{
HandyControl.Controls.Growl.Ask("确认删除此菜单吗?", isConfirmed =>
{
if (isConfirmed)
{
DeleteMenu(menuInfo);
}
return true;
}, "MainWindowAskGrowl");
} else
{
DeleteMenu(menuInfo);
}
}
private void DeleteMenu(MenuInfo menuInfo)
{
if (appData.MenuList.Count == 1)
{
//如果删除以后没有菜单的话 先创建一个
@@ -329,6 +430,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
appData.AppConfig.SelectedMenuIcons = null;
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入密码";
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.INPUT;
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
}
else
@@ -338,6 +440,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
}
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Visible;
//App.DoEvents();
}
@@ -420,18 +523,28 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void Menu_MouseWheel(object sender, MouseWheelEventArgs e)
{
if (RunTimeStatus.IS_MENU_EDIT) return;
ScrollViewer scrollViewer = ScrollUtil.FindSimpleVisualChild<ScrollViewer>(MenuListBox);
if (e.Delta < 0)
{
//判断是否到了最底部
if (ScrollUtil.IsBootomScrollView(scrollViewer))
{
int index = MenuListBox.SelectedIndex;
if (index < MenuListBox.Items.Count - 1)
{
index++;
} else
}
else
{
index = 0;
}
MenuListBox.SelectedIndex = index;
} else if (e.Delta > 0)
}
}
else if (e.Delta > 0)
{
if (ScrollUtil.IsTopScrollView(scrollViewer))
{
int index = MenuListBox.SelectedIndex;
if (index > 0)
@@ -446,6 +559,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
}
//滚动到选中项
MenuListBox.ScrollIntoView(MenuListBox.SelectedItem);
}
private void Menu_PreviewDragLeave(object sender, DragEventArgs e)
{
@@ -465,15 +583,44 @@ namespace GeekDesk.Control.UserControls.PannelCard
MyPoptip.IsOpen = false;
}
/// <summary>
/// 拖动移动图标到指定菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Menu_Drop(object sender, DragEventArgs e)
{
MyPoptip.IsOpen = false;
MenuInfo mi = (sender as ListBoxItem).DataContext as MenuInfo;
IconInfo iconInfo = (IconInfo)e.Data.GetData(typeof(IconInfo));
if (iconInfo != null)
{
// 将已有图标移动到该菜单
appData.MenuList[MenuListBox.SelectedIndex].IconList.Remove(iconInfo);
appData.MenuList[MenuListBox.Items.IndexOf(mi)].IconList.Add(iconInfo);
}
else
{
// 直接将新图标移动到该菜单
Array dropObject = (System.Array)e.Data.GetData(DataFormats.FileDrop);
if (dropObject == null) return;
foreach (object obj in dropObject)
{
string path = (string)obj;
iconInfo = CommonCode.GetIconInfoByPath(path);
if (iconInfo == null)
{
LogUtil.WriteErrorLog("添加项目失败,未能获取到项目图标:" + path);
break;
}
appData.MenuList[MenuListBox.Items.IndexOf(mi)].IconList.Add(iconInfo);
}
CommonCode.SortIconList();
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
}
}
private void EncryptMenu(object sender, RoutedEventArgs e)
@@ -488,7 +635,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
//单独设置焦点
MainWindow.mainWindow.RightCard.PDDialog.SetFocus();
} else
}
else
{
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
{
@@ -533,7 +681,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
{
AlterPW1.Visibility = Visibility.Collapsed;
} else
}
else
{
AlterPW1.Visibility = Visibility.Visible;
}
@@ -566,7 +715,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (info.IsEncrypt)
{
mi.Header = "取消加密此列表";
} else
}
else
{
mi.Header = "加密此列表";
}
@@ -574,5 +724,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
}
}
}

View File

@@ -6,11 +6,14 @@
xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:cst="clr-namespace:GeekDesk.Constant"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
xmlns:component="clr-namespace:GeekDesk.CustomComponent.VirtualizingWrapPanel"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
xmlns:ot="clr-namespace:GeekDesk.Control.Other"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
AllowDrop="True"
>
<UserControl.Resources>
<!--右侧栏样式动画-->
@@ -26,6 +29,11 @@
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
<Setter Property="Source" Value="{Binding BitmapImage}"/>
</Style>
<Style x:Key="ImageStyleNoWrite" TargetType="Image">
<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="Source" Value="{Binding BitmapImage_NoWrite}"/>
</Style>
<Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Template">
@@ -58,6 +66,25 @@
</Setter>
</Style>
<Style x:Key="MyPoptipStyle" TargetType="Border">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
<!--<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="hc:Poptip">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
<ContentPresenter Margin="{TemplateBinding Padding}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>-->
</Style>
<Storyboard x:Key="Custom1Transition1" x:Shared="False">
<DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<DoubleAnimation.EasingFunction>
@@ -82,11 +109,23 @@
</Storyboard>
<cvt:OpcityConvert x:Key="OpcityConvert"/>
<cvt:SearchResWidth x:Key="SearchResWidth"/>
<cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
<temp:SearchIconList x:Key="SearchIconList"/>
</UserControl.Resources>
<!--右侧栏-->
<Grid>
<Popup Name="MyPoptip" FlowDirection="LeftToRight"
PopupAnimation="None" Placement="Mouse"
IsOpen="False"
AllowsTransparency="True"
>
<Grid Background="Transparent">
<Border Style="{StaticResource MyPoptipStyle}">
<TextBlock Name="MyPoptipContent" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Left" Text="Test" FontSize="13"/>
</Border>
</Grid>
</Popup>
<hc:Card AllowDrop="True"
x:Name="WrapCard"
Visibility="Visible"
@@ -96,6 +135,7 @@
Margin="5,0,5,5" Grid.ColumnSpan="2"
PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown"
hc:Dialog.Token="RightWrapCardDialog"
MouseWheel="IconListBox_MouseWheel"
>
<hc:Card.Background>
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
@@ -114,14 +154,14 @@
<Grid>
<ot:PasswordDialog xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility, Duration=50, Delay=0}"
x:Name="PDDialog"
Visibility="Collapsed"
Panel.ZIndex="99"
IsVisibleChanged="PDDialog_IsVisibleChanged"
Margin="0,-100,0,0"/>
<StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
<WrapPanel Orientation="Horizontal"
VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
Margin="10"
>
<UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
<!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
@@ -129,9 +169,32 @@
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
BorderThickness="0"
Padding="0,10,0,0"
ScrollViewer.CanContentScroll ="True"
VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
VirtualizingPanel.ScrollUnit="Pixel"
>
<ListBox.Template>
<ControlTemplate TargetType="ListBox">
<hc:ScrollViewer x:Name="WrapScroll"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Auto"
IsInertiaEnabled="True"
CanContentScroll="True"
PreviewMouseWheel="IconListBox_MouseWheel"
>
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderBrush}"
>
<ItemsPresenter/>
</Border>
</hc:ScrollViewer>
</ControlTemplate>
</ListBox.Template>
<ListBox.Background>
<SolidColorBrush Opacity="0"/>
<SolidColorBrush Color="#00FFFFFF" />
</ListBox.Background>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
@@ -140,7 +203,15 @@
ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
HorizontalAlignment="Center"
SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>-->
<WrapPanel />
<component:VirtualizingWrapPanel VirtualizationMode="Recycling"
IsVirtualizing="True"
IsContainerVirtualizable="True"
VirtualizingPanel.ScrollUnit="Pixel"
Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
Converter={StaticResource GetWidthByWWConvert},
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_70}}"
/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
@@ -169,11 +240,10 @@
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}"
HorizontalAlignment="Center"
hc:Poptip.Content="{Binding Content}"
hc:Poptip.Placement="BottomLeft"
Background="#00FFFFFF"
MouseEnter="StackPanel_MouseEnter"
MouseLeave="StackPanel_MouseLeave"
MouseEnter="MenuIcon_MouseEnter"
MouseLeave="MenuIcon_MouseLeave"
MouseMove="MenuIcon_MouseMove"
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
>
@@ -202,12 +272,14 @@
<!--</hc:TransitioningContentControl>-->
</UniformGrid>
</WrapPanel>
</Grid>
</hc:DialogContainer>
</hc:Card>
<hc:Card x:Name="VerticalCard"
Visibility="Hidden"
Visibility="Collapsed"
BorderThickness="1"
Effect="{DynamicResource EffectShadow2}"
Margin="5,0,5,5" Grid.ColumnSpan="2"
@@ -221,102 +293,16 @@
<hc:Card.BorderBrush>
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
</hc:Card.BorderBrush>
<Grid>
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsContainerVirtualizable="True"
>
<UniformGrid x:Name="VerticalUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, OffsetY= -10, Event=Visibility}">
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
BorderThickness="0"
Padding="0,10,0,0"
x:Name="SearchListBox"
SelectionChanged="SearchListBox_SelectionChanged"
>
<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 SearchListBoxItemStyle}">
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Background="#00FFFFFF"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=1}"
/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border CornerRadius="8">
<Border.Style>
<Style TargetType="Border">
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem }}}"
Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.68"/>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<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}, ConverterParameter=2}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
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,10,0,10"
>
<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>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--</hc:TransitioningContentControl>-->
</UniformGrid>
</WrapPanel>
</Grid>
</hc:Card>
<hc:LoadingCircle x:Name="Loading_RightCard"
Width="45" Height="45"
DotBorderBrush="White"
DotBorderThickness="2"
Foreground="DarkGray"
Opacity="0.8"
DotDiameter="10"
Margin="-50,-150,0,0"
Visibility="Collapsed"
/>
</Grid>
</UserControl>

View File

@@ -2,13 +2,16 @@
using GeekDesk.Constant;
using GeekDesk.Control.Other;
using GeekDesk.Control.Windows;
using GeekDesk.Plugins.EveryThing;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using GeekDesk.ViewModel.Temp;
using HandyControl.Controls;
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
@@ -123,16 +126,18 @@ namespace GeekDesk.Control.UserControls.PannelCard
/// <param name="e"></param>
private void IconClick(object sender, MouseButtonEventArgs e)
{
if (!RunTimeStatus.SEARCH_BOX_HIDED_300) return;
if (appData.AppConfig.DoubleOpen && e.ClickCount >= 2)
{
IconInfo icon = (IconInfo)((Panel)sender).Tag;
if (icon.AdminStartUp)
{
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
@@ -140,11 +145,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
IconInfo icon = (IconInfo)((Panel)sender).Tag;
if (icon.AdminStartUp)
{
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
@@ -158,7 +163,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void IconAdminStart(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
/// <summary>
@@ -169,226 +174,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void ShowInExplore(object sender, RoutedEventArgs e)
{
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
}
private void StartIconApp(IconInfo icon, IconStartType type, bool useRelativePath = false)
{
try
{
using (Process p = new Process())
{
string startArg = icon.StartArg;
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
{
StartSystemApp(startArg, type);
}
else
{
string path;
if (useRelativePath)
{
string fullPath = Path.Combine(Constants.APP_DIR, icon.RelativePath);
path = Path.GetFullPath(fullPath);
} else
{
path = icon.Path;
}
p.StartInfo.FileName = path;
if (!StringUtil.IsEmpty(startArg))
{
p.StartInfo.Arguments = startArg;
}
if (icon.IconType == IconType.OTHER)
{
if (!File.Exists(path) && !Directory.Exists(path))
{
//如果没有使用相对路径 那么使用相对路径启动一次
if (!useRelativePath)
{
StartIconApp(icon, type, true);
return;
} else
{
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
return;
}
}
p.StartInfo.WorkingDirectory = path.Substring(0, path.LastIndexOf("\\"));
switch (type)
{
case IconStartType.ADMIN_STARTUP:
//p.StartInfo.Arguments = "1";//启动参数
p.StartInfo.Verb = "runas";
//p.StartInfo.CreateNoWindow = false; //设置显示窗口
p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
//p.StartInfo.ErrorDialog = false;
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IsMargin())
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;// c#好像不能case穿透
case IconStartType.DEFAULT_STARTUP:
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IsMargin())
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;
case IconStartType.SHOW_IN_EXPLORE:
p.StartInfo.FileName = "Explorer.exe";
p.StartInfo.Arguments = "/e,/select," + icon.Path;
break;
}
}
else
{
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
}
p.Start();
if (useRelativePath)
{
//如果使用相对路径启动成功 那么重新设置程序绝对路径
icon.Path = path;
}
}
}
icon.Count++;
//隐藏搜索框
if (RunTimeStatus.SEARCH_BOX_SHOW)
{
MainWindow.mainWindow.HidedSearchBox();
}
}
catch (Exception e)
{
if (!useRelativePath)
{
StartIconApp(icon, type, true);
}
else
{
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(可能为不支持的启动方式)!");
LogUtil.WriteErrorLog(e, "程序启动失败:path=" + icon.Path + ",type=" + type);
}
}
}
private void StartSystemApp(string startArg, IconStartType type)
{
if (type == IconStartType.SHOW_IN_EXPLORE)
{
Growl.WarningGlobal("系统项目不支持打开文件位置操作!");
return;
}
switch (startArg)
{
case "Calculator":
Process.Start("calc.exe");
break;
case "Computer":
Process.Start("explorer.exe");
break;
case "GroupPolicy":
Process.Start("gpedit.msc");
break;
case "Notepad":
Process.Start("notepad");
break;
case "Network":
Process.Start("ncpa.cpl");
break;
case "RecycleBin":
Process.Start("shell:RecycleBinFolder");
break;
case "Registry":
Process.Start("regedit.exe");
break;
case "Mstsc":
if (type == IconStartType.ADMIN_STARTUP)
{
Process.Start("mstsc", "-admin");
}
else
{
Process.Start("mstsc");
}
break;
case "Control":
Process.Start("Control");
break;
case "CMD":
if (type == IconStartType.ADMIN_STARTUP)
{
using (Process process = new Process())
{
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Verb = "runas";
process.Start();
}
}
else
{
Process.Start("cmd");
}
break;
case "Services":
Process.Start("services.msc");
break;
}
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
ProcessUtil.StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
}
/// <summary>
@@ -453,38 +239,55 @@ namespace GeekDesk.Control.UserControls.PannelCard
}
}
private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
private void MenuIcon_MouseEnter(object sender, MouseEventArgs e)
{
RunTimeStatus.MOUSE_ENTER_ICON = true;
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
ThreadPool.QueueUserWorkItem(state =>
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
IconInfo info = (sender as Panel).Tag as IconInfo;
MyPoptipContent.Text = info.Content;
MyPoptip.VerticalOffset = 30;
Thread.Sleep(50);
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
MyPoptip.IsOpen = true;
}
}));
});
}
double width = appData.AppConfig.ImageWidth;
double height = appData.AppConfig.ImageHeight;
width += width * 0.15;
height += height * 0.15;
Thread t = new Thread(() =>
ThreadPool.QueueUserWorkItem(state =>
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
ImgStoryBoard(sender, (int)width, (int)height, 1, true);
}));
});
t.IsBackground = true;
t.Start();
}
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
private void MenuIcon_MouseLeave(object sender, MouseEventArgs e)
{
RunTimeStatus.MOUSE_ENTER_ICON = false;
MyPoptip.IsOpen = false;
Thread t = new Thread(() =>
ThreadPool.QueueUserWorkItem(state =>
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 260);
}));
});
t.IsBackground = true;
t.Start();
}
@@ -750,54 +553,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (RunTimeStatus.LOCK_APP_PANEL)
{
CardLockCM.Header = "解锁主面板";
} else
}
else
{
CardLockCM.Header = "锁定主面板";
}
}
public void SearchListBoxIndexAdd()
{
if (SearchListBox.Items.Count > 0)
{
if (SearchListBox.SelectedIndex < SearchListBox.Items.Count - 1)
{
SearchListBox.SelectedIndex += 1;
}
}
}
public void SearchListBoxIndexSub()
{
if (SearchListBox.Items.Count > 0)
{
if (SearchListBox.SelectedIndex > 0)
{
SearchListBox.SelectedIndex -= 1;
}
}
}
public void StartupSelectionItem()
{
if (SearchListBox.SelectedItem != null)
{
IconInfo icon = SearchListBox.SelectedItem as IconInfo;
if (icon.AdminStartUp)
{
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
}
else
{
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
}
private void SearchListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
SearchListBox.ScrollIntoView(SearchListBox.SelectedItem);
}
private void PDDialog_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
@@ -818,5 +581,108 @@ namespace GeekDesk.Control.UserControls.PannelCard
MainWindow.mainWindow.Focus();
}
}
/// <summary>
/// 菜单结果icon 列表鼠标滚轮预处理时间
/// 主要使用自定义popup解决卡顿问题解决卡顿问题
/// 以及滚动条首尾切换菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void IconListBox_MouseWheel(object sender, MouseWheelEventArgs e)
{
//控制在滚动时不显示popup 否则会在低GPU性能机器上造成卡顿
MyPoptip.IsOpen = false;
if (RunTimeStatus.ICONLIST_MOUSE_WHEEL)
{
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 500;
}
else
{
RunTimeStatus.ICONLIST_MOUSE_WHEEL = true;
new Thread(() =>
{
while (RunTimeStatus.MOUSE_WHEEL_WAIT_MS > 0)
{
Thread.Sleep(1);
RunTimeStatus.MOUSE_WHEEL_WAIT_MS -= 1;
}
if (RunTimeStatus.MOUSE_ENTER_ICON)
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
MyPoptip.IsOpen = true;
}));
}
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 100;
RunTimeStatus.ICONLIST_MOUSE_WHEEL = false;
}).Start();
}
//修改菜单时不切换菜单
if (RunTimeStatus.IS_MENU_EDIT) return;
//切换菜单
System.Windows.Controls.ScrollViewer scrollViewer = sender as System.Windows.Controls.ScrollViewer;
if (scrollViewer == null)
{
//在card 上获取的事件
scrollViewer = ScrollUtil.FindSimpleVisualChild<System.Windows.Controls.ScrollViewer>(IconListBox);
}
if (e.Delta < 0)
{
int index = MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex;
if (ScrollUtil.IsBootomScrollView(scrollViewer))
{
if (index < MainWindow.mainWindow.LeftCard.MenuListBox.Items.Count - 1)
{
index++;
}
else
{
index = 0;
}
MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex = index;
scrollViewer.ScrollToVerticalOffset(0);
}
}
else if (e.Delta > 0)
{
if (ScrollUtil.IsTopScrollView(scrollViewer))
{
int index = MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex;
if (index > 0)
{
index--;
}
else
{
index = MainWindow.mainWindow.LeftCard.MenuListBox.Items.Count - 1;
}
MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex = index;
scrollViewer.ScrollToVerticalOffset(0);
}
}
}
/// <summary>
/// menu结果ICON鼠标移动事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MenuIcon_MouseMove(object sender, MouseEventArgs e)
{
//防止移动后不刷新popup content
IconInfo info = (sender as Panel).Tag as IconInfo;
MyPoptipContent.Text = info.Content;
MyPoptip.VerticalOffset = 30;
}
}
}

View File

@@ -82,10 +82,36 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRow}">
<Border CornerRadius="8" MouseRightButtonDown="DataGridRow_MouseRightButtonDown" Margin="0,0,0,5" BorderBrush="Black" BorderThickness="0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border CornerRadius="8" MouseRightButtonDown="DataGridRow_MouseRightButtonDown" Margin="0,0,0,5" BorderBrush="Black" BorderThickness="0" SnapsToDevicePixels="True">
<Border.Style>
<Style TargetType="Border">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.6"/>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Opacity)">
<DoubleAnimation To="1" Duration="0:0:0"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Opacity)">
<DoubleAnimation To="0.6" Duration="0:0:0.5"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<SelectiveScrollingGrid>

View File

@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
xmlns:local="clr-namespace:GeekDesk"
xmlns:local="clr-namespace:GeekDesk" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
Title="Setting"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"

View File

@@ -1,5 +1,6 @@
using GeekDesk.Control.UserControls.Config;
using GeekDesk.Interface;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using HandyControl.Controls;
using System.Collections.Generic;
@@ -34,7 +35,7 @@ namespace GeekDesk.Control.Windows
//BG.Source = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
this.DataContext = appConfig;
RightCard.Content = about;
this.Topmost = true;
WindowUtil.SetOwner(this, mainWindow);
this.mainWindow = mainWindow;
UFG.Visibility = Visibility.Collapsed;
UFG.Visibility = Visibility.Visible;

View File

@@ -5,7 +5,9 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GeekDesk.Control.Windows"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
WindowStyle="None"
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent"
KeyDown="OnKeyDown"
@@ -14,8 +16,42 @@
Background="White"
Height="385"
Width="228">
<Grid>
<TextBlock Panel.ZIndex="1000" Text="❤❤❤"
x:Name="CopySuccess"
Visibility="Collapsed"
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndSlideFromBottom}, Duration=400, Event=None}"
xf:Animations.PrimaryBinding="{Binding CopyAnimation}"
Margin="138,300,0,0"
/>
<Button Height="32"
BorderThickness="0" Content="复 制"
Panel.ZIndex="999"
Margin="122,329,0,0"
HorizontalAlignment="Left"
Background="#BF8EF6"
Click="MyColorPicker_Confirmed"
VerticalAlignment="Top" Width="80"
>
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MyBtnStyle}">
</Style>
</Button.Style>
</Button>
<Button Height="32"
BorderThickness="0" Content="关 闭"
Panel.ZIndex="999" Margin="26,329,0,0"
Background="#EEEEEE"
Click="MyColorPicker_Canceled"
HorizontalAlignment="Left"
VerticalAlignment="Top" Width="80"
>
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MyBtnStyle}">
</Style>
</Button.Style>
</Button>
<StackPanel>
<Border MouseDown="DragMove"
VerticalAlignment="Top"
CornerRadius="8,8,0,0"
@@ -36,14 +72,12 @@
</Button>
</Border>
<hc:ColorPicker HorizontalAlignment="Center"
VerticalAlignment="Bottom"
SelectedColorChanged="MyColorPicker_SelectedColorChanged"
x:Name="MyColorPicker"
Confirmed="MyColorPicker_Confirmed"
Canceled="MyColorPicker_Canceled"
ToggleButton.Checked="MyColorPicker_Checked"/>
</StackPanel>
</Grid>
</Border>
</Window>

View File

@@ -1,5 +1,8 @@
using GeekDesk.Interface;
using GeekDesk.Util;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
@@ -14,10 +17,33 @@ namespace GeekDesk.Control.Windows
public partial class GlobalColorPickerWindow : IWindowCommon
{
PixelColorPickerWindow colorPickerWindow = null;
class PrivateDataContext : INotifyPropertyChanged
{
private bool copyAnimation = false;
public bool CopyAnimation
{
set
{
copyAnimation = value;
OnPropertyChanged("CopyAnimation");
}
get { return copyAnimation; }
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public GlobalColorPickerWindow()
{
this.Topmost = true;
InitializeComponent();
this.DataContext = new PrivateDataContext();
}
public void OnKeyDown(object sender, KeyEventArgs e)
@@ -35,14 +61,26 @@ namespace GeekDesk.Control.Windows
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MyColorPicker_Canceled(object sender, EventArgs e)
private void MyColorPicker_Canceled(object sender, RoutedEventArgs e)
{
MyColorPickerClose();
}
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
private void MyColorPicker_Confirmed(object sender, RoutedEventArgs e)
{
CopySuccess.Visibility = Visibility.Visible;
PrivateDataContext pdc = this.DataContext as PrivateDataContext;
pdc.CopyAnimation = true;
new Thread(() =>
{
Thread.Sleep(400);
this.Dispatcher.Invoke(() =>
{
pdc.CopyAnimation = false;
CopySuccess.Visibility = Visibility.Collapsed;
});
}).Start();
Color c = MyColorPicker.SelectedBrush.Color;
Clipboard.SetData(DataFormats.Text, string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", c.A, c.R, c.G, c.B));
Clipboard.SetData(DataFormats.Text, string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B));
}
/// <summary>
@@ -148,5 +186,28 @@ namespace GeekDesk.Control.Windows
{
this.Close();
}
private ICommand _hideCommand;
public ICommand HideCommand
{
get
{
if (_hideCommand == null)
{
_hideCommand = new RelayCommand(
p =>
{
return true;
},
p =>
{
//CopySuccess.Visibility = Visibility.Collapsed;
});
}
return _hideCommand;
}
}
}
}

View File

@@ -51,7 +51,7 @@
</Border.Background>-->
<hc:DialogContainer>
<Grid MouseDown="DragMove">
<TextBox x:Name="CheckSettingUrl" Visibility="Collapsed" Text="{Binding IsSettingUrl}" TextChanged="CheckSettingUrl_TextChanged"/>
<TextBox x:Name="CheckSettingUrl" Style="{StaticResource MyTextBoxStyle}" Visibility="Collapsed" Text="{Binding IsSettingUrl}" TextChanged="CheckSettingUrl_TextChanged"/>
<hc:TabControl x:Name="MyTabControl"
IsAnimationEnabled="True"
SelectionChanged="TabControl_SelectionChanged"
@@ -75,9 +75,9 @@
</hc:TabControl>
<Button Content="取消" Click="Close_Click" Margin="391,397.5,163,22.5"/>
<Button Content="自定义设置" Click="CustomButton_Click" IsEnabled="False" Name="CustomButton" Style="{StaticResource Btn1}" Margin="447,397.5,71,22.5"/>
<Button Content="确定" Click="Confirm_Click" Style="{StaticResource Btn1}" Margin="534,397.5,20,22.5" />
<Button Style="{StaticResource MyBtnStyle}" Content="取消" Click="Close_Click" Margin="391,397.5,163,22.5" />
<Button Style="{StaticResource MyBtnStyle}" Content="自定义设置" Click="CustomButton_Click" IsEnabled="False" Name="CustomButton" Margin="447,397.5,71,22.5"/>
<Button Style="{StaticResource MyBtnStyle}" Content="确定" Click="Confirm_Click" Margin="534,397.5,20,22.5" />
</Grid>
</hc:DialogContainer>
</Border>

View File

@@ -6,8 +6,10 @@
WindowStyle="None"
AllowsTransparency="True"
Background="Black"
ResizeMode="NoResize"
PreviewMouseMove="Window_PreviewMouseMove"
MouseLeftButtonDown="Window_MouseLeftButtonDown"
MouseRightButtonDown="Window_MouseRightButtonDown"
MouseWheel="Window_MouseWheel"
>
<Window.Resources>

View File

@@ -3,14 +3,17 @@ using GeekDesk.Util;
using HandyControl.Controls;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Cursors = System.Windows.Input.Cursors;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
namespace GeekDesk.Control.Windows
{
@@ -28,10 +31,19 @@ namespace GeekDesk.Control.Windows
private readonly ColorPicker colorPicker;
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
public PixelColorPickerWindow(ColorPicker colorPicker)
{
InitializeComponent();
this.colorPicker = colorPicker;
try
{
SetProcessDPIAware();
}
catch (Exception e) { }
ColorPickerWindow_Init();
}
@@ -40,27 +52,50 @@ namespace GeekDesk.Control.Windows
this.WindowState = WindowState.Normal;//还原窗口(非最小化和最大化)
this.Width = SystemParameters.VirtualScreenWidth;
this.Height = SystemParameters.VirtualScreenHeight;
var screens = Screen.AllScreens;
int allWidth = 0;
int allHeight = 0;
int x = 0;
int y = 0;
this.Left = SystemParameters.VirtualScreenLeft;
this.Top = SystemParameters.VirtualScreenTop;
//获取缩放比例
double scale = ScreenUtil.GetScreenScalingFactor();
foreach (var screen in screens)
{
var rect = screen.Bounds;
allWidth += rect.Width;
allHeight += rect.Height;
x = Math.Min(x, rect.X);
y = Math.Min(y, rect.Y);
}
//如果主显示器是最左边和最上边,则显示主显示器的缩放比例,反之则缩放比例不添加缩放比例
if (Screen.PrimaryScreen.Bounds.X != x || Screen.PrimaryScreen.Bounds.Y != y)
{
scale = 1;
}
this.Width = allWidth;
this.Height = allHeight;
this.Left = x;
this.Top = y;
DesktopBG.Width = this.Width;
DesktopBG.Height = this.Height;
this.Topmost = true;
bgBitmap = new System.Drawing.Bitmap(
(int)SystemParameters.VirtualScreenWidth,
(int)SystemParameters.VirtualScreenHeight,
(int)(Width * scale),
(int)(Height * scale),
System.Drawing.Imaging.PixelFormat.Format32bppArgb
);
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bgBitmap))
{
g.CopyFromScreen(
0,
0,
(int)this.Left,
(int)this.Top,
0,
0,
bgBitmap.Size
@@ -191,5 +226,17 @@ namespace GeekDesk.Control.Windows
SetPixelAbout(e);
}
/// <summary>
/// 右键按下
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Window_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
Mouse.OverrideCursor = null;
GlobalColorPickerWindow.ShowOrHide();
//关闭
this.Close();
}
}
}

View File

@@ -12,6 +12,7 @@
Width="510"
WindowStyle="None"
Title=""
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"
Focusable="True"
@@ -44,12 +45,13 @@
<TextBlock Text="待办任务:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red" />
</WrapPanel>
<TextBox x:Name="Title" Width="290" Text="{Binding Title, Mode=OneWay}" FontSize="14" />
<TextBox x:Name="Title" Style="{StaticResource MyTextBoxStyle}" Width="290" Text="{Binding Title, Mode=OneWay}" FontSize="14" />
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<TextBlock Text="待办详情:" Style="{StaticResource LeftTB}"/>
<TextBox x:Name="Msg" TextWrapping="Wrap"
Style="{StaticResource MyTextBoxStyle}"
Margin="5,0,0,0"
Text="{Binding Msg, Mode=OneWay}"
AcceptsReturn="True"
@@ -60,11 +62,11 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<TextBlock Text="运行方式:" Style="{StaticResource LeftTB}"/>
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Tag="1" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="指定时间"
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Tag="1"
Style="{StaticResource MyRadioBtnStyle}" Content="指定时间"
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Background="{DynamicResource SecondaryRegionBrush}" Tag="2"
Style="{StaticResource RadioButtonIcon}" Content="CRON表达式"
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Tag="2"
Style="{StaticResource MyRadioBtnStyle}" Content="CRON表达式"
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
@@ -73,7 +75,11 @@
<TextBlock Text="指定时间:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red"/>
</WrapPanel>
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="1.6,0,0,0"/>
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="1.6,0,0,0">
<hc:DateTimePicker.Background>
<SolidColorBrush Color="White" Opacity="0.7"/>
</hc:DateTimePicker.Background>
</hc:DateTimePicker>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel x:Name="CronPanel" Height="30" Visibility="Collapsed" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
@@ -81,7 +87,7 @@
<TextBlock Text="CRON:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red" />
</WrapPanel>
<TextBox x:Name="Cron" Width="290" Text="{Binding Cron, Mode=OneWay}" FontSize="14" />
<TextBox x:Name="Cron" Style="{StaticResource MyTextBoxStyle}" Width="290" Text="{Binding Cron, Mode=OneWay}" FontSize="14" />
</hc:UniformSpacingPanel>
@@ -95,7 +101,7 @@
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
<Button Content="保存" Style="{StaticResource Btn1}" Margin="320,6,-208,-10"
<Button Content="保存" Style="{StaticResource MyBtnStyle}" Margin="320,6,-208,-10"
Click="Save_Button_Click"/>
</hc:UniformSpacingPanel>
</StackPanel>

View File

@@ -10,6 +10,7 @@
Height="550"
Width="1000"
Title="Task"
ResizeMode="NoResize"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"
@@ -89,7 +90,7 @@
<Button Width="22" Height="22" Click="Close_Button_Click" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" Grid.Column="1"/>
<Button Content="新建待办"
Panel.ZIndex="1"
Style="{StaticResource Btn1}"
Style="{StaticResource MyBtnStyle}"
Grid.Column="1"
Margin="669,400,0,0"
Click="CreateBacklog_BtnClick" HorizontalAlignment="Left" VerticalAlignment="Top"/>

View File

@@ -2,6 +2,11 @@
using GeekDesk.Interface;
using GeekDesk.ViewModel;
using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using System.Windows;
using System.Windows.Input;
@@ -19,6 +24,7 @@ namespace GeekDesk.Control.Windows
InitializeComponent();
RightCard.Content = backlog;
backlog.BacklogList.ItemsSource = appData.ToDoList;
backlog.type = ToDoType.NEW;
this.Topmost = true;
if (backlog.BacklogList.Items.Count > 0)
{
@@ -63,12 +69,21 @@ namespace GeekDesk.Control.Windows
{
case "History":
UFG.Visibility = Visibility.Collapsed;
//排序历史待办 倒序
List<ToDoInfo> list = appData.HiToDoList.OrderByDescending(v=>v.DoneTime).ToList();
appData.HiToDoList.Clear();
foreach (var item in list)
{
appData.HiToDoList.Add(item);
}
backlog.BacklogList.ItemsSource = appData.HiToDoList;
if (backlog.BacklogList.Items.Count > 0)
{
backlog.NoData.Visibility = Visibility.Collapsed;
backlog.BacklogList.Visibility = Visibility.Visible;
} else
}
else
{
backlog.NoData.Visibility = Visibility.Visible;
backlog.BacklogList.Visibility = Visibility.Collapsed;
@@ -109,9 +124,7 @@ namespace GeekDesk.Control.Windows
private static System.Windows.Window window = null;
#pragma warning disable CS0108 // “ToDoWindow.Show()”隐藏继承的成员“Window.Show()”。如果是有意隐藏,请使用关键字 new。
public static void Show()
#pragma warning restore CS0108 // “ToDoWindow.Show()”隐藏继承的成员“Window.Show()”。如果是有意隐藏,请使用关键字 new。
{
if (window == null || !window.Activate())
{

View File

@@ -10,6 +10,7 @@
WindowStyle="None"
AllowsTransparency="True"
Title=""
ResizeMode="NoResize"
Background="Transparent" ShowInTaskbar="False"
Focusable="True"
KeyDown="OnKeyDown">
@@ -28,7 +29,7 @@
<TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
<Button HorizontalAlignment="Right" Margin="0,0,10,0"
Content="去点个Star" Click="StarBtnClick"
Style="{StaticResource Btn1}"
Style="{StaticResource MyBtnStyle}"
hc:IconElement.Geometry="M718.565517 863.126069c-7.344552 0-15.077517-2.189241-22.987034-6.285241L512 760.337655l-183.613793 96.503173c-18.785103 9.851586-37.499586 7.521103-48.16331-5.12-5.12-6.10869-10.557793-17.125517-7.485794-35.345656l35.063173-204.411586L159.249655 467.155862c-12.747034-12.393931-17.584552-27.153655-13.241379-40.430345 4.343172-13.312 16.913655-22.386759 34.568827-24.929103l205.223725-29.837242 91.806896-185.979586c7.874207-15.995586 20.409379-25.140966 34.392276-25.140965 13.947586 0 26.482759 9.145379 34.392276 25.140965l91.771586 185.979586 205.259035 29.837242c17.619862 2.577655 30.190345 11.652414 34.498206 24.964414 4.378483 13.27669-0.529655 28.001103-13.241379 40.430344l-148.51531 144.807725 35.063172 204.411586c3.10731 18.149517-2.365793 29.272276-7.485793 35.345655a32.273655 32.273655 0 0 1-25.176276 11.369931z"
/>
</hc:SimplePanel>
@@ -55,8 +56,8 @@
</hc:Card.Footer>
</hc:Card>
<hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
<Button Content="暂不更新" Click="Close_Click" Style="{StaticResource Btn1}"/>
<Button Content="前往更新" Click="Confirm_Click" Style="{StaticResource Btn1}"/>
<Button Style="{StaticResource MyBtnStyle}" Content="暂不更新" Click="Close_Click"/>
<Button Style="{StaticResource MyBtnStyle}" Content="前往更新" Click="Confirm_Click"/>
</hc:UniformSpacingPanel>
</StackPanel>

View File

@@ -0,0 +1,54 @@
using GeekDesk.Constant;
using GeekDesk.ViewModel;
using System;
using System.Globalization;
using System.Windows.Data;
namespace GeekDesk.Converts
{
/// <summary>
/// 根据主窗口width 和传入类型 获取其它宽度
/// </summary>
class GetWidthByWWConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
WidthTypeEnum type = (WidthTypeEnum)parameter;
AppConfig config = MainWindow.appData.AppConfig;
if (WidthTypeEnum.LEFT_CARD == type)
{
return config.MenuCardWidth;
}
else if (WidthTypeEnum.RIGHT_CARD == type)
{
return config.WindowWidth - config.MenuCardWidth;
} else if (WidthTypeEnum.RIGHT_CARD_HALF == type)
{
return (config.WindowWidth - config.MenuCardWidth) * 0.618;
} else if (WidthTypeEnum.RIGHT_CARD_HALF_TEXT == type)
{
return (config.WindowWidth - config.MenuCardWidth) * 0.618 - config.ImageWidth - 20;
} else if (WidthTypeEnum.RIGHT_CARD_20 == type)
{
return (config.WindowWidth - config.MenuCardWidth) - 20;
}
else if (WidthTypeEnum.RIGHT_CARD_40 == type)
{
return (config.WindowWidth - config.MenuCardWidth) - 40;
}
else if (WidthTypeEnum.RIGHT_CARD_70 == type)
{
return (config.WindowWidth - config.MenuCardWidth) - 70;
}
return config.WindowWidth;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}

View File

@@ -9,14 +9,14 @@ namespace GeekDesk.Converts
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((Visibility)value == Visibility.Visible)
if (parameter == null)
{
return true;
}
else
return (Visibility)value == Visibility.Visible;
} else
{
return false;
return !((Visibility)value == Visibility.Visible);
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
{
public struct ItemRange
{
public int StartIndex { get; }
public int EndIndex { get; }
public ItemRange(int startIndex, int endIndex) : this()
{
StartIndex = startIndex;
EndIndex = endIndex;
}
public bool Contains(int itemIndex)
{
return itemIndex >= StartIndex && itemIndex <= EndIndex;
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
{
public enum ScrollDirection
{
Vertical,
Horizontal
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
{
public enum SpacingMode
{
/// <summary>
/// Spacing is disabled and all items will be arranged as closely as possible.
/// </summary>
None,
/// <summary>
/// The remaining space is evenly distributed between the items on a layout row, as well as the start and end of each row.
/// </summary>
Uniform,
/// <summary>
/// The remaining space is evenly distributed between the items on a layout row, excluding the start and end of each row.
/// </summary>
BetweenItemsOnly,
/// <summary>
/// The remaining space is evenly distributed between start and end of each row.
/// </summary>
StartAndEndOnly
}
}

View File

@@ -0,0 +1,492 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls.Primitives;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows;
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
{
public abstract class VirtualizingPanelBase : VirtualizingPanel, IScrollInfo
{
public static readonly DependencyProperty ScrollLineDeltaProperty = DependencyProperty.Register(nameof(ScrollLineDelta), typeof(double), typeof(VirtualizingPanelBase), new FrameworkPropertyMetadata(16.0));
public static readonly DependencyProperty MouseWheelDeltaProperty = DependencyProperty.Register(nameof(MouseWheelDelta), typeof(double), typeof(VirtualizingPanelBase), new FrameworkPropertyMetadata(48.0));
public static readonly DependencyProperty ScrollLineDeltaItemProperty = DependencyProperty.Register(nameof(ScrollLineDeltaItem), typeof(int), typeof(VirtualizingPanelBase), new FrameworkPropertyMetadata(1));
public static readonly DependencyProperty MouseWheelDeltaItemProperty = DependencyProperty.Register(nameof(MouseWheelDeltaItem), typeof(int), typeof(VirtualizingPanelBase), new FrameworkPropertyMetadata(3));
private ScrollViewer scrollOwner;
public ScrollViewer GetScrollOwner()
{
return scrollOwner;
}
public void SetScrollOwner(ScrollViewer value)
{
scrollOwner = value;
}
public bool CanVerticallyScroll { get; set; }
public bool CanHorizontallyScroll { get; set; }
protected override bool CanHierarchicallyScrollAndVirtualizeCore => true;
/// <summary>
/// Scroll line delta for pixel based scrolling. The default value is 16 dp.
/// </summary>
public double ScrollLineDelta { get => (double)GetValue(ScrollLineDeltaProperty); set => SetValue(ScrollLineDeltaProperty, value); }
/// <summary>
/// Mouse wheel delta for pixel based scrolling. The default value is 48 dp.
/// </summary>
public double MouseWheelDelta { get => (double)GetValue(MouseWheelDeltaProperty); set => SetValue(MouseWheelDeltaProperty, value); }
/// <summary>
/// Scroll line delta for item based scrolling. The default value is 1 item.
/// </summary>
public double ScrollLineDeltaItem { get => (int)GetValue(ScrollLineDeltaItemProperty); set => SetValue(ScrollLineDeltaItemProperty, value); }
/// <summary>
/// Mouse wheel delta for item based scrolling. The default value is 3 items.
/// </summary>
public int MouseWheelDeltaItem { get => (int)GetValue(MouseWheelDeltaItemProperty); set => SetValue(MouseWheelDeltaItemProperty, value); }
protected ScrollUnit ScrollUnit => GetScrollUnit(ItemsControl);
/// <summary>
/// The direction in which the panel scrolls when user turns the mouse wheel.
/// </summary>
protected ScrollDirection MouseWheelScrollDirection { get; set; } = ScrollDirection.Vertical;
protected bool IsVirtualizing => GetIsVirtualizing(ItemsControl);
protected VirtualizationMode VirtualizationMode => GetVirtualizationMode(ItemsControl);
/// <summary>
/// Returns true if the panel is in VirtualizationMode.Recycling, otherwise false.
/// </summary>
protected bool IsRecycling => VirtualizationMode == VirtualizationMode.Recycling;
/// <summary>
/// The cache length before and after the viewport.
/// </summary>
protected VirtualizationCacheLength CacheLength { get; private set; }
/// <summary>
/// The Unit of the cache length. Can be Pixel, Item or Page.
/// When the ItemsOwner is a group item it can only be pixel or item.
/// </summary>
protected VirtualizationCacheLengthUnit CacheLengthUnit { get; private set; }
/// <summary>
/// The ItemsControl (e.g. ListView).
/// </summary>
protected ItemsControl ItemsControl => ItemsControl.GetItemsOwner(this);
/// <summary>
/// The ItemsControl (e.g. ListView) or if the ItemsControl is grouping a GroupItem.
/// </summary>
protected DependencyObject ItemsOwner
{
get
{
if (ItemsOwner1 is null)
{
/* Use reflection to access internal method because the public
* GetItemsOwner method does always return the itmes control instead
* of the real items owner for example the group item when grouping */
MethodInfo getItemsOwnerInternalMethod = typeof(ItemsControl).GetMethod(
"GetItemsOwnerInternal",
BindingFlags.Static | BindingFlags.NonPublic,
null,
new Type[] { typeof(DependencyObject) },
null
);
ItemsOwner1 = (DependencyObject)getItemsOwnerInternalMethod.Invoke(null, new object[] { this });
}
return ItemsOwner1;
}
}
private DependencyObject _itemsOwner;
protected ReadOnlyCollection<object> Items => ((ItemContainerGenerator)ItemContainerGenerator).Items;
protected new IRecyclingItemContainerGenerator ItemContainerGenerator
{
get
{
if (_itemContainerGenerator is null)
{
/* Because of a bug in the framework the ItemContainerGenerator
* is null until InternalChildren accessed at least one time. */
var children = InternalChildren;
_itemContainerGenerator = (IRecyclingItemContainerGenerator)base.ItemContainerGenerator;
}
return _itemContainerGenerator;
}
}
private IRecyclingItemContainerGenerator _itemContainerGenerator;
public double ExtentWidth => Extent.Width;
public double ExtentHeight => Extent.Height;
protected Size Extent { get; private set; } = new Size(0, 0);
public double HorizontalOffset => Offset.X;
public double VerticalOffset => Offset.Y;
protected Size Viewport { get; private set; } = new Size(0, 0);
public double ViewportWidth => Viewport.Width;
public double ViewportHeight => Viewport.Height;
protected Point Offset { get; private set; } = new Point(0, 0);
/// <summary>
/// The range of items that a realized in viewport or cache.
/// </summary>
protected ItemRange ItemRange { get; set; }
public ScrollViewer ScrollOwner { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public DependencyObject ItemsOwner1 { get => _itemsOwner; set => _itemsOwner = value; }
private Visibility previousVerticalScrollBarVisibility = Visibility.Collapsed;
private Visibility previousHorizontalScrollBarVisibility = Visibility.Collapsed;
protected virtual void UpdateScrollInfo(Size availableSize, Size extent)
{
bool invalidateScrollInfo = false;
if (extent != Extent)
{
Extent = extent;
invalidateScrollInfo = true;
}
if (availableSize != Viewport)
{
Viewport = availableSize;
invalidateScrollInfo = true;
}
if (ViewportHeight != 0 && VerticalOffset != 0 && VerticalOffset + ViewportHeight + 1 >= ExtentHeight)
{
Offset = new Point(Offset.X, extent.Height - availableSize.Height);
invalidateScrollInfo = true;
}
if (ViewportWidth != 0 && HorizontalOffset != 0 && HorizontalOffset + ViewportWidth + 1 >= ExtentWidth)
{
Offset = new Point(extent.Width - availableSize.Width, Offset.Y);
invalidateScrollInfo = true;
}
if (invalidateScrollInfo)
{
GetScrollOwner()?.InvalidateScrollInfo();
}
}
public virtual Rect MakeVisible(Visual visual, Rect rectangle)
{
Point pos = visual.TransformToAncestor(this).Transform(Offset);
double scrollAmountX = 0;
double scrollAmountY = 0;
if (pos.X < Offset.X)
{
scrollAmountX = -(Offset.X - pos.X);
}
else if ((pos.X + rectangle.Width) > (Offset.X + Viewport.Width))
{
double notVisibleX = (pos.X + rectangle.Width) - (Offset.X + Viewport.Width);
double maxScrollX = pos.X - Offset.X; // keep left of the visual visible
scrollAmountX = Math.Min(notVisibleX, maxScrollX);
}
if (pos.Y < Offset.Y)
{
scrollAmountY = -(Offset.Y - pos.Y);
}
else if ((pos.Y + rectangle.Height) > (Offset.Y + Viewport.Height))
{
double notVisibleY = (pos.Y + rectangle.Height) - (Offset.Y + Viewport.Height);
double maxScrollY = pos.Y - Offset.Y; // keep top of the visual visible
scrollAmountY = Math.Min(notVisibleY, maxScrollY);
}
SetHorizontalOffset(Offset.X + scrollAmountX);
SetVerticalOffset(Offset.Y + scrollAmountY);
double visibleRectWidth = Math.Min(rectangle.Width, Viewport.Width);
double visibleRectHeight = Math.Min(rectangle.Height, Viewport.Height);
return new Rect(scrollAmountX, scrollAmountY, visibleRectWidth, visibleRectHeight);
}
protected override void OnItemsChanged(object sender, ItemsChangedEventArgs args)
{
switch (args.Action)
{
case NotifyCollectionChangedAction.Remove:
case NotifyCollectionChangedAction.Replace:
RemoveInternalChildRange(args.Position.Index, args.ItemUICount);
break;
case NotifyCollectionChangedAction.Move:
RemoveInternalChildRange(args.OldPosition.Index, args.ItemUICount);
break;
}
}
protected int GetItemIndexFromChildIndex(int childIndex)
{
var generatorPosition = GetGeneratorPositionFromChildIndex(childIndex);
return ItemContainerGenerator.IndexFromGeneratorPosition(generatorPosition);
}
protected virtual GeneratorPosition GetGeneratorPositionFromChildIndex(int childIndex)
{
return new GeneratorPosition(childIndex, 0);
}
protected override Size MeasureOverride(Size availableSize)
{
/* Sometimes when scrolling the scrollbar gets hidden without any reason. In this case the "IsMeasureValid"
* property of the ScrollOwner is false. To prevent a infinite circle the mesasure call is ignored. */
if (GetScrollOwner() != null)
{
bool verticalScrollBarGotHidden = GetScrollOwner().VerticalScrollBarVisibility == ScrollBarVisibility.Auto
&& GetScrollOwner().ComputedVerticalScrollBarVisibility != Visibility.Visible
&& GetScrollOwner().ComputedVerticalScrollBarVisibility != previousVerticalScrollBarVisibility;
bool horizontalScrollBarGotHidden = GetScrollOwner().HorizontalScrollBarVisibility == ScrollBarVisibility.Auto
&& GetScrollOwner().ComputedHorizontalScrollBarVisibility != Visibility.Visible
&& GetScrollOwner().ComputedHorizontalScrollBarVisibility != previousHorizontalScrollBarVisibility;
previousVerticalScrollBarVisibility = GetScrollOwner().ComputedVerticalScrollBarVisibility;
previousHorizontalScrollBarVisibility = GetScrollOwner().ComputedHorizontalScrollBarVisibility;
if (!GetScrollOwner().IsMeasureValid && verticalScrollBarGotHidden || horizontalScrollBarGotHidden)
{
return availableSize;
}
}
var groupItem = ItemsOwner as IHierarchicalVirtualizationAndScrollInfo;
Size extent;
Size desiredSize;
if (groupItem != null)
{
/* If the ItemsOwner is a group item the availableSize is ifinity.
* Therfore the vieport size provided by the group item is used. */
var viewportSize = groupItem.Constraints.Viewport.Size;
var headerSize = groupItem.HeaderDesiredSizes.PixelSize;
double availableWidth = Math.Max(viewportSize.Width - 5, 0); // left margin of 5 dp
double availableHeight = Math.Max(viewportSize.Height - headerSize.Height, 0);
availableSize = new Size(availableWidth, availableHeight);
extent = CalculateExtent(availableSize);
desiredSize = new Size(extent.Width, extent.Height);
Extent = extent;
Offset = groupItem.Constraints.Viewport.Location;
Viewport = groupItem.Constraints.Viewport.Size;
CacheLength = groupItem.Constraints.CacheLength;
CacheLengthUnit = groupItem.Constraints.CacheLengthUnit; // can be Item or Pixel
}
else
{
extent = CalculateExtent(availableSize);
double desiredWidth = Math.Min(availableSize.Width, extent.Width);
double desiredHeight = Math.Min(availableSize.Height, extent.Height);
desiredSize = new Size(desiredWidth, desiredHeight);
UpdateScrollInfo(desiredSize, extent);
CacheLength = GetCacheLength(ItemsOwner);
CacheLengthUnit = GetCacheLengthUnit(ItemsOwner); // can be Page, Item or Pixel
}
ItemRange = UpdateItemRange();
RealizeItems();
VirtualizeItems();
return desiredSize;
}
/// <summary>
/// Realizes visible and cached items.
/// </summary>
protected virtual void RealizeItems()
{
var startPosition = ItemContainerGenerator.GeneratorPositionFromIndex(ItemRange.StartIndex);
int childIndex = startPosition.Offset == 0 ? startPosition.Index : startPosition.Index + 1;
using (ItemContainerGenerator.StartAt(startPosition, GeneratorDirection.Forward, true))
{
for (int i = ItemRange.StartIndex; i <= ItemRange.EndIndex; i++, childIndex++)
{
UIElement child = (UIElement)ItemContainerGenerator.GenerateNext(out bool isNewlyRealized);
if (isNewlyRealized || /*recycled*/!InternalChildren.Contains(child))
{
if (childIndex >= InternalChildren.Count)
{
AddInternalChild(child);
}
else
{
InsertInternalChild(childIndex, child);
}
ItemContainerGenerator.PrepareItemContainer(child);
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
}
if (child is IHierarchicalVirtualizationAndScrollInfo groupItem)
{
groupItem.Constraints = new HierarchicalVirtualizationConstraints(
new VirtualizationCacheLength(0),
VirtualizationCacheLengthUnit.Item,
new Rect(0, 0, ViewportWidth, ViewportHeight));
child.Measure(new Size(ViewportWidth, ViewportHeight));
}
}
}
}
/// <summary>
/// Virtualizes (cleanups) no longer visible or cached items.
/// </summary>
protected virtual void VirtualizeItems()
{
for (int childIndex = InternalChildren.Count - 1; childIndex >= 0; childIndex--)
{
var generatorPosition = GetGeneratorPositionFromChildIndex(childIndex);
int itemIndex = ItemContainerGenerator.IndexFromGeneratorPosition(generatorPosition);
if (itemIndex != -1 && !ItemRange.Contains(itemIndex))
{
if (VirtualizationMode == VirtualizationMode.Recycling)
{
ItemContainerGenerator.Recycle(generatorPosition, 1);
}
else
{
ItemContainerGenerator.Remove(generatorPosition, 1);
}
RemoveInternalChildRange(childIndex, 1);
}
}
}
/// <summary>
/// Calculates the extent that would be needed to show all items.
/// </summary>
protected abstract Size CalculateExtent(Size availableSize);
/// <summary>
/// Calculates the item range that is visible in the viewport or cached.
/// </summary>
protected abstract ItemRange UpdateItemRange();
public void SetVerticalOffset(double offset)
{
if (offset < 0 || Viewport.Height >= Extent.Height)
{
offset = 0;
}
else if (offset + Viewport.Height >= Extent.Height)
{
offset = Extent.Height - Viewport.Height;
}
Offset = new Point(Offset.X, offset);
GetScrollOwner()?.InvalidateScrollInfo();
InvalidateMeasure();
}
public void SetHorizontalOffset(double offset)
{
if (offset < 0 || Viewport.Width >= Extent.Width)
{
offset = 0;
}
else if (offset + Viewport.Width >= Extent.Width)
{
offset = Extent.Width - Viewport.Width;
}
Offset = new Point(offset, Offset.Y);
GetScrollOwner()?.InvalidateScrollInfo();
InvalidateMeasure();
}
protected void ScrollVertical(double amount)
{
SetVerticalOffset(VerticalOffset + amount);
}
protected void ScrollHorizontal(double amount)
{
SetHorizontalOffset(HorizontalOffset + amount);
}
public void LineUp() => ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? -ScrollLineDelta : GetLineUpScrollAmount());
public void LineDown() => ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? ScrollLineDelta : GetLineDownScrollAmount());
public void LineLeft() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? -ScrollLineDelta : GetLineLeftScrollAmount());
public void LineRight() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? ScrollLineDelta : GetLineRightScrollAmount());
public void MouseWheelUp()
{
if (MouseWheelScrollDirection == ScrollDirection.Vertical)
{
ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? -MouseWheelDelta : GetMouseWheelUpScrollAmount());
}
else
{
MouseWheelLeft();
}
}
public void MouseWheelDown()
{
if (MouseWheelScrollDirection == ScrollDirection.Vertical)
{
ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? MouseWheelDelta : GetMouseWheelDownScrollAmount());
}
else
{
MouseWheelRight();
}
}
public void MouseWheelLeft() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? -MouseWheelDelta : GetMouseWheelLeftScrollAmount());
public void MouseWheelRight() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? MouseWheelDelta : GetMouseWheelRightScrollAmount());
public void PageUp() => ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? -ViewportHeight : GetPageUpScrollAmount());
public void PageDown() => ScrollVertical(ScrollUnit == ScrollUnit.Pixel ? ViewportHeight : GetPageDownScrollAmount());
public void PageLeft() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? -ViewportHeight : GetPageLeftScrollAmount());
public void PageRight() => ScrollHorizontal(ScrollUnit == ScrollUnit.Pixel ? ViewportHeight : GetPageRightScrollAmount());
protected abstract double GetLineUpScrollAmount();
protected abstract double GetLineDownScrollAmount();
protected abstract double GetLineLeftScrollAmount();
protected abstract double GetLineRightScrollAmount();
protected abstract double GetMouseWheelUpScrollAmount();
protected abstract double GetMouseWheelDownScrollAmount();
protected abstract double GetMouseWheelLeftScrollAmount();
protected abstract double GetMouseWheelRightScrollAmount();
protected abstract double GetPageUpScrollAmount();
protected abstract double GetPageDownScrollAmount();
protected abstract double GetPageLeftScrollAmount();
protected abstract double GetPageRightScrollAmount();
}
}

View File

@@ -0,0 +1,474 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls.Primitives;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows;
using GeekDesk.CustomComponent.VirtualizingWrapPanel;
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
{
public class VirtualizingWrapPanel : VirtualizingPanelBase
{
#region Deprecated properties
[Obsolete("Use SpacingMode")]
public static readonly DependencyProperty IsSpacingEnabledProperty = DependencyProperty.Register(nameof(IsSpacingEnabled), typeof(bool), typeof(VirtualizingWrapPanel), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsMeasure));
[Obsolete("Use IsSpacingEnabled")]
public bool SpacingEnabled { get => IsSpacingEnabled; set => IsSpacingEnabled = value; }
/// <summary>
/// Gets or sets a value that specifies whether the items are distributed evenly across the width (horizontal orientation)
/// or height (vertical orientation). The default value is true.
/// </summary>
[Obsolete("Use SpacingMode")]
public bool IsSpacingEnabled { get => (bool)GetValue(IsSpacingEnabledProperty); set => SetValue(IsSpacingEnabledProperty, value); }
[Obsolete("Use ItemSize")]
public Size ChildrenSize { get => ItemSize; set => ItemSize = value; }
#endregion
public static readonly DependencyProperty SpacingModeProperty = DependencyProperty.Register(nameof(SpacingMode), typeof(SpacingMode), typeof(VirtualizingWrapPanel), new FrameworkPropertyMetadata(SpacingMode.Uniform, FrameworkPropertyMetadataOptions.AffectsMeasure));
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(nameof(Orientation), typeof(Orientation), typeof(VirtualizingWrapPanel), new FrameworkPropertyMetadata(Orientation.Vertical, FrameworkPropertyMetadataOptions.AffectsMeasure, (obj, args) => ((VirtualizingWrapPanel)obj).Orientation_Changed()));
public static readonly DependencyProperty ItemSizeProperty = DependencyProperty.Register(nameof(ItemSize), typeof(Size), typeof(VirtualizingWrapPanel), new FrameworkPropertyMetadata(Size.Empty, FrameworkPropertyMetadataOptions.AffectsMeasure));
public static readonly DependencyProperty StretchItemsProperty = DependencyProperty.Register(nameof(StretchItems), typeof(bool), typeof(VirtualizingWrapPanel), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsArrange));
/// <summary>
/// Gets or sets the spacing mode used when arranging the items. The default value is <see cref="SpacingMode.Uniform"/>.
/// </summary>
public SpacingMode SpacingMode { get => (SpacingMode)GetValue(SpacingModeProperty); set => SetValue(SpacingModeProperty, value); }
/// <summary>
/// Gets or sets a value that specifies the orientation in which items are arranged. The default value is <see cref="Orientation.Vertical"/>.
/// </summary>
public Orientation Orientation { get => (Orientation)GetValue(OrientationProperty); set => SetValue(OrientationProperty, value); }
/// <summary>
/// Gets or sets a value that specifies the size of the items. The default value is <see cref="Size.Empty"/>.
/// If the value is <see cref="Size.Empty"/> the size of the items gots measured by the first realized item.
/// </summary>
public Size ItemSize { get => (Size)GetValue(ItemSizeProperty); set => SetValue(ItemSizeProperty, value); }
/// <summary>
/// Gets or sets a value that specifies if the items get stretched to fill up remaining space. The default value is false.
/// </summary>
/// <remarks>
/// The MaxWidth and MaxHeight properties of the ItemContainerStyle can be used to limit the stretching.
/// In this case the use of the remaining space will be determined by the SpacingMode property.
/// </remarks>
public bool StretchItems { get => (bool)GetValue(StretchItemsProperty); set => SetValue(StretchItemsProperty, value); }
protected Size childSize;
protected int rowCount;
protected int itemsPerRowCount;
private void Orientation_Changed()
{
MouseWheelScrollDirection = Orientation == Orientation.Vertical ? ScrollDirection.Vertical : ScrollDirection.Horizontal;
}
protected override Size MeasureOverride(Size availableSize)
{
UpdateChildSize(availableSize);
return base.MeasureOverride(availableSize);
}
private void UpdateChildSize(Size availableSize)
{
if (ItemsOwner is IHierarchicalVirtualizationAndScrollInfo groupItem
&& VirtualizingPanel.GetIsVirtualizingWhenGrouping(ItemsControl))
{
if (Orientation == Orientation.Vertical)
{
availableSize.Width = groupItem.Constraints.Viewport.Size.Width;
availableSize.Width = Math.Max(availableSize.Width - (Margin.Left + Margin.Right), 0);
}
else
{
availableSize.Height = groupItem.Constraints.Viewport.Size.Height;
availableSize.Height = Math.Max(availableSize.Height - (Margin.Top + Margin.Bottom), 0);
}
}
if (ItemSize != Size.Empty)
{
childSize = ItemSize;
}
else if (InternalChildren.Count != 0)
{
childSize = InternalChildren[0].DesiredSize;
}
else
{
childSize = CalculateChildSize(availableSize);
}
if (double.IsInfinity(GetWidth(availableSize)))
{
itemsPerRowCount = Items.Count;
}
else
{
itemsPerRowCount = Math.Max(1, (int)Math.Floor(GetWidth(availableSize) / GetWidth(childSize)));
}
rowCount = (int)Math.Ceiling((double)Items.Count / itemsPerRowCount);
}
private Size CalculateChildSize(Size availableSize)
{
if (Items.Count == 0)
{
return new Size(0, 0);
}
var startPosition = ItemContainerGenerator.GeneratorPositionFromIndex(0);
using (ItemContainerGenerator.StartAt(startPosition, GeneratorDirection.Forward, true))
{
var child = (UIElement)ItemContainerGenerator.GenerateNext();
AddInternalChild(child);
ItemContainerGenerator.PrepareItemContainer(child);
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
return child.DesiredSize;
}
}
protected override Size CalculateExtent(Size availableSize)
{
double extentWidth = IsSpacingEnabled && SpacingMode != SpacingMode.None && !double.IsInfinity(GetWidth(availableSize))
? GetWidth(availableSize)
: GetWidth(childSize) * itemsPerRowCount;
if (ItemsOwner is IHierarchicalVirtualizationAndScrollInfo groupItem)
{
if (Orientation == Orientation.Vertical)
{
extentWidth = Math.Max(extentWidth - (Margin.Left + Margin.Right), 0);
}
else
{
extentWidth = Math.Max(extentWidth - (Margin.Top + Margin.Bottom), 0);
}
}
double extentHeight = GetHeight(childSize) * rowCount;
return CreateSize(extentWidth, extentHeight);
}
protected void CalculateSpacing(Size finalSize, out double innerSpacing, out double outerSpacing)
{
Size childSize = CalculateChildArrangeSize(finalSize);
double finalWidth = GetWidth(finalSize);
double totalItemsWidth = Math.Min(GetWidth(childSize) * itemsPerRowCount, finalWidth);
double unusedWidth = finalWidth - totalItemsWidth;
SpacingMode spacingMode = IsSpacingEnabled ? SpacingMode : SpacingMode.None;
switch (spacingMode)
{
case SpacingMode.Uniform:
innerSpacing = outerSpacing = unusedWidth / (itemsPerRowCount + 1);
break;
case SpacingMode.BetweenItemsOnly:
innerSpacing = unusedWidth / Math.Max(itemsPerRowCount - 1, 1);
outerSpacing = 0;
break;
case SpacingMode.StartAndEndOnly:
innerSpacing = 0;
outerSpacing = unusedWidth / 2;
break;
case SpacingMode.None:
default:
innerSpacing = 0;
outerSpacing = 0;
break;
}
}
protected override Size ArrangeOverride(Size finalSize)
{
double offsetX = GetX(Offset);
double offsetY = GetY(Offset);
/* When the items owner is a group item offset is handled by the parent panel. */
if (ItemsOwner is IHierarchicalVirtualizationAndScrollInfo groupItem)
{
offsetY = 0;
}
Size childSize = CalculateChildArrangeSize(finalSize);
CalculateSpacing(finalSize, out double innerSpacing, out double outerSpacing);
for (int childIndex = 0; childIndex < InternalChildren.Count; childIndex++)
{
UIElement child = InternalChildren[childIndex];
int itemIndex = GetItemIndexFromChildIndex(childIndex);
int columnIndex = itemIndex % itemsPerRowCount;
int rowIndex = itemIndex / itemsPerRowCount;
double x = outerSpacing + columnIndex * (GetWidth(childSize) + innerSpacing);
double y = rowIndex * GetHeight(childSize);
if (GetHeight(finalSize) == 0.0)
{
/* When the parent panel is grouping and a cached group item is not
* in the viewport it has no valid arrangement. That means that the
* height/width is 0. Therefore the items should not be visible so
* that they are not falsely displayed. */
child.Arrange(new Rect(0, 0, 0, 0));
}
else
{
child.Arrange(CreateRect(x - offsetX, y - offsetY, childSize.Width, childSize.Height));
}
}
return finalSize;
}
protected Size CalculateChildArrangeSize(Size finalSize)
{
if (StretchItems)
{
if (Orientation == Orientation.Vertical)
{
double childMaxWidth = ReadItemContainerStyle(MaxWidthProperty, double.PositiveInfinity);
double maxPossibleChildWith = finalSize.Width / itemsPerRowCount;
double childWidth = Math.Min(maxPossibleChildWith, childMaxWidth);
return new Size(childWidth, childSize.Height);
}
else
{
double childMaxHeight = ReadItemContainerStyle(MaxHeightProperty, double.PositiveInfinity);
double maxPossibleChildHeight = finalSize.Height / itemsPerRowCount;
double childHeight = Math.Min(maxPossibleChildHeight, childMaxHeight);
return new Size(childSize.Width, childHeight);
}
}
else
{
return childSize;
}
}
private T ReadItemContainerStyle<T>(DependencyProperty property, T fallbackValue)
{
var value = ItemsControl.ItemContainerStyle?.Setters.OfType<Setter>()
.FirstOrDefault(setter => setter.Property == property)?.Value;
return (T)(value ?? fallbackValue);
}
protected override ItemRange UpdateItemRange()
{
if (!IsVirtualizing)
{
return new ItemRange(0, Items.Count - 1);
}
int startIndex;
int endIndex;
if (ItemsOwner is IHierarchicalVirtualizationAndScrollInfo groupItem)
{
if (!VirtualizingPanel.GetIsVirtualizingWhenGrouping(ItemsControl))
{
return new ItemRange(0, Items.Count - 1);
}
var offset = new Point(Offset.X, groupItem.Constraints.Viewport.Location.Y);
int offsetRowIndex;
double offsetInPixel;
int rowCountInViewport;
if (ScrollUnit == ScrollUnit.Item)
{
offsetRowIndex = GetY(offset) >= 1 ? (int)GetY(offset) - 1 : 0; // ignore header
offsetInPixel = offsetRowIndex * GetHeight(childSize);
}
else
{
offsetInPixel = Math.Min(Math.Max(GetY(offset) - GetHeight(groupItem.HeaderDesiredSizes.PixelSize), 0), GetHeight(Extent));
offsetRowIndex = GetRowIndex(offsetInPixel);
}
double viewportHeight = Math.Min(GetHeight(Viewport), Math.Max(GetHeight(Extent) - offsetInPixel, 0));
rowCountInViewport = (int)Math.Ceiling((offsetInPixel + viewportHeight) / GetHeight(childSize)) - (int)Math.Floor(offsetInPixel / GetHeight(childSize));
startIndex = offsetRowIndex * itemsPerRowCount;
endIndex = Math.Min(((offsetRowIndex + rowCountInViewport) * itemsPerRowCount) - 1, Items.Count - 1);
if (CacheLengthUnit == VirtualizationCacheLengthUnit.Pixel)
{
double cacheBeforeInPixel = Math.Min(CacheLength.CacheBeforeViewport, offsetInPixel);
double cacheAfterInPixel = Math.Min(CacheLength.CacheAfterViewport, GetHeight(Extent) - viewportHeight - offsetInPixel);
int rowCountInCacheBefore = (int)(cacheBeforeInPixel / GetHeight(childSize));
int rowCountInCacheAfter = ((int)Math.Ceiling((offsetInPixel + viewportHeight + cacheAfterInPixel) / GetHeight(childSize))) - (int)Math.Ceiling((offsetInPixel + viewportHeight) / GetHeight(childSize));
startIndex = Math.Max(startIndex - rowCountInCacheBefore * itemsPerRowCount, 0);
endIndex = Math.Min(endIndex + rowCountInCacheAfter * itemsPerRowCount, Items.Count - 1);
}
else if (CacheLengthUnit == VirtualizationCacheLengthUnit.Item)
{
startIndex = Math.Max(startIndex - (int)CacheLength.CacheBeforeViewport, 0);
endIndex = Math.Min(endIndex + (int)CacheLength.CacheAfterViewport, Items.Count - 1);
}
}
else
{
double viewportSartPos = GetY(Offset);
double viewportEndPos = GetY(Offset) + GetHeight(Viewport);
if (CacheLengthUnit == VirtualizationCacheLengthUnit.Pixel)
{
viewportSartPos = Math.Max(viewportSartPos - CacheLength.CacheBeforeViewport, 0);
viewportEndPos = Math.Min(viewportEndPos + CacheLength.CacheAfterViewport, GetHeight(Extent));
}
int startRowIndex = GetRowIndex(viewportSartPos);
startIndex = startRowIndex * itemsPerRowCount;
int endRowIndex = GetRowIndex(viewportEndPos);
endIndex = Math.Min(endRowIndex * itemsPerRowCount + (itemsPerRowCount - 1), Items.Count - 1);
if (CacheLengthUnit == VirtualizationCacheLengthUnit.Page)
{
int itemsPerPage = endIndex - startIndex + 1;
startIndex = Math.Max(startIndex - (int)CacheLength.CacheBeforeViewport * itemsPerPage, 0);
endIndex = Math.Min(endIndex + (int)CacheLength.CacheAfterViewport * itemsPerPage, Items.Count - 1);
}
else if (CacheLengthUnit == VirtualizationCacheLengthUnit.Item)
{
startIndex = Math.Max(startIndex - (int)CacheLength.CacheBeforeViewport, 0);
endIndex = Math.Min(endIndex + (int)CacheLength.CacheAfterViewport, Items.Count - 1);
}
}
return new ItemRange(startIndex, endIndex);
}
private int GetRowIndex(double location)
{
int calculatedRowIndex = (int)Math.Floor(location / GetHeight(childSize));
int maxRowIndex = (int)Math.Ceiling((double)Items.Count / (double)itemsPerRowCount);
return Math.Max(Math.Min(calculatedRowIndex, maxRowIndex), 0);
}
protected override void BringIndexIntoView(int index)
{
if (index < 0 || index >= Items.Count)
{
throw new ArgumentOutOfRangeException(nameof(index), $"The argument {nameof(index)} must be >= 0 and < the number of items.");
}
if (itemsPerRowCount == 0)
{
throw new InvalidOperationException();
}
var offset = (index / itemsPerRowCount) * GetHeight(childSize);
if (Orientation == Orientation.Horizontal)
{
SetHorizontalOffset(offset);
}
else
{
SetVerticalOffset(offset);
}
}
protected override double GetLineUpScrollAmount()
{
return -Math.Min(childSize.Height * ScrollLineDeltaItem, Viewport.Height);
}
protected override double GetLineDownScrollAmount()
{
return Math.Min(childSize.Height * ScrollLineDeltaItem, Viewport.Height);
}
protected override double GetLineLeftScrollAmount()
{
return -Math.Min(childSize.Width * ScrollLineDeltaItem, Viewport.Width);
}
protected override double GetLineRightScrollAmount()
{
return Math.Min(childSize.Width * ScrollLineDeltaItem, Viewport.Width);
}
protected override double GetMouseWheelUpScrollAmount()
{
return -Math.Min(childSize.Height * MouseWheelDeltaItem, Viewport.Height);
}
protected override double GetMouseWheelDownScrollAmount()
{
return Math.Min(childSize.Height * MouseWheelDeltaItem, Viewport.Height);
}
protected override double GetMouseWheelLeftScrollAmount()
{
return -Math.Min(childSize.Width * MouseWheelDeltaItem, Viewport.Width);
}
protected override double GetMouseWheelRightScrollAmount()
{
return Math.Min(childSize.Width * MouseWheelDeltaItem, Viewport.Width);
}
protected override double GetPageUpScrollAmount()
{
return -Viewport.Height;
}
protected override double GetPageDownScrollAmount()
{
return Viewport.Height;
}
protected override double GetPageLeftScrollAmount()
{
return -Viewport.Width;
}
protected override double GetPageRightScrollAmount()
{
return Viewport.Width;
}
/* orientation aware helper methods */
protected double GetX(Point point) => Orientation == Orientation.Vertical ? point.X : point.Y;
protected double GetY(Point point) => Orientation == Orientation.Vertical ? point.Y : point.X;
protected double GetWidth(Size size) => Orientation == Orientation.Vertical ? size.Width : size.Height;
protected double GetHeight(Size size) => Orientation == Orientation.Vertical ? size.Height : size.Width;
protected Size CreateSize(double width, double height) => Orientation == Orientation.Vertical ? new Size(width, height) : new Size(height, width);
protected Rect CreateRect(double x, double y, double width, double height) => Orientation == Orientation.Vertical ? new Rect(x, y, width, height) : new Rect(y, x, width, height);
}
}

View File

@@ -18,6 +18,9 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -30,11 +33,8 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -49,7 +49,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
@@ -67,7 +67,7 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Taskbar.ico</ApplicationIcon>
<ApplicationIcon>Logo.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
@@ -75,6 +75,9 @@
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="CommonServiceLocator, Version=2.0.6.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>packages\CommonServiceLocator.2.0.6\lib\net45\CommonServiceLocator.dll</HintPath>
@@ -105,6 +108,7 @@
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
@@ -113,6 +117,7 @@
<Reference Include="System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Drawing.Common.6.0.0-preview.6.21352.12\lib\net461\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
@@ -127,6 +132,7 @@
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
@@ -143,6 +149,9 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsAPICodePack.Shell.CommonFileDialogs, Version=1.1.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\WindowsAPICodePack.Shell.CommonFileDialogs.1.1.5\lib\net452\WindowsAPICodePack.Shell.CommonFileDialogs.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@@ -163,6 +172,7 @@
<Compile Include="Constant\IconType.cs" />
<Compile Include="Constant\CommonEnum.cs" />
<Compile Include="Constant\IconStartType.cs" />
<Compile Include="Constant\MenuType.cs" />
<Compile Include="Constant\PasswordType.cs" />
<Compile Include="Constant\RunTimeStatus.cs" />
<Compile Include="Constant\SearchType.cs" />
@@ -170,6 +180,7 @@
<Compile Include="Constant\TodoTaskExecType.cs" />
<Compile Include="Constant\BGStyle.cs" />
<Compile Include="Constant\UpdateType.cs" />
<Compile Include="Constant\WidthTypeEnum.cs" />
<Compile Include="Control\Other\GlobalMsgNotification.xaml.cs">
<DependentUpon>GlobalMsgNotification.xaml</DependentUpon>
</Compile>
@@ -191,6 +202,9 @@
<Compile Include="Control\Other\IconInfoUrlDialog.xaml.cs">
<DependentUpon>IconInfoUrlDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Control\Other\SearchResControl.xaml.cs">
<DependentUpon>SearchResControl.xaml</DependentUpon>
</Compile>
<Compile Include="Control\UserControls\Config\OtherControl.xaml.cs">
<DependentUpon>OtherControl.xaml</DependentUpon>
</Compile>
@@ -247,6 +261,7 @@
</Compile>
<Compile Include="Converts\CountGreZero2BoolConvert.cs" />
<Compile Include="Converts\Count2VisibleConvert.cs" />
<Compile Include="Converts\GetWidthByWWConvert.cs" />
<Compile Include="Converts\SearchTypeConvert.cs" />
<Compile Include="Converts\StringAppendConvert.cs" />
<Compile Include="Converts\DoubleToGridLength.cs" />
@@ -260,11 +275,20 @@
<Compile Include="Converts\UpdateTypeConvert.cs" />
<Compile Include="Converts\ReverseBoolConvert.cs" />
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.cs" />
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
<Compile Include="Converts\HideTypeConvert.cs" />
<Compile Include="Interface\IWindowCommon.cs" />
<Compile Include="MyThread\RelativePathThread.cs" />
<Compile Include="Plugins\EveryThing\Constant\EveryThingConst.cs" />
<Compile Include="Plugins\EveryThing\EveryThing32.cs" />
<Compile Include="Plugins\EveryThing\EveryThing64.cs" />
<Compile Include="Plugins\EveryThing\EveryThingUtil.cs" />
<Compile Include="Plugins\ShowSeconds\Common\Constants.cs" />
<Compile Include="Plugins\ShowSeconds\SecondsWindow.xaml.cs">
<DependentUpon>SecondsWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Plugins\ShowSeconds\ViewModel\SecondsDataContext.cs" />
<Compile Include="Task\ShowSecondTask.cs" />
<Compile Include="Task\ToDoTask.cs" />
<Compile Include="MyThread\MouseHookThread.cs" />
@@ -274,11 +298,17 @@
<Compile Include="Util\BGSettingUtil.cs" />
<Compile Include="Util\BlurGlassUtil.cs" />
<Compile Include="Util\ColorUtil.cs" />
<Compile Include="Util\DefaultIcons.cs" />
<Compile Include="Util\DragAdorner.cs" />
<Compile Include="Util\FileWatcher.cs" />
<Compile Include="Util\GlobalHotKey.cs" />
<Compile Include="Util\CommonCode.cs" />
<Compile Include="Util\FileIcon.cs" />
<Compile Include="Util\FileUtil.cs" />
<Compile Include="ViewModel\Temp\GuideInfoList.cs" />
<Compile Include="Util\HideWindowUtil.cs" />
<Compile Include="Util\IconHelper.cs" />
<Compile Include="Util\IconUtil.cs" />
<Compile Include="Util\KeyUtil.cs" />
<Compile Include="Util\ListBoxDragDropManager.cs" />
<Compile Include="Util\LogUtil.cs" />
@@ -287,13 +317,27 @@
<Compile Include="Util\ImageUtil.cs" />
<Compile Include="Converts\MenuWidthConvert.cs" />
<Compile Include="Util\MD5Util.cs" />
<Compile Include="Util\MessageUtil.cs" />
<Compile Include="Util\MouseHook.cs" />
<Compile Include="Util\MouseUtil.cs" />
<Compile Include="Util\NativeMethods.cs" />
<Compile Include="Util\ProcessUtil.cs" />
<Compile Include="Util\RegisterUtil.cs" />
<Compile Include="Util\RelayCommand.cs" />
<Compile Include="Util\ScreenUtil.cs" />
<Compile Include="Util\ScrollUtil.cs" />
<Compile Include="Util\ShellContextMenu.cs" />
<Compile Include="Util\ShowWindowFollowMouse.cs" />
<Compile Include="Util\StringUtil.cs" />
<Compile Include="Util\SvgToGeometry.cs" />
<Compile Include="Util\UserActivityHook.cs" />
<Compile Include="CustomComponent\VirtualizingWrapPanel\ItemRange.cs" />
<Compile Include="CustomComponent\VirtualizingWrapPanel\SpacingMode.cs" />
<Compile Include="CustomComponent\VirtualizingWrapPanel\VirtualizingPanelBase.cs" />
<Compile Include="CustomComponent\VirtualizingWrapPanel\VirtualizingWrapPanel.cs" />
<Compile Include="Util\WindowsThumbnailProvider.cs" />
<Compile Include="Util\WindowUtil.cs" />
<Compile Include="CustomComponent\VirtualizingWrapPanel\ScrollDirection.cs" />
<Compile Include="ViewModel\AppConfig.cs" />
<Compile Include="ViewModel\AppData.cs" />
<Compile Include="ViewModel\GradientBGParam.cs" />
@@ -332,6 +376,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Control\Other\SearchResControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Control\UserControls\Config\OtherControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -416,6 +464,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Plugins\ShowSeconds\SecondsWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resource\Dictionary\Geometry.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -449,6 +501,19 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<Resource Include="Resource\Iconfont\iconfont.json" />
<None Include="app.manifest" />
<None Include="Plugins\EveryThing\32\Everything.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Plugins\EveryThing\32\Everything.lng">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Plugins\EveryThing\64\Everything.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Plugins\EveryThing\64\Everything.lng">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Properties\app.manifest" />
<None Include="Update.json" />
<None Include="packages.config" />
@@ -517,6 +582,29 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="Logo.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Plugins\EveryThing\lib\Everything32.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Plugins\EveryThing\lib\Everything64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<Content Include="Plugins\EveryThing\32\Everything.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Plugins\EveryThing\64\Everything.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
@@ -543,7 +631,8 @@
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>; Move all assemblies and related files to lib folder
ROBOCOPY "$(TargetDir) " "$(TargetDir)lib\ " /XF Data *.exe *.config *.manifest /XD lib logs bak /E /IS /MOVE
ROBOCOPY "$(TargetDir) " "$(TargetDir)lib\ " /XF Data *.exe *.config *.manifest /XD "$(TargetDir)lib" plugins logs bak /E /IS /MOVE
ROBOCOPY "$(TargetDir) " "$(TargetDir)lib\ " *.dll /XD "$(TargetDir)lib" /E /S /MOVE
if %25errorlevel%25 leq 4 exit 0 else exit %25errorlevel%25</PostBuildEvent>
</PropertyGroup>
</Project>

201
LICENSE Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,2 +0,0 @@
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
- 商用需联系作者

BIN
Logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

View File

@@ -11,8 +11,9 @@
xmlns:cvt="clr-namespace:GeekDesk.Converts"
x:Name="AppWindow"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
xmlns:my="clr-namespace:GeekDesk.Util"
d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
Title="GeekDesk"
Title="GeekDesk_Main_8400A17AEEF7C029"
MinWidth="600"
MinHeight="400"
WindowStyle="None"
@@ -28,11 +29,12 @@
MouseEnter="MainWindow_MouseEnter"
GotFocus="Window_GotFocus"
Loaded="Window_Loaded"
SourceInitialized="Window_SourceInitialized"
Topmost="{Binding AppConfig.AlwaysTopmost}"
>
<Window.Resources>
<RoutedUICommand x:Key="SearchHotKeyDown" Text="SearchHotKeyDown"/>
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
<cvt:OpcityConvert x:Key="OpcityConvert"/>
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
@@ -41,7 +43,7 @@
</Window.Resources>
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="15"/>
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="23"/>
</WindowChrome.WindowChrome>
<Window.InputBindings>
@@ -52,10 +54,95 @@
</Window.CommandBindings>
<!--Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"-->
<Grid>
<!--遮罩层border 用于引导提示-->
<Border Margin="20"
Visibility="Collapsed"
MouseDown="DragMove"
CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=OneWay, Converter={StaticResource IntToCornerRadius}}"
BorderThickness="0"
x:Name="GrayBorder"
Panel.ZIndex="888"
>
<Border.Background>
<SolidColorBrush Color="Gray" Opacity="0.9"/>
</Border.Background>
<!--<hc:Poptip.Instance>
<hc:Poptip PlacementType="Top" IsOpen="False" HitMode="None">
<hc:Poptip.ContentTemplate>
<DataTemplate>
<Border Background="White" Width="300" Height="150">
<TextBlock Text="这是一个测测试"/>
</Border>
</DataTemplate>
</hc:Poptip.ContentTemplate>
</hc:Poptip>
</hc:Poptip.Instance>-->
</Border>
<hc:Card x:Name="GuideCard" Width="300" Height="180" Panel.ZIndex="888"
VerticalAlignment="Top"
HorizontalAlignment="Left" Visibility="Collapsed">
<hc:Card.Background>
<SolidColorBrush Color="White" Opacity="0.85"/>
</hc:Card.Background>
<!--Card 的内容部分-->
<Border CornerRadius="4,4,0,0" Width="300" Height="100">
<TextBlock TextWrapping="Wrap"
x:Name="GuideText"
VerticalAlignment="Center"
HorizontalAlignment="Center"
LineHeight="22"
FontSize="14"
Text=""/>
</Border>
<!--Card 的尾部部分-->
<hc:Card.Footer>
<Grid>
<StackPanel Margin="10" Width="150" Height="50" HorizontalAlignment="Left">
<!--Card 的一级内容-->
<WrapPanel>
<TextBlock TextWrapping="Wrap"
x:Name="GuideTitle1"
Style="{DynamicResource TextBlockLargeBold}"
TextTrimming="CharacterEllipsis"
Text="引导提示"
FontSize="20"
HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap"
x:Name="GuideNum"
Style="{DynamicResource TextBlockLargeBold}"
TextTrimming="CharacterEllipsis"
Text="1"
FontSize="20"
HorizontalAlignment="Left"/>
</WrapPanel>
<!--Card 的二级内容-->
<TextBlock TextWrapping="NoWrap"
x:Name="GuideTitle2"
Style="{DynamicResource TextBlockDefault}"
TextTrimming="CharacterEllipsis"
Text="快捷方式创建"
Margin="0,6,0,0"
FontSize="14"
HorizontalAlignment="Left"/>
</StackPanel>
<hc:UniformSpacingPanel HorizontalAlignment="Right">
<Button Style="{StaticResource MyBtnStyle}" x:Name="PreviewGuideBtn" Click="PreviewGuideBtn_Click" Margin="0,0,20,0" Content="上一步"/>
<Button Style="{StaticResource MyBtnStyle}" x:Name="NextGuideBtn" Click="NextGuideBtn_Click" Margin="0,0,20,0" Content="下一步"/>
</hc:UniformSpacingPanel>
</Grid>
</hc:Card.Footer>
</hc:Card>
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
BorderThickness="0"
Focusable="True"
Panel.ZIndex="1"
x:Name="BGBorder"
Background="AliceBlue"
hc:Dialog.Token="MainWindowDialog"
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=None}"
xf:Animations.PrimaryBinding="{Binding AppConfig.IsShow, Mode=OneWay}"
@@ -70,32 +157,45 @@
</Border.Effect>
<hc:DialogContainer Focusable="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
<RowDefinition Height="40" MouseDown="DragMove"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<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="280"></ColumnDefinition>
<ColumnDefinition x:Name="RightColumn" Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<CheckBox x:Name="ShowBox" Visibility="Hidden" Panel.ZIndex="2"/>
<CheckBox x:Name="HideBox" Visibility="Hidden" Panel.ZIndex="2"/>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="ShowBox" Visibility="Hidden" Panel.ZIndex="2"/>
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="HideBox" Visibility="Hidden" Panel.ZIndex="2"/>
<StackPanel HorizontalAlignment="Right" Panel.ZIndex="99" hc:Growl.GrowlParent="False" hc:Growl.Token="MainWindowGrowl" Grid.Column="1" Grid.Row="1"/>
<StackPanel HorizontalAlignment="Center" Panel.ZIndex="99" hc:Growl.GrowlParent="False" hc:Growl.Token="MainWindowAskGrowl" Grid.Column="1" Grid.Row="1"/>
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
<DockPanel Grid.Row="0" Grid.Column="0" MouseDown="DragMove">
<DockPanel.Background>
<SolidColorBrush Opacity="0.01"/>
</DockPanel.Background>
<Image Visibility="{Binding AppConfig.TitleLogoVisible}" Source="/Resource/Image/TitleLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/>
<Image Visibility="{Binding AppConfig.TitleLogoVisible}"
Source="/Resource/Image/TitleLogo.png"
RenderOptions.BitmapScalingMode="HighQuality"
Margin="10,0,0,0"
Width="200"
Height="30"
Opacity="0.8"
HorizontalAlignment="Left"/>
</DockPanel>
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
<DockPanel Grid.Row="0" Grid.Column="2" MouseDown="DragMove">
<DockPanel.Background>
<SolidColorBrush Opacity="0.01"/>
</DockPanel.Background>
<hc:UniformSpacingPanel Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
<hc:UniformSpacingPanel x:Name="MainBtnPanel" Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
<Button Background="Transparent"
BorderThickness="0"
hc:IconElement.Geometry="M917.930667 512c0-57.6 36.181333-106.496 86.869333-125.952a505.429333 505.429333 0 0 0-55.210667-133.461333A134.826667 134.826667 0 0 1 771.413333 74.410667 507.733333 507.733333 0 0 0 637.952 19.2 135.168 135.168 0 0 1 512 106.069333 134.912 134.912 0 0 1 386.048 19.2 505.429333 505.429333 0 0 0 252.586667 74.410667c22.186667 49.749333 13.141333 109.824-27.562667 150.528a135.168 135.168 0 0 1-150.528 27.648 502.016 502.016 0 0 0-55.296 133.461333c50.688 19.626667 86.869333 68.437333 86.869333 125.952 0 57.6-36.181333 106.496-86.869333 125.952 12.117333 47.530667 30.72 92.330667 55.210667 133.461333a134.826667 134.826667 0 0 1 178.090666 178.176 507.733333 507.733333 0 0 0 133.546667 55.210667A135.168 135.168 0 0 1 512 917.930667c57.6 0 106.496 36.181333 125.952 86.869333a505.429333 505.429333 0 0 0 133.461333-55.210667 134.912 134.912 0 0 1 27.562667-150.528 135.168 135.168 0 0 1 150.528-27.648 502.016 502.016 0 0 0 55.296-133.461333A134.912 134.912 0 0 1 917.930667 512zM512 647.338667a135.338667 135.338667 0 1 1 0.085333-270.762667A135.338667 135.338667 0 0 1 512 647.338667z"
@@ -112,6 +212,7 @@
<ContextMenu x:Name="SettingMenus" Width="130">
<MenuItem Header="设置" Click="ConfigMenuClick"/>
<MenuItem Header="待办" Click="BacklogMenuClick"/>
<MenuItem Header="新手引导" Click="Guide_Click"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
@@ -132,7 +233,36 @@
<uc:LeftCardControl x:Name="LeftCard" Grid.Row="1" Grid.Column="0"/>
<!--分割线-->
<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="5" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
<Border x:Name="SearchResContainer" Panel.ZIndex="2"
Visibility="Collapsed"
Grid.Row="1" Grid.Column="1"
HorizontalAlignment="Right" MaxWidth="200"
VerticalAlignment="Top"
CornerRadius="8"
Margin="0,20,40,0"
>
<Border.Style>
<Style TargetType="Border" >
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.6"/>
</Setter.Value>
</Setter>
<Setter Property="MaxWidth" Value="300"/>
</Style>
</Border.Style>
<WrapPanel Margin="8">
<TextBlock Opacity="0.6" Text="g:"/>
<TextBlock x:Name="GeekDeskSearchTotal" Opacity="0.6" Text="0"/>
<TextBlock Opacity="0.6" Text="+"/>
<TextBlock Opacity="0.6" Text="e:"/>
<TextBlock x:Name="EverythingSearchCount" Opacity="0.6" Text="0"/>
<TextBlock Opacity="0.6" Text=" of "/>
<TextBlock x:Name="EverythingSearchTotal" Opacity="0.6" Text="0"/>
</WrapPanel>
</Border>
<!--搜索输入框-->
<TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
@@ -143,10 +273,15 @@
FontSize="16"
BorderThickness="0"
TextChanged="SearchBox_TextChanged"
/>
Style="{StaticResource MyTextBoxStyle}"
>
<TextBox.Background>
<SolidColorBrush Color="White" Opacity="0.5" />
</TextBox.Background>
</TextBox>
<hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
<hc:NotifyIcon Icon="/Logo.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">
<hc:NotifyIcon.ContextMenu>
<ContextMenu Width="130" x:Name="TaskbarContextMenu">
@@ -165,9 +300,12 @@
<uc:RightCardControl x:Name="RightCard" Grid.Row="1" Grid.Column="1"/>
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
</Grid>
</hc:DialogContainer>
</Border>
</Grid>
</Window>

View File

@@ -1,24 +1,36 @@
using GeekDesk.Constant;
using GeekDesk.Control.Other;
using GeekDesk.Control.UserControls.Config;
using GeekDesk.Control.UserControls.PannelCard;
using GeekDesk.Control.Windows;
using GeekDesk.Interface;
using GeekDesk.MyThread;
using GeekDesk.Plugins.EveryThing;
using GeekDesk.Plugins.EveryThing.Constant;
using GeekDesk.Task;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using GeekDesk.ViewModel.Temp;
using Microsoft.Win32;
using NPinyin;
using ShowSeconds;
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Shell;
using System.Windows.Threading;
using static GeekDesk.Util.ShowWindowFollowMouse;
@@ -31,14 +43,19 @@ namespace GeekDesk
public partial class MainWindow : Window, IWindowCommon
{
public static AppData appData = CommonCode.GetAppDataByFile();
public static AppData appData;
public static ToDoInfoWindow toDoInfoWindow;
public static int hotKeyId = -1;
public static int toDoHotKeyId = -1;
public static int colorPickerHotKeyId = -1;
public static MainWindow mainWindow;
private static bool dataFileExist = true;
public MainWindow()
{
//加载数据
LoadData();
InitializeComponent();
@@ -46,9 +63,6 @@ namespace GeekDesk
//用于其他类访问
mainWindow = this;
//置于顶层
this.Topmost = true;
//执行待办提醒
ToDoTask.BackLogCheck();
@@ -61,6 +75,15 @@ namespace GeekDesk
}
private void Window_SourceInitialized(object sender, EventArgs e)
{
try
{
//禁用窗口最大化
WindowUtil.DisableMaxWindow(this);
}
catch (Exception) { }
}
@@ -71,9 +94,12 @@ namespace GeekDesk
/// <param name="e"></param>
private void SearchHotKeyDown(object sender, CanExecuteRoutedEventArgs e)
{
if (appData.AppConfig.SearchType == SearchType.HOT_KEY)
if (appData.AppConfig.SearchType == SearchType.HOT_KEY && !RunTimeStatus.SEARCH_BOX_SHOW)
{
ShowSearchBox();
} else if (RunTimeStatus.SEARCH_BOX_SHOW)
{
HidedSearchBox();
}
}
@@ -86,6 +112,9 @@ namespace GeekDesk
RightCard.VisibilitySearchCard(Visibility.Visible);
SearchBox.Width = 400;
SearchBox.Focus();
//执行一遍a查询
//SearchBox_TextChanged(null, null);
}
/// <summary>
/// 搜索开始
@@ -106,34 +135,119 @@ namespace GeekDesk
if (!RunTimeStatus.SEARCH_BOX_SHOW) ShowSearchBox();
//刷新搜索后 鼠标移动次数置为0
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
//隐藏popup
RightCard.MyPoptip.IsOpen = false;
string inputText = SearchBox.Text.ToLower();
RightCard.VerticalUFG.Visibility = Visibility.Collapsed;
if (!string.IsNullOrEmpty(inputText))
{
SearchIconList.IconList.Clear();
RunTimeStatus.EVERYTHING_SEARCH_DELAY_TIME = 300;
if (!RunTimeStatus.EVERYTHING_NEW_SEARCH)
{
RunTimeStatus.EVERYTHING_NEW_SEARCH = true;
//显示搜索结果列表
RightCard.VisibilitySearchCard(Visibility.Visible);
//暂时隐藏条目信息
SearchResContainer.Visibility = Visibility.Collapsed;
//显示加载条
RightCard.Loading_RightCard.Visibility = Visibility.Visible;
object obj = RightCard.VerticalCard.Content;
if (obj != null)
{
SearchResControl control = obj as SearchResControl;
control.VerticalUFG.Visibility = Visibility.Collapsed;
}
SearchDelay();
}
} else
{
//隐藏条目信息
SearchResContainer.Visibility = Visibility.Collapsed;
//清空查询结果
object obj = RightCard.VerticalCard.Content;
if (obj != null)
{
SearchResControl control = obj as SearchResControl;
control.VerticalUFG.Visibility = Visibility.Collapsed;
}
}
}
private void SearchDelay()
{
new Thread(() =>
{
while (RunTimeStatus.EVERYTHING_SEARCH_DELAY_TIME > 0)
{
Thread.Sleep(10);
RunTimeStatus.EVERYTHING_SEARCH_DELAY_TIME -= 10;
}
RunTimeStatus.EVERYTHING_NEW_SEARCH = false;
this.Dispatcher.Invoke(() =>
{
string inputText = SearchBox.Text.ToLower().Trim();
if (string.IsNullOrEmpty(inputText))
{
RightCard.Loading_RightCard.Visibility = Visibility.Collapsed;
return;
}
new Thread(() =>
{
ObservableCollection<IconInfo> resList = new ObservableCollection<IconInfo>();
if (appData.AppConfig.EnableEveryThing == true)
{
ObservableCollection<IconInfo> iconBakList = EveryThingUtil.Search(inputText);
foreach (IconInfo icon in iconBakList)
{
resList.Add(icon);
}
}
int geekDeskCount = 0;
//GeekDesk数据搜索
ObservableCollection<MenuInfo> menuList = appData.MenuList;
foreach (MenuInfo menu in menuList)
{
ObservableCollection<IconInfo> iconList = menu.IconList;
foreach (IconInfo icon in iconList)
{
if (RunTimeStatus.EVERYTHING_NEW_SEARCH) return;
string pyName = Pinyin.GetInitials(icon.Name).ToLower();
if (icon.Name.Contains(inputText) || pyName.Contains(inputText))
{
SearchIconList.IconList.Add(icon);
geekDeskCount++;
resList.Add(icon);
}
}
}
}
else
this.Dispatcher.Invoke(() =>
{
SearchIconList.IconList.Clear();
}
if (RightCard.SearchListBox.Items.Count > 0)
if (appData.AppConfig.EnableEveryThing == true)
{
RightCard.SearchListBox.SelectedIndex = 0;
int everythingTotal = Convert.ToInt32(EveryThingUtil.Everything_GetNumResults());
GeekDeskSearchTotal.Text = Convert.ToString(geekDeskCount);
EverythingSearchCount.Text = Convert.ToString(resList.Count - geekDeskCount);
EverythingSearchTotal.Text = Convert.ToString(everythingTotal + geekDeskCount);
SearchResContainer.Visibility = Visibility.Visible;
}
RightCard.VerticalUFG.Visibility = Visibility.Visible;
SearchResControl control = new SearchResControl(resList);
RightCard.VerticalCard.Content = control;
//关闭加载效果
RightCard.Loading_RightCard.Visibility = Visibility.Collapsed;
});
}).Start();
});
}).Start();
}
/// <summary>
@@ -141,15 +255,33 @@ namespace GeekDesk
/// </summary>
public void HidedSearchBox()
{
RunTimeStatus.EVERYTHING_NEW_SEARCH = true;
RunTimeStatus.SEARCH_BOX_HIDED_300 = false;
new Thread(() =>
{
Thread.Sleep(300);
RunTimeStatus.SEARCH_BOX_HIDED_300 = true;
}).Start();
new Thread(() =>
{
Thread.Sleep(1000);
RunTimeStatus.EVERYTHING_NEW_SEARCH = false;
}).Start();
new Thread(() =>
{
this.Dispatcher.Invoke(() =>
{
Keyboard.Focus(SearchBox);
RunTimeStatus.SEARCH_BOX_SHOW = false;
SearchBox.TextChanged -= SearchBox_TextChanged;
SearchBox.Clear();
SearchBox.TextChanged += SearchBox_TextChanged;
SearchBox.Width = 0;
SearchIconList.IconList.Clear();
SearchResContainer.Visibility = Visibility.Collapsed;
RightCard.VerticalCard.Content = null;
RightCard.VisibilitySearchCard(Visibility.Collapsed);
Keyboard.Focus(SearchBox);
App.DoEvents();
});
}).Start();
}
@@ -158,6 +290,11 @@ namespace GeekDesk
/// </summary>
private void LoadData()
{
//判断数据文件是否存在 如果不存在那么是第一次打开程序
dataFileExist = File.Exists(Constants.DATA_FILE_PATH);
appData = CommonCode.GetAppDataByFile();
this.DataContext = appData;
if (appData.MenuList.Count == 0)
{
@@ -168,7 +305,6 @@ namespace GeekDesk
this.Height = appData.AppConfig.WindowHeight;
}
/// <summary>
/// 窗口加载完毕 执行方法
/// </summary>
@@ -185,7 +321,6 @@ namespace GeekDesk
{
ShowApp();
}
//ShowSecondTask.SHowSecond();
//给任务栏图标一个名字
BarIcon.Text = Constants.MY_NAME;
@@ -210,12 +345,22 @@ namespace GeekDesk
RegisterUtil.SetSelfStarting(appData.AppConfig.SelfStartUp, Constants.MY_NAME);
}
//注册鼠标中键监听事件
//注册鼠标监听事件
if (appData.AppConfig.MouseMiddleShow)
{
MouseHookThread.MiddleHook();
MouseHookThread.Hook();
}
//显秒插件
if (appData.AppConfig.SecondsWindow == true)
{
SecondsWindow.ShowWindow();
}
//监听实时文件夹菜单
FileWatcher.EnableLinkMenuWatcher(appData);
//更新线程开启 检测更新
UpdateThread.Update();
@@ -224,8 +369,29 @@ namespace GeekDesk
//毛玻璃 暂时未解决阴影问题
//BlurGlassUtil.EnableBlur(this);
//设置归属桌面 解决桌面覆盖程序界面的bug
WindowUtil.SetOwner(this, WindowUtil.GetDesktopHandle(this, DesktopLayer.Progman));
if (appData.AppConfig.EnableEveryThing == true)
{
//开启EveryThing插件
EveryThingUtil.EnableEveryThing();
}
Keyboard.Focus(SearchBox);
MessageUtil.ChangeWindowMessageFilter(MessageUtil.WM_COPYDATA, 1);
if (!dataFileExist)
{
Guide();
}
}
/// <summary>
/// 注册当前窗口的热键
/// </summary>
@@ -237,9 +403,17 @@ namespace GeekDesk
{
hotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
{
if (RunTimeStatus.MAIN_HOT_KEY_DOWN) return;
RunTimeStatus.MAIN_HOT_KEY_DOWN = true;
new Thread(() =>
{
Thread.Sleep(RunTimeStatus.MAIN_HOT_KEY_TIME);
RunTimeStatus.MAIN_HOT_KEY_DOWN = false;
}).Start();
if (MotionControl.hotkeyFinished)
{
if (mainWindow.Visibility == Visibility.Collapsed || mainWindow.Opacity == 0 || MarginHide.IS_HIDE)
if (CheckShouldShowApp())
{
ShowApp();
}
@@ -253,7 +427,8 @@ namespace GeekDesk
{
HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl");
}
} else
}
else
{
}
}
@@ -357,28 +532,9 @@ namespace GeekDesk
/// <param name="e"></param>
private void DragMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
var windowMode = this.ResizeMode;
if (this.ResizeMode != ResizeMode.NoResize)
{
this.ResizeMode = ResizeMode.NoResize;
}
this.UpdateLayout();
/* 当点击拖拽区域的时候,让窗口跟着移动
(When clicking the drag area, make the window follow) */
DragMove();
if (this.ResizeMode != windowMode)
{
this.ResizeMode = windowMode;
}
this.UpdateLayout();
}
}
@@ -442,6 +598,7 @@ namespace GeekDesk
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0);
}
MainWindow.mainWindow.Activate();
mainWindow.Show();
//mainWindow.Visibility = Visibility.Visible;
@@ -452,6 +609,11 @@ namespace GeekDesk
else
{
appData.AppConfig.IsShow = null;
//防止永远不显示界面
if (mainWindow.Opacity < 1)
{
mainWindow.Opacity = 1;
}
}
@@ -461,7 +623,8 @@ namespace GeekDesk
if (RunTimeStatus.SHOW_MENU_PASSWORDBOX)
{
mainWindow.RightCard.PDDialog.SetFocus();
} else
}
else
{
Keyboard.Focus(mainWindow.SearchBox);
}
@@ -554,7 +717,7 @@ namespace GeekDesk
/// <param name="e"></param>
private void NotifyIcon_Click(object sender, RoutedEventArgs e)
{
if (this.Visibility == Visibility.Collapsed || this.Opacity == 0)
if (CheckShouldShowApp())
{
ShowApp();
}
@@ -564,6 +727,14 @@ namespace GeekDesk
}
}
private static bool CheckShouldShowApp()
{
return mainWindow.Visibility == Visibility.Collapsed
|| mainWindow.Opacity == 0
|| MarginHide.IS_HIDE
|| !WindowUtil.WindowIsTop(mainWindow);
}
/// <summary>
/// 右键任务栏图标 设置
/// </summary>
@@ -652,6 +823,10 @@ namespace GeekDesk
appData.AppConfig.WindowWidth = this.Width;
appData.AppConfig.WindowHeight = this.Height;
}
if (guideRun)
{
Guide();
}
}
@@ -663,10 +838,14 @@ namespace GeekDesk
/// <param name="e"></param>
private void ExitApp(object sender, RoutedEventArgs e)
{
if (appData.AppConfig.MouseMiddleShow)
if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow == true)
{
MouseHookThread.Dispose();
}
if (appData.AppConfig.EnableEveryThing == true)
{
EveryThingUtil.DisableEveryThing();
}
Application.Current.Shutdown();
}
/// <summary>
@@ -676,7 +855,7 @@ namespace GeekDesk
/// <param name="e"></param>
private void ReStartApp(object sender, RoutedEventArgs e)
{
if (appData.AppConfig.MouseMiddleShow)
if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow == true)
{
MouseHookThread.Dispose();
}
@@ -717,13 +896,18 @@ namespace GeekDesk
{
if (e.Key == Key.Down || e.Key == Key.Tab)
{
RightCard.SearchListBoxIndexAdd();
} else if (e.Key == Key.Up)
SearchResControl res = RightCard.VerticalCard.Content as SearchResControl;
res.SearchListBoxIndexAdd();
}
else if (e.Key == Key.Up)
{
RightCard.SearchListBoxIndexSub();
} else if (e.Key == Key.Enter)
SearchResControl res = RightCard.VerticalCard.Content as SearchResControl;
res.SearchListBoxIndexSub();
}
else if (e.Key == Key.Enter)
{
RightCard.StartupSelectionItem();
SearchResControl res = RightCard.VerticalCard.Content as SearchResControl;
res.StartupSelectionItem();
}
}
}
@@ -838,7 +1022,147 @@ namespace GeekDesk
}
}
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
if (hwndSource != null)
{
IntPtr handle = hwndSource.Handle;
hwndSource.AddHook(new HwndSourceHook(WndProc));
}
}
IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == MessageUtil.WM_COPYDATA)
{
MessageUtil.CopyDataStruct cds = (MessageUtil.CopyDataStruct)System.Runtime.InteropServices.Marshal.PtrToStructure(lParam, typeof(MessageUtil.CopyDataStruct));
if ("ShowApp".Equals(cds.msg))
{
ShowApp();
}
}
return hwnd;
}
#region
private int guideIndex = 0;
private bool guideRun = false;
private void Guide()
{
try
{
guideRun = true;
//防止影响主程序进程
if (CheckShouldShowApp())
{
ShowApp();
}
GrayBorder.Visibility = Visibility.Visible;
GuideSwitch(guideIndex);
GuideCard.Visibility = Visibility.Visible;
}
catch (Exception) { guideRun = false; }
}
private void GuideSwitch(int index)
{
guideIndex = index;
GuideNum.Text = Convert.ToString(index + 1);
GuideTitle1.Text = GuideInfoList.mainWindowGuideList[index].Title1;
GuideTitle2.Text = GuideInfoList.mainWindowGuideList[index].Title2;
GuideText.Text = GuideInfoList.mainWindowGuideList[index].GuideText;
if (index == 0)
{
PreviewGuideBtn.Visibility = Visibility.Collapsed;
NextGuideBtn.Content = "下一步";
} else if (index > 0 && index < GuideInfoList.mainWindowGuideList.Count - 1)
{
PreviewGuideBtn.Visibility = Visibility.Visible;
NextGuideBtn.Content = "下一步";
} else
{
NextGuideBtn.Content = "完成";
}
switch (index)
{
default: //0 //右侧列表区域
Point point = RightCard.TransformToAncestor(this).Transform(new Point(0, 0));
//内部中上
GrayBoderClip(point.X, point.Y, RightCard.ActualWidth, RightCard.ActualHeight,
new Thickness(point.X + RightCard.ActualWidth / 2 - GuideCard.ActualWidth / 2, point.Y, 0, 0));
break;
case 1: //左侧菜单
Point leftCardPoint = LeftCard.TransformToAncestor(this).Transform(new Point(0, 0));
GrayBoderClip(leftCardPoint.X , leftCardPoint.Y , LeftCard.ActualWidth, LeftCard.ActualHeight,
// 外部中下侧
new Thickness(leftCardPoint.X + LeftCard.ActualWidth,
leftCardPoint.Y + LeftCard.ActualHeight / 2 - GuideCard.ActualHeight / 2, 0, 0));
break;
case 2: //头部拖拽栏
GrayBoderClip(0, 0, this.Width, 50,
// 外部中下侧
new Thickness(this.Width / 2 - GuideCard.ActualWidth / 2, 50, 0, 0));
break;
case 3:
Point mainBtnPoint = MainBtnPanel.TransformToAncestor(this).Transform(new Point(0, 0));
GrayBoderClip(mainBtnPoint.X, mainBtnPoint.Y, MainBtnPanel.ActualWidth, MainBtnPanel.ActualHeight,
// 外部左下侧
new Thickness(mainBtnPoint.X - GuideCard.Width,
mainBtnPoint.Y, 0, 0));
break;
}
}
private void GrayBoderClip(double x, double y, double w, double h, Thickness margin)
{
PathGeometry borGeometry = new PathGeometry();
RectangleGeometry rg = new RectangleGeometry();
rg.Rect = new Rect(0, 0, this.Width, this.Height);
borGeometry = Geometry.Combine(borGeometry, rg, GeometryCombineMode.Union, null);
GrayBorder.Clip = borGeometry;
RectangleGeometry rg1 = new RectangleGeometry();
rg1.Rect = new Rect(x - 20, y - 20, w, h);
borGeometry = Geometry.Combine(borGeometry, rg1, GeometryCombineMode.Exclude, null);
GuideCard.Margin = margin;
GrayBorder.Clip = borGeometry;
}
private void PreviewGuideBtn_Click(object sender, RoutedEventArgs e)
{
int index = Convert.ToInt32(GuideNum.Text.ToString()) - 1;
int previewIndex = index - 1;
GuideSwitch(previewIndex);
}
private void NextGuideBtn_Click(object sender, RoutedEventArgs e)
{
if ("完成".Equals(NextGuideBtn.Content.ToString())) {
GrayBorder.Visibility = Visibility.Collapsed;
GuideCard.Visibility = Visibility.Collapsed;
guideIndex = 0;
guideRun = false;
return;
}
int index = Convert.ToInt32(GuideNum.Text.ToString()) - 1;
int nextIndex = index + 1;
GuideSwitch(nextIndex);
}
#endregion
private void Guide_Click(object sender, RoutedEventArgs e)
{
Guide();
}
}
}

View File

@@ -1,7 +1,11 @@
using GeekDesk.Control.UserControls.Config;
using GeekDesk.Control.Windows;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Gma.System.MouseKeyHook;
using System;
using System.Drawing;
using System.Threading;
using System.Windows;
using System.Windows.Threading;
@@ -9,28 +13,38 @@ namespace GeekDesk.MyThread
{
public class MouseHookThread
{
private static AppConfig appConfig = MainWindow.appData.AppConfig;
private static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
private static Dispatcher dispatcher;
private static readonly AppConfig appConfig = MainWindow.appData.AppConfig;
public static Dispatcher dispatcher;
private static UserActivityHook hook;
public static void MiddleHook()
public static void Hook()
{
//使用dispatcher来单独监听UI线程 防止程序卡顿
dispatcher = DispatcherBuild.Build();
m_GlobalHook = Hook.GlobalEvents();
dispatcher.BeginInvoke((Action)(() =>
dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
{
m_GlobalHook.MouseUpExt += M_GlobalHook_MouseUpExt;
hook = new UserActivityHook();
if (appConfig.MouseMiddleShow)
{
hook.OnMouseWheelUp += OnMouseWheelUp;
}
hook.Start(true, false);
}));
}
public static void Dispose()
private static void OnMouseLeftDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
m_GlobalHook.MouseUpExt -= M_GlobalHook_MouseUpExt;
m_GlobalHook.Dispose();
dispatcher.InvokeShutdown();
}
private static void OnMouseLeftUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
}
private static void OnMouseWheelUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
MouseWheelShowApp(sender, e);
}
/// <summary>
@@ -38,13 +52,12 @@ namespace GeekDesk.MyThread
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void M_GlobalHook_MouseUpExt(object sender, System.Windows.Forms.MouseEventArgs e)
private static void MouseWheelShowApp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (appConfig.MouseMiddleShow && e.Button == System.Windows.Forms.MouseButtons.Middle)
//中键打开App
if (appConfig.MouseMiddleShow && MotionControl.hotkeyFinished)
{
if (MotionControl.hotkeyFinished)
{
App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() =>
App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
{
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
{
@@ -57,7 +70,38 @@ namespace GeekDesk.MyThread
}));
}
}
public static void Dispose()
{
try
{
if (hook != null)
{
if (hook.MouseWheelUpEnable())
{
hook.OnMouseWheelUp -= OnMouseWheelUp;
}
if (hook.MouseLeftDownEnable())
{
hook.OnMouseLeftDown -= OnMouseLeftDown;
}
if (hook.MouseLeftUpEnable())
{
hook.OnMouseLeftUp -= OnMouseLeftUp;
}
hook.Stop();
dispatcher.InvokeShutdown();
hook = null;
dispatcher = null;
}
}
catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "关闭hook出错");
}
}
}
}

View File

@@ -2,13 +2,9 @@
using GeekDesk.Util;
using GeekDesk.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GeekDesk.MyThread
{
@@ -17,6 +13,8 @@ namespace GeekDesk.MyThread
public static void MakeRelativePath()
{
new Thread(() =>
{
try
{
ObservableCollection<MenuInfo> menuList = MainWindow.appData.MenuList;
@@ -24,18 +22,26 @@ namespace GeekDesk.MyThread
foreach (MenuInfo mi in menuList)
{
ObservableCollection<IconInfo> iconList = mi.IconList;
if (iconList == null) continue;
foreach (IconInfo icon in iconList)
{
if (icon == null) continue;
string relativePath = FileUtil.MakeRelativePath(myExePath, icon.Path);
if (File.Exists(icon.Path)
&& !string.IsNullOrEmpty(relativePath)
&& !relativePath.Equals(icon.Path)) {
&& !relativePath.Equals(icon.Path))
{
icon.RelativePath_NoWrite = relativePath;
}
}
}
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_BAK_PATH);
}
catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "init相对路径出错!");
}
}).Start();
}
}

View File

@@ -50,6 +50,23 @@ namespace GeekDesk.MyThread
if (!StringUtil.IsEmpty(updateInfo))
{
JObject jo = JObject.Parse(updateInfo);
try
{
if (jo["statisticUrl"] != null)
{
string statisticUrl = jo["statisticUrl"].ToString();
if (!string.IsNullOrEmpty(statisticUrl))
{
//用户统计 只通过uuid统计用户数量 不收集任何信息
statisticUrl += "?uuid=" + CommonCode.GetUniqueUUID();
HttpUtil.Get(statisticUrl);
}
}
} catch (Exception){}
string onlineVersion = jo["version"].ToString();
if (onlineVersion.CompareTo(nowVersion) > 0)
{

Binary file not shown.

View File

@@ -0,0 +1,740 @@
; Please make sure Everything is not running before modifying this file.
[Everything]
run_as_admin=0
allow_http_server=1
allow_etp_server=1
window_x=130
window_y=130
window_wide=794
window_high=664
maximized=0
minimized=0
fullscreen=0
ontop=0
bring_into_view=1
alpha=255
match_whole_word=0
match_path=0
match_case=0
match_diacritics=0
match_regex=0
view=0
thumbnail_size=64
thumbnail_fill=0
min_thumbnail_size=32
max_thumbnail_size=256
medium_thumbnail_size=64
large_thumbnail_size=128
extra_large_thumbnail_size=256
thumbnail_load_size=0
thumbnail_overlay_icon=1
shell_max_path=0
allow_multiple_windows=0
allow_multiple_instances=0
run_in_background=1
show_in_taskbar=1
show_tray_icon=0
minimize_to_tray=0
toggle_window_from_tray_icon=0
alternate_row_color=0
show_mouseover=0
check_for_updates_on_startup=0
beta_updates=0
show_highlighted_search_terms=1
text_size=0
hide_empty_search_results=0
clear_selection_on_search=1
show_focus_on_search=0
new_window_key=0
show_window_key=0
toggle_window_key=0
language=0
show_selected_item_in_statusbar=1
statusbar_selected_item_format=
show_size_in_statusbar=0
statusbar_size_format=0
open_folder_command2=
open_file_command2=
open_path_command2=
explore_command2=
explore_path_command2=
window_title_format=
taskbar_notification_title_format=
instance_name=
translucent_selection_rectangle_alpha=70
min_zoom=-6
max_zoom=27
context_menu_type=0
context_menu_shell_extensions=1
auto_include_fixed_volumes=1
auto_include_removable_volumes=0
auto_remove_offline_ntfs_volumes=1
auto_remove_moved_ntfs_volumes=1
auto_include_fixed_refs_volumes=1
auto_include_removable_refs_volumes=0
auto_remove_offline_refs_volumes=1
auto_remove_moved_refs_volumes=1
find_mount_points_on_removable_volumes=0
scan_volume_drive_letters=1
last_export_type=0
max_threads=0
reuse_threads=1
find_subfolders_and_files_max_threads=0
single_parent_context_menu=0
auto_size_1=512
auto_size_2=640
auto_size_3=768
auto_size_aspect_ratio_x=9
auto_size_aspect_ratio_y=7
auto_size_width_only=0
auto_size_path_x=1
auto_size_path_y=2
sticky_vscroll_bottom=1
last_options_page=0
draw_focus_rect=1
date_format=
time_format=
listview_item_high=0
single_click_open=0
underline_icon_titles=0
icons_only=0
icon_shell_extensions=1
auto_scroll_repeat_delay=250
auto_scroll_repeat_rate=50
open_many_files_warning_threshold=16
set_foreground_window_attach_thread_input=0
debug=0
debug_log=0
verbose=0
lvm=1
ipc=1
home_match_case=0
home_match_whole_word=0
home_match_path=0
home_match_diacritics=0
home_regex=0
home_search=1
home_filter=0
home_sort=0
home_view=0
home_index=1
allow_multiple_windows_from_tray=0
single_click_tray=0
close_on_execute=0
double_click_path=0
update_display_after_scroll=0
update_display_after_mask=1
auto_scroll_view=0
double_quote_copy_as_path=0
snap=0
snaplen=10
rename_select_filepart_only=0
rename_move_caret_to_selection_end=0
rename_nav=0
search_edit_move_caret_to_selection_end=0
search_edit_drag_accept_files=0
select_search_on_mouse_click=1
focus_search_on_activate=0
reset_vscroll_on_search=1
wrap_focus=0
load_icon_priority=0
load_thumbnail_priority=0
load_fileinfo_priority=0
always_request_all_fileinfo=0
header_high=0
hide_on_close=0
max_hidden_windows=0
winmm=0
menu_escape_amp=1
menu_folders=0
menu_folder_separator=
menu_items_per_column=0
new_inherit=1
full_row_select=0
tray_show_command_line=
dpi=96
ctrl_mouse_wheel_action=1
lvm_scroll=1
allow_open=1
allow_context_menu=1
allow_delete=1
allow_rename=1
allow_cut=1
allow_copy=1
allow_paste=1
allow_drag_drop=1
allow_window_message_filter_dragdrop=0
auto_column_widths=0
hotkey_explorer_path_search=0
hotkey_user_notification_state=0
get_key_name_text=1
paste_new_line_op=0
esc_cancel_action=1
fast_ascii_search=1
match_path_when_search_contains_path_separator=1
allow_literal_operators=0
allow_round_bracket_parenthesis=0
expand_environment_variables=0
search_as_you_type=1
always_update_query_on_search_parameter_change=0
convert_forward_slash_to_backslash=0
match_whole_filename_when_using_wildcards=1
operator_precedence=0
replace_exact_trailing_star_dot_star_with_star=1
allow_exclamation_point_not=1
search_command_prefix=
auto_complete_search_command=1
double_buffer=1
search=
show_number_of_results_with_selection=0
date_descending_first=0
size_descending_first=0
size_format=2
alpha_select=0
tooltips=1
listview_tooltips=1
show_detailed_listview_tooltips=1
rtl_listview_edit=0
force_path_ltr_order=1
force_path_left_align=1
date_time_order=0
date_time_align=1
size_align=3
invert_layout=0
update_layout_on_input_language_change=0
control_shift_action=3
change_search_rtl_reading_action=3
invert_layout_action=3
bookmark_remember_case=1
bookmark_remember_wholeword=1
bookmark_remember_path=1
bookmark_remember_diacritic=1
bookmark_remember_regex=1
bookmark_remember_sort=1
bookmark_remember_view=1
bookmark_remember_filter=1
bookmark_remember_index=1
bookmark_remember_search=1
bookmark_organize_x=0
bookmark_organize_y=0
bookmark_organize_wide=0
bookmark_organize_high=0
exclude_list_enabled=1
exclude_hidden_files_and_folders=0
exclude_system_files_and_folders=0
include_only_files=
exclude_files=
db_location=
db_multi_user_filename=0
db_compress=0
index_size=1
fast_size_sort=1
index_date_created=0
fast_date_created_sort=0
index_date_modified=1
fast_date_modified_sort=1
index_date_accessed=0
fast_date_accessed_sort=0
index_attributes=0
fast_attributes_sort=0
index_folder_size=0
fast_path_sort=1
fast_extension_sort=0
extended_information_cache_monitor=1
db_update_thread_priority=-15
index_recent_changes=1
refs_file_id_extd_directory_info_buffer_size=0
folder_update_thread_mode_background=0
folder_update_rescan_asap=1
monitor_thread_mode_background=1
monitor_retry_delay=30000
monitor_update_delay=1000
monitor_pause=0
usn_record_filter=0xffffffff
cancel_delay=0x000003e8
allow_ntfs_open_file_by_id=1
always_update_folder_recent_change=0
editor_x=0
editor_y=0
editor_wide=0
editor_high=0
editor_maximized=0
file_list_relative_paths=0
rename_x=0
rename_y=0
rename_wide=0
rename_high=0
rename_match_case=0
rename_regex=0
advanced_copy_to_x=0
advanced_copy_to_y=0
advanced_copy_to_wide=0
advanced_copy_to_high=0
advanced_copy_to_match_case=0
advanced_copy_to_regex=0
advanced_move_to_x=0
advanced_move_to_y=0
advanced_move_to_wide=0
advanced_move_to_high=0
advanced_move_to_match_case=0
advanced_move_to_regex=0
advanced_search_x=0
advanced_search_y=0
advanced_search_wide=0
advanced_search_high=0
advanced_search_page_y_offset=0
advanced_search_focus_id=0
advanced_search_warnings=1
max_recv_size=8388608
display_full_path_name=0
size_tiny=10240
size_small=102400
size_medium=1048576
size_large=16777216
size_huge=134217728
themed_toolbar=1
show_copy_name=2
show_copy_path=2
show_copy_full_name=2
show_open_path=2
show_explore=2
show_explore_path=2
copy_path_folder_append_backslash=0
custom_verb01=
custom_verb02=
custom_verb03=
custom_verb04=
custom_verb05=
custom_verb06=
custom_verb07=
custom_verb08=
custom_verb09=
custom_verb10=
custom_verb11=
custom_verb12=
filters_visible=0
filters_wide=128
filters_right_align=1
filters_tab_stop=0
filter=
filter_everything_name=
filter_organize_x=0
filter_organize_y=0
filter_organize_wide=0
filter_organize_high=0
preview_visible=0
preview_x=640
preview_tab_stop=0
preview_mag_filter=0
preview_min_filter=0
preview_fill=0
show_preview_handlers_in_preview_pane=0
preview_load_size=0
preview_context=0x00000000
preview_release_handler_on_clear=0
sort=Run Count
sort_ascending=0
always_keep_sort=0
index=0
index_file_list=
index_etp_server=
index_link_type=1
status_bar_visible=1
select_search_on_focus_mode=1
select_search_on_set_mode=2
search_history_enabled=0
run_history_enabled=1
search_history_days_to_keep=90
run_history_days_to_keep=90
search_history_keep_forever=1
run_history_keep_forever=1
search_history_always_suggest=0
search_history_always_suggest_extend_toolbar=0
search_history_visible_count_max=12
search_history_always_suggest_visible_count_max=1
search_history_show_all_max=256
search_history_suggestion_max=256
search_history_show_all_sort=2
search_history_suggestion_sort=1
search_history_show_above=0
search_history_sort=2
search_history_sort_ascending=0
search_history_x=0
search_history_y=0
search_history_wide=0
search_history_high=0
search_history_column_search_wide=208
search_history_column_search_order=0
search_history_column_count_wide=128
search_history_column_count_order=1
search_history_column_date_wide=128
search_history_column_date_order=2
etp_server_enabled=0
etp_server_bindings=
etp_server_port=21
etp_server_username=
etp_server_password=
etp_server_welcome_message=
etp_server_log_file_name=
etp_server_logging_enabled=0
etp_server_log_max_size=4194304
etp_server_log_delta_size=524288
etp_server_allow_file_download=1
ftp_allow_port=1
ftp_check_data_connection_ip=1
http_server_enabled=0
http_server_bindings=
http_title_format=
http_server_port=80
http_server_username=
http_server_password=
http_server_home=
http_server_default_page=
http_server_log_file_name=
http_server_logging_enabled=0
http_server_log_max_size=4194304
http_server_log_delta_size=524288
http_server_allow_file_download=1
http_server_items_per_page=32
http_server_show_drive_labels=0
http_server_strings=
http_server_header=
service_pipe_name=
name_column_pos=0
name_column_width=256
path_column_visible=1
path_column_pos=1
path_column_width=256
size_column_visible=1
size_column_pos=2
size_column_width=96
extension_column_visible=0
extension_column_pos=3
extension_column_width=96
type_column_visible=0
type_column_pos=4
type_column_width=96
last_write_time_column_visible=1
last_write_time_column_pos=3
last_write_time_column_width=153
creation_time_column_visible=0
creation_time_column_pos=6
creation_time_column_width=153
date_accessed_column_visible=0
date_accessed_column_pos=7
date_accessed_column_width=153
attribute_column_visible=0
attribute_column_pos=8
attribute_column_width=70
date_recently_changed_column_visible=0
date_recently_changed_column_pos=9
date_recently_changed_column_width=153
run_count_column_visible=0
run_count_column_pos=10
run_count_column_width=96
date_run_column_visible=0
date_run_column_pos=11
date_run_column_width=153
file_list_filename_column_visible=0
file_list_filename_column_pos=12
file_list_filename_column_width=96
translucent_selection_rectangle_background_color=
translucent_selection_rectangle_border_color=
thumbnail_mouseover_border_color=
preview_background_color=
ntfs_volume_guids="\\\\?\\Volume{6afe1915-0a0b-4e59-96bc-666ff914ea4f}","\\\\?\\Volume{71be44cf-e03a-462f-a9c8-b53c16e002a4}"
ntfs_volume_paths="C:","D:"
ntfs_volume_roots="",""
ntfs_volume_includes=1,1
ntfs_volume_load_recent_changes=0,0
ntfs_volume_include_onlys="",""
ntfs_volume_monitors=1,1
refs_volume_guids=
refs_volume_paths=
refs_volume_roots=
refs_volume_includes=
refs_volume_load_recent_changes=
refs_volume_include_onlys=
refs_volume_monitors=
filelists=
filelist_monitor_changes=
folders=
folder_monitor_changes=
folder_buffer_size_list=
folder_rescan_if_full_list=
folder_update_types=
folder_update_days=
folder_update_ats=
folder_update_intervals=
folder_update_interval_types=
exclude_folders=
connect_history_hosts=
connect_history_ports=
connect_history_usernames=
connect_history_link_types=
etp_client_rewrite_patterns=
etp_client_rewrite_substitutions=
file_new_search_window_keys=334
file_open_file_list_keys=335
file_close_file_list_keys=
file_close_keys=343,27
file_export_keys=339
file_copy_full_name_to_clipboard_keys=9539
file_copy_path_to_clipboard_keys=
file_set_run_count_keys=
file_create_shortcut_keys=
file_delete_keys=8238
file_delete_permanently_keys=9262
file_edit_keys=
file_open_keys=8205
file_open_selection_and_close_everything_keys=
file_explore_path_keys=
file_open_new_keys=
file_open_path_keys=8461
file_open_with_keys=
file_open_with_default_verb_keys=
file_play_keys=
file_preview_keys=
file_print_keys=
file_print_to_keys=
file_properties_keys=8717
file_read_extended_information_keys=8517
file_rename_keys=8305
file_run_as_keys=
file_exit_keys=337
file_copy_name_to_clipboard_keys=
file_open_selection_and_do_not_close_everything_keys=
file_open_most_run_keys=
file_open_last_run_keys=
file_custom_verb_1_keys=
file_custom_verb_2_keys=
file_custom_verb_3_keys=
file_custom_verb_4_keys=
file_custom_verb_5_keys=
file_custom_verb_6_keys=
file_custom_verb_7_keys=
file_custom_verb_8_keys=
file_custom_verb_9_keys=
file_custom_verb_10_keys=
file_custom_verb_11_keys=
file_custom_verb_12_keys=
indexes_folders_rescan_all_now_keys=
indexes_force_rebuild_keys=
edit_cut_keys=8536
edit_copy_keys=8515,8493
edit_paste_keys=8534,9261
edit_select_all_keys=8513
edit_invert_selection_keys=
edit_copy_to_folder_keys=
edit_move_to_folder_keys=
edit_advanced_advanced_copy_to_folder_keys=
edit_advanced_advanced_move_to_folder_keys=
view_filters_keys=
view_preview_keys=592
view_status_bar_keys=
view_details_keys=1334
view_medium_thumbnails_keys=1331
view_large_thumbnails_keys=1330
view_extra_large_thumbnails_keys=1329
view_increase_thumbnail_size_keys=1467
view_decrease_thumbnail_size_keys=1469
view_window_size_small_keys=561
view_window_size_medium_keys=562
view_window_size_large_keys=563
view_window_size_auto_fit_keys=564
view_zoom_zoom_in_keys=443
view_zoom_zoom_out_keys=445
view_zoom_reset_keys=304,352
view_go_to_back_keys=549,166
view_go_to_forward_keys=551,167
view_go_to_home_keys=548
view_go_to_show_all_history_keys=1352,328
view_sort_by_name_keys=305
view_sort_by_path_keys=306
view_sort_by_size_keys=307
view_sort_by_extension_keys=308
view_sort_by_type_keys=309
view_sort_by_date_modified_keys=310
view_sort_by_date_created_keys=311
view_sort_by_attributes_keys=312
view_sort_by_file_list_filename_keys=
view_sort_by_run_count_keys=
view_sort_by_date_run_keys=
view_sort_by_date_recently_changed_keys=313
view_sort_by_date_accessed_keys=
view_sort_by_ascending_keys=
view_sort_by_descending_keys=
view_refresh_keys=116
view_fullscreen_keys=122
view_toggle_ltrrtl_direction_keys=
view_on_top_never_keys=
view_on_top_always_keys=
view_on_top_while_searching_keys=
search_match_case_keys=329
search_match_whole_word_keys=322
search_match_path_keys=341
search_match_diacritics_keys=333
search_enable_regex_keys=338
search_advanced_search_keys=
search_add_to_filters_keys=
search_organize_filters_keys=1350
bookmarks_add_to_bookmarks_keys=324
bookmarks_organize_bookmarks_keys=1346
tools_options_keys=336
tools_console_keys=448
tools_file_list_editor_keys=
tools_connect_to_etp_server_keys=
tools_disconnect_from_etp_server_keys=
help_everything_help_keys=112
help_search_syntax_keys=
help_regex_syntax_keys=
help_command_line_options_keys=
help_everything_website_keys=
help_check_for_updates_keys=
help_about_everything_keys=368
help_donate_keys=
search_edit_focus_search_edit_keys=326,114,580
search_edit_delete_previous_word_keys=4360
search_edit_auto_complete_search_keys=4384
search_edit_show_search_history_keys=
search_edit_show_all_search_history_keys=4646,4648
result_list_item_up_keys=8230,4134
result_list_item_down_keys=8232,4136
result_list_page_up_keys=8225,4129
result_list_page_down_keys=8226,4130
result_list_start_of_list_keys=8228
result_list_end_of_list_keys=8227
result_list_item_up_extend_keys=9254,5158
result_list_item_down_extend_keys=9256,5160
result_list_page_up_extend_keys=9249,5153
result_list_page_down_extend_keys=9250,5154
result_list_start_of_list_extend_keys=9252
result_list_end_of_list_extend_keys=9251
result_list_focus_up_keys=8486,4390
result_list_focus_down_keys=8488,4392
result_list_focus_page_up_keys=8481,4385
result_list_focus_page_down_keys=8482,4386
result_list_focus_start_of_list_keys=8484
result_list_focus_end_of_list_keys=8483
result_list_focus_up_extend_keys=9510,5414
result_list_focus_down_extend_keys=9512,5416
result_list_focus_page_up_extend_keys=9505,5409
result_list_focus_page_down_extend_keys=9506,5410
result_list_focus_start_of_list_extend_keys=9508
result_list_focus_end_of_list_extend_keys=9507
result_list_focus_result_list_keys=
result_list_focus_highest_run_count_result_keys=
result_list_focus_last_run_result_keys=
result_list_toggle_path_column_keys=
result_list_toggle_size_column_keys=
result_list_toggle_extension_column_keys=
result_list_toggle_type_column_keys=
result_list_toggle_date_modified_column_keys=
result_list_toggle_date_created_column_keys=
result_list_toggle_attributes_column_keys=
result_list_toggle_file_list_filename_column_keys=
result_list_toggle_run_count_column_keys=
result_list_toggle_date_recently_changed_column_keys=
result_list_toggle_date_accessed_column_keys=
result_list_toggle_date_run_column_keys=
result_list_size_all_columns_to_fit_keys=8555
result_list_size_result_list_to_fit_keys=
result_list_context_menu_keys=9337
result_list_scroll_left_or_thumbnail_left_keys=8229
result_list_scroll_right_or_thumbnail_right_keys=8231
result_list_scroll_page_left_or_thumbnail_focus_left_keys=8485
result_list_scroll_page_right_or_thumbnail_focus_right_keys=8487
result_list_left_extend_keys=9253
result_list_right_extend_keys=9255
result_list_focus_left_extend_keys=9509
result_list_focus_right_extend_keys=9511
result_list_select_focus_keys=8224
result_list_toggle_focus_selection_keys=8480
result_list_copy_as_csv_keys=
preview_focus_preview_keys=
result_list_font=
result_list_font_size=
search_edit_font=
search_edit_font_size=
status_bar_font=
status_bar_font_size=
header_font=
header_font_size=
normal_background_color=
normal_foreground_color=
normal_bold=
highlighted_background_color=
highlighted_foreground_color=
highlighted_bold=
current_sort_background_color=
current_sort_foreground_color=
current_sort_bold=
current_sort_highlighted_background_color=
current_sort_highlighted_foreground_color=
current_sort_highlighted_bold=
selected_background_color=
selected_foreground_color=
selected_bold=
selected_highlighted_background_color=
selected_highlighted_foreground_color=
selected_highlighted_bold=
selected_inactive_background_color=
selected_inactive_foreground_color=
selected_inactive_bold=
selected_inactive_highlighted_background_color=
selected_inactive_highlighted_foreground_color=
selected_inactive_highlighted_bold=
drop_target_background_color=
drop_target_foreground_color=
drop_target_bold=
drop_target_highlighted_background_color=
drop_target_highlighted_foreground_color=
drop_target_highlighted_bold=
mouseover_background_color=
mouseover_foreground_color=
mouseover_bold=
mouseover_highlighted_background_color=
mouseover_highlighted_foreground_color=
mouseover_highlighted_bold=
mouseover_current_sort_background_color=
mouseover_current_sort_foreground_color=
mouseover_current_sort_bold=
mouseover_current_sort_highlighted_background_color=
mouseover_current_sort_highlighted_foreground_color=
mouseover_current_sort_highlighted_bold=
alternate_row_background_color=
alternate_row_foreground_color=
alternate_row_bold=
alternate_row_highlighted_background_color=
alternate_row_highlighted_foreground_color=
alternate_row_highlighted_bold=
current_sort_alternate_row_background_color=
current_sort_alternate_row_foreground_color=
current_sort_alternate_row_bold=
current_sort_alternate_row_highlighted_background_color=
current_sort_alternate_row_highlighted_foreground_color=
current_sort_alternate_row_highlighted_bold=
hot_background_color=
hot_foreground_color=
hot_bold=
hot_highlighted_background_color=
hot_highlighted_foreground_color=
hot_highlighted_bold=
selected_hot_background_color=
selected_hot_foreground_color=
selected_hot_bold=
selected_hot_highlighted_background_color=
selected_hot_highlighted_foreground_color=
selected_hot_highlighted_bold=
selected_inactive_hot_background_color=
selected_inactive_hot_foreground_color=
selected_inactive_hot_bold=
selected_inactive_hot_highlighted_background_color=
selected_inactive_hot_highlighted_foreground_color=
selected_inactive_hot_highlighted_bold=
thumbnail_mouseover_background_color=
thumbnail_mouseover_foreground_color=
thumbnail_mouseover_bold=
thumbnail_mouseover_highlighted_background_color=
thumbnail_mouseover_highlighted_foreground_color=
thumbnail_mouseover_highlighted_bold=

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,740 @@
; Please make sure Everything is not running before modifying this file.
[Everything]
run_as_admin=0
allow_http_server=1
allow_etp_server=1
window_x=130
window_y=130
window_wide=794
window_high=664
maximized=0
minimized=0
fullscreen=0
ontop=0
bring_into_view=1
alpha=255
match_whole_word=0
match_path=0
match_case=0
match_diacritics=0
match_regex=0
view=0
thumbnail_size=64
thumbnail_fill=0
min_thumbnail_size=32
max_thumbnail_size=256
medium_thumbnail_size=64
large_thumbnail_size=128
extra_large_thumbnail_size=256
thumbnail_load_size=0
thumbnail_overlay_icon=1
shell_max_path=0
allow_multiple_windows=0
allow_multiple_instances=0
run_in_background=1
show_in_taskbar=1
show_tray_icon=0
minimize_to_tray=0
toggle_window_from_tray_icon=0
alternate_row_color=0
show_mouseover=0
check_for_updates_on_startup=0
beta_updates=0
show_highlighted_search_terms=1
text_size=0
hide_empty_search_results=0
clear_selection_on_search=1
show_focus_on_search=0
new_window_key=0
show_window_key=0
toggle_window_key=0
language=0
show_selected_item_in_statusbar=1
statusbar_selected_item_format=
show_size_in_statusbar=0
statusbar_size_format=0
open_folder_command2=
open_file_command2=
open_path_command2=
explore_command2=
explore_path_command2=
window_title_format=
taskbar_notification_title_format=
instance_name=
translucent_selection_rectangle_alpha=70
min_zoom=-6
max_zoom=27
context_menu_type=0
context_menu_shell_extensions=1
auto_include_fixed_volumes=1
auto_include_removable_volumes=0
auto_remove_offline_ntfs_volumes=1
auto_remove_moved_ntfs_volumes=1
auto_include_fixed_refs_volumes=1
auto_include_removable_refs_volumes=0
auto_remove_offline_refs_volumes=1
auto_remove_moved_refs_volumes=1
find_mount_points_on_removable_volumes=0
scan_volume_drive_letters=1
last_export_type=0
max_threads=0
reuse_threads=1
find_subfolders_and_files_max_threads=0
single_parent_context_menu=0
auto_size_1=512
auto_size_2=640
auto_size_3=768
auto_size_aspect_ratio_x=9
auto_size_aspect_ratio_y=7
auto_size_width_only=0
auto_size_path_x=1
auto_size_path_y=2
sticky_vscroll_bottom=1
last_options_page=0
draw_focus_rect=1
date_format=
time_format=
listview_item_high=0
single_click_open=0
underline_icon_titles=0
icons_only=0
icon_shell_extensions=1
auto_scroll_repeat_delay=250
auto_scroll_repeat_rate=50
open_many_files_warning_threshold=16
set_foreground_window_attach_thread_input=0
debug=0
debug_log=0
verbose=0
lvm=1
ipc=1
home_match_case=0
home_match_whole_word=0
home_match_path=0
home_match_diacritics=0
home_regex=0
home_search=1
home_filter=0
home_sort=0
home_view=0
home_index=1
allow_multiple_windows_from_tray=0
single_click_tray=0
close_on_execute=0
double_click_path=0
update_display_after_scroll=0
update_display_after_mask=1
auto_scroll_view=0
double_quote_copy_as_path=0
snap=0
snaplen=10
rename_select_filepart_only=0
rename_move_caret_to_selection_end=0
rename_nav=0
search_edit_move_caret_to_selection_end=0
search_edit_drag_accept_files=0
select_search_on_mouse_click=1
focus_search_on_activate=0
reset_vscroll_on_search=1
wrap_focus=0
load_icon_priority=0
load_thumbnail_priority=0
load_fileinfo_priority=0
always_request_all_fileinfo=0
header_high=0
hide_on_close=0
max_hidden_windows=0
winmm=0
menu_escape_amp=1
menu_folders=0
menu_folder_separator=
menu_items_per_column=0
new_inherit=1
full_row_select=0
tray_show_command_line=
dpi=96
ctrl_mouse_wheel_action=1
lvm_scroll=1
allow_open=1
allow_context_menu=1
allow_delete=1
allow_rename=1
allow_cut=1
allow_copy=1
allow_paste=1
allow_drag_drop=1
allow_window_message_filter_dragdrop=0
auto_column_widths=0
hotkey_explorer_path_search=0
hotkey_user_notification_state=0
get_key_name_text=1
paste_new_line_op=0
esc_cancel_action=1
fast_ascii_search=1
match_path_when_search_contains_path_separator=1
allow_literal_operators=0
allow_round_bracket_parenthesis=0
expand_environment_variables=0
search_as_you_type=1
always_update_query_on_search_parameter_change=0
convert_forward_slash_to_backslash=0
match_whole_filename_when_using_wildcards=1
operator_precedence=0
replace_exact_trailing_star_dot_star_with_star=1
allow_exclamation_point_not=1
search_command_prefix=
auto_complete_search_command=1
double_buffer=1
search=
show_number_of_results_with_selection=0
date_descending_first=0
size_descending_first=0
size_format=2
alpha_select=0
tooltips=1
listview_tooltips=1
show_detailed_listview_tooltips=1
rtl_listview_edit=0
force_path_ltr_order=1
force_path_left_align=1
date_time_order=0
date_time_align=1
size_align=3
invert_layout=0
update_layout_on_input_language_change=0
control_shift_action=3
change_search_rtl_reading_action=3
invert_layout_action=3
bookmark_remember_case=1
bookmark_remember_wholeword=1
bookmark_remember_path=1
bookmark_remember_diacritic=1
bookmark_remember_regex=1
bookmark_remember_sort=1
bookmark_remember_view=1
bookmark_remember_filter=1
bookmark_remember_index=1
bookmark_remember_search=1
bookmark_organize_x=0
bookmark_organize_y=0
bookmark_organize_wide=0
bookmark_organize_high=0
exclude_list_enabled=1
exclude_hidden_files_and_folders=0
exclude_system_files_and_folders=0
include_only_files=
exclude_files=
db_location=
db_multi_user_filename=0
db_compress=0
index_size=1
fast_size_sort=1
index_date_created=0
fast_date_created_sort=0
index_date_modified=1
fast_date_modified_sort=1
index_date_accessed=0
fast_date_accessed_sort=0
index_attributes=0
fast_attributes_sort=0
index_folder_size=0
fast_path_sort=1
fast_extension_sort=0
extended_information_cache_monitor=1
db_update_thread_priority=-15
index_recent_changes=1
refs_file_id_extd_directory_info_buffer_size=0
folder_update_thread_mode_background=0
folder_update_rescan_asap=1
monitor_thread_mode_background=1
monitor_retry_delay=30000
monitor_update_delay=1000
monitor_pause=0
usn_record_filter=0xffffffff
cancel_delay=0x000003e8
allow_ntfs_open_file_by_id=1
always_update_folder_recent_change=0
editor_x=0
editor_y=0
editor_wide=0
editor_high=0
editor_maximized=0
file_list_relative_paths=0
rename_x=0
rename_y=0
rename_wide=0
rename_high=0
rename_match_case=0
rename_regex=0
advanced_copy_to_x=0
advanced_copy_to_y=0
advanced_copy_to_wide=0
advanced_copy_to_high=0
advanced_copy_to_match_case=0
advanced_copy_to_regex=0
advanced_move_to_x=0
advanced_move_to_y=0
advanced_move_to_wide=0
advanced_move_to_high=0
advanced_move_to_match_case=0
advanced_move_to_regex=0
advanced_search_x=0
advanced_search_y=0
advanced_search_wide=0
advanced_search_high=0
advanced_search_page_y_offset=0
advanced_search_focus_id=0
advanced_search_warnings=1
max_recv_size=8388608
display_full_path_name=0
size_tiny=10240
size_small=102400
size_medium=1048576
size_large=16777216
size_huge=134217728
themed_toolbar=1
show_copy_name=2
show_copy_path=2
show_copy_full_name=2
show_open_path=2
show_explore=2
show_explore_path=2
copy_path_folder_append_backslash=0
custom_verb01=
custom_verb02=
custom_verb03=
custom_verb04=
custom_verb05=
custom_verb06=
custom_verb07=
custom_verb08=
custom_verb09=
custom_verb10=
custom_verb11=
custom_verb12=
filters_visible=0
filters_wide=128
filters_right_align=1
filters_tab_stop=0
filter=
filter_everything_name=
filter_organize_x=0
filter_organize_y=0
filter_organize_wide=0
filter_organize_high=0
preview_visible=0
preview_x=640
preview_tab_stop=0
preview_mag_filter=0
preview_min_filter=0
preview_fill=0
show_preview_handlers_in_preview_pane=0
preview_load_size=0
preview_context=0x00000000
preview_release_handler_on_clear=0
sort=Run Count
sort_ascending=0
always_keep_sort=0
index=0
index_file_list=
index_etp_server=
index_link_type=1
status_bar_visible=1
select_search_on_focus_mode=1
select_search_on_set_mode=2
search_history_enabled=0
run_history_enabled=1
search_history_days_to_keep=90
run_history_days_to_keep=90
search_history_keep_forever=1
run_history_keep_forever=1
search_history_always_suggest=0
search_history_always_suggest_extend_toolbar=0
search_history_visible_count_max=12
search_history_always_suggest_visible_count_max=1
search_history_show_all_max=256
search_history_suggestion_max=256
search_history_show_all_sort=2
search_history_suggestion_sort=1
search_history_show_above=0
search_history_sort=2
search_history_sort_ascending=0
search_history_x=0
search_history_y=0
search_history_wide=0
search_history_high=0
search_history_column_search_wide=208
search_history_column_search_order=0
search_history_column_count_wide=128
search_history_column_count_order=1
search_history_column_date_wide=128
search_history_column_date_order=2
etp_server_enabled=0
etp_server_bindings=
etp_server_port=21
etp_server_username=
etp_server_password=
etp_server_welcome_message=
etp_server_log_file_name=
etp_server_logging_enabled=0
etp_server_log_max_size=4194304
etp_server_log_delta_size=524288
etp_server_allow_file_download=1
ftp_allow_port=1
ftp_check_data_connection_ip=1
http_server_enabled=0
http_server_bindings=
http_title_format=
http_server_port=80
http_server_username=
http_server_password=
http_server_home=
http_server_default_page=
http_server_log_file_name=
http_server_logging_enabled=0
http_server_log_max_size=4194304
http_server_log_delta_size=524288
http_server_allow_file_download=1
http_server_items_per_page=32
http_server_show_drive_labels=0
http_server_strings=
http_server_header=
service_pipe_name=
name_column_pos=0
name_column_width=256
path_column_visible=1
path_column_pos=1
path_column_width=256
size_column_visible=1
size_column_pos=2
size_column_width=96
extension_column_visible=0
extension_column_pos=3
extension_column_width=96
type_column_visible=0
type_column_pos=4
type_column_width=96
last_write_time_column_visible=1
last_write_time_column_pos=3
last_write_time_column_width=153
creation_time_column_visible=0
creation_time_column_pos=6
creation_time_column_width=153
date_accessed_column_visible=0
date_accessed_column_pos=7
date_accessed_column_width=153
attribute_column_visible=0
attribute_column_pos=8
attribute_column_width=70
date_recently_changed_column_visible=0
date_recently_changed_column_pos=9
date_recently_changed_column_width=153
run_count_column_visible=0
run_count_column_pos=10
run_count_column_width=96
date_run_column_visible=0
date_run_column_pos=11
date_run_column_width=153
file_list_filename_column_visible=0
file_list_filename_column_pos=12
file_list_filename_column_width=96
translucent_selection_rectangle_background_color=
translucent_selection_rectangle_border_color=
thumbnail_mouseover_border_color=
preview_background_color=
ntfs_volume_guids="\\\\?\\Volume{6afe1915-0a0b-4e59-96bc-666ff914ea4f}","\\\\?\\Volume{71be44cf-e03a-462f-a9c8-b53c16e002a4}"
ntfs_volume_paths="C:","D:"
ntfs_volume_roots="",""
ntfs_volume_includes=1,1
ntfs_volume_load_recent_changes=0,0
ntfs_volume_include_onlys="",""
ntfs_volume_monitors=1,1
refs_volume_guids=
refs_volume_paths=
refs_volume_roots=
refs_volume_includes=
refs_volume_load_recent_changes=
refs_volume_include_onlys=
refs_volume_monitors=
filelists=
filelist_monitor_changes=
folders=
folder_monitor_changes=
folder_buffer_size_list=
folder_rescan_if_full_list=
folder_update_types=
folder_update_days=
folder_update_ats=
folder_update_intervals=
folder_update_interval_types=
exclude_folders=
connect_history_hosts=
connect_history_ports=
connect_history_usernames=
connect_history_link_types=
etp_client_rewrite_patterns=
etp_client_rewrite_substitutions=
file_new_search_window_keys=334
file_open_file_list_keys=335
file_close_file_list_keys=
file_close_keys=343,27
file_export_keys=339
file_copy_full_name_to_clipboard_keys=9539
file_copy_path_to_clipboard_keys=
file_set_run_count_keys=
file_create_shortcut_keys=
file_delete_keys=8238
file_delete_permanently_keys=9262
file_edit_keys=
file_open_keys=8205
file_open_selection_and_close_everything_keys=
file_explore_path_keys=
file_open_new_keys=
file_open_path_keys=8461
file_open_with_keys=
file_open_with_default_verb_keys=
file_play_keys=
file_preview_keys=
file_print_keys=
file_print_to_keys=
file_properties_keys=8717
file_read_extended_information_keys=8517
file_rename_keys=8305
file_run_as_keys=
file_exit_keys=337
file_copy_name_to_clipboard_keys=
file_open_selection_and_do_not_close_everything_keys=
file_open_most_run_keys=
file_open_last_run_keys=
file_custom_verb_1_keys=
file_custom_verb_2_keys=
file_custom_verb_3_keys=
file_custom_verb_4_keys=
file_custom_verb_5_keys=
file_custom_verb_6_keys=
file_custom_verb_7_keys=
file_custom_verb_8_keys=
file_custom_verb_9_keys=
file_custom_verb_10_keys=
file_custom_verb_11_keys=
file_custom_verb_12_keys=
indexes_folders_rescan_all_now_keys=
indexes_force_rebuild_keys=
edit_cut_keys=8536
edit_copy_keys=8515,8493
edit_paste_keys=8534,9261
edit_select_all_keys=8513
edit_invert_selection_keys=
edit_copy_to_folder_keys=
edit_move_to_folder_keys=
edit_advanced_advanced_copy_to_folder_keys=
edit_advanced_advanced_move_to_folder_keys=
view_filters_keys=
view_preview_keys=592
view_status_bar_keys=
view_details_keys=1334
view_medium_thumbnails_keys=1331
view_large_thumbnails_keys=1330
view_extra_large_thumbnails_keys=1329
view_increase_thumbnail_size_keys=1467
view_decrease_thumbnail_size_keys=1469
view_window_size_small_keys=561
view_window_size_medium_keys=562
view_window_size_large_keys=563
view_window_size_auto_fit_keys=564
view_zoom_zoom_in_keys=443
view_zoom_zoom_out_keys=445
view_zoom_reset_keys=304,352
view_go_to_back_keys=549,166
view_go_to_forward_keys=551,167
view_go_to_home_keys=548
view_go_to_show_all_history_keys=1352,328
view_sort_by_name_keys=305
view_sort_by_path_keys=306
view_sort_by_size_keys=307
view_sort_by_extension_keys=308
view_sort_by_type_keys=309
view_sort_by_date_modified_keys=310
view_sort_by_date_created_keys=311
view_sort_by_attributes_keys=312
view_sort_by_file_list_filename_keys=
view_sort_by_run_count_keys=
view_sort_by_date_run_keys=
view_sort_by_date_recently_changed_keys=313
view_sort_by_date_accessed_keys=
view_sort_by_ascending_keys=
view_sort_by_descending_keys=
view_refresh_keys=116
view_fullscreen_keys=122
view_toggle_ltrrtl_direction_keys=
view_on_top_never_keys=
view_on_top_always_keys=
view_on_top_while_searching_keys=
search_match_case_keys=329
search_match_whole_word_keys=322
search_match_path_keys=341
search_match_diacritics_keys=333
search_enable_regex_keys=338
search_advanced_search_keys=
search_add_to_filters_keys=
search_organize_filters_keys=1350
bookmarks_add_to_bookmarks_keys=324
bookmarks_organize_bookmarks_keys=1346
tools_options_keys=336
tools_console_keys=448
tools_file_list_editor_keys=
tools_connect_to_etp_server_keys=
tools_disconnect_from_etp_server_keys=
help_everything_help_keys=112
help_search_syntax_keys=
help_regex_syntax_keys=
help_command_line_options_keys=
help_everything_website_keys=
help_check_for_updates_keys=
help_about_everything_keys=368
help_donate_keys=
search_edit_focus_search_edit_keys=326,114,580
search_edit_delete_previous_word_keys=4360
search_edit_auto_complete_search_keys=4384
search_edit_show_search_history_keys=
search_edit_show_all_search_history_keys=4646,4648
result_list_item_up_keys=8230,4134
result_list_item_down_keys=8232,4136
result_list_page_up_keys=8225,4129
result_list_page_down_keys=8226,4130
result_list_start_of_list_keys=8228
result_list_end_of_list_keys=8227
result_list_item_up_extend_keys=9254,5158
result_list_item_down_extend_keys=9256,5160
result_list_page_up_extend_keys=9249,5153
result_list_page_down_extend_keys=9250,5154
result_list_start_of_list_extend_keys=9252
result_list_end_of_list_extend_keys=9251
result_list_focus_up_keys=8486,4390
result_list_focus_down_keys=8488,4392
result_list_focus_page_up_keys=8481,4385
result_list_focus_page_down_keys=8482,4386
result_list_focus_start_of_list_keys=8484
result_list_focus_end_of_list_keys=8483
result_list_focus_up_extend_keys=9510,5414
result_list_focus_down_extend_keys=9512,5416
result_list_focus_page_up_extend_keys=9505,5409
result_list_focus_page_down_extend_keys=9506,5410
result_list_focus_start_of_list_extend_keys=9508
result_list_focus_end_of_list_extend_keys=9507
result_list_focus_result_list_keys=
result_list_focus_highest_run_count_result_keys=
result_list_focus_last_run_result_keys=
result_list_toggle_path_column_keys=
result_list_toggle_size_column_keys=
result_list_toggle_extension_column_keys=
result_list_toggle_type_column_keys=
result_list_toggle_date_modified_column_keys=
result_list_toggle_date_created_column_keys=
result_list_toggle_attributes_column_keys=
result_list_toggle_file_list_filename_column_keys=
result_list_toggle_run_count_column_keys=
result_list_toggle_date_recently_changed_column_keys=
result_list_toggle_date_accessed_column_keys=
result_list_toggle_date_run_column_keys=
result_list_size_all_columns_to_fit_keys=8555
result_list_size_result_list_to_fit_keys=
result_list_context_menu_keys=9337
result_list_scroll_left_or_thumbnail_left_keys=8229
result_list_scroll_right_or_thumbnail_right_keys=8231
result_list_scroll_page_left_or_thumbnail_focus_left_keys=8485
result_list_scroll_page_right_or_thumbnail_focus_right_keys=8487
result_list_left_extend_keys=9253
result_list_right_extend_keys=9255
result_list_focus_left_extend_keys=9509
result_list_focus_right_extend_keys=9511
result_list_select_focus_keys=8224
result_list_toggle_focus_selection_keys=8480
result_list_copy_as_csv_keys=
preview_focus_preview_keys=
result_list_font=
result_list_font_size=
search_edit_font=
search_edit_font_size=
status_bar_font=
status_bar_font_size=
header_font=
header_font_size=
normal_background_color=
normal_foreground_color=
normal_bold=
highlighted_background_color=
highlighted_foreground_color=
highlighted_bold=
current_sort_background_color=
current_sort_foreground_color=
current_sort_bold=
current_sort_highlighted_background_color=
current_sort_highlighted_foreground_color=
current_sort_highlighted_bold=
selected_background_color=
selected_foreground_color=
selected_bold=
selected_highlighted_background_color=
selected_highlighted_foreground_color=
selected_highlighted_bold=
selected_inactive_background_color=
selected_inactive_foreground_color=
selected_inactive_bold=
selected_inactive_highlighted_background_color=
selected_inactive_highlighted_foreground_color=
selected_inactive_highlighted_bold=
drop_target_background_color=
drop_target_foreground_color=
drop_target_bold=
drop_target_highlighted_background_color=
drop_target_highlighted_foreground_color=
drop_target_highlighted_bold=
mouseover_background_color=
mouseover_foreground_color=
mouseover_bold=
mouseover_highlighted_background_color=
mouseover_highlighted_foreground_color=
mouseover_highlighted_bold=
mouseover_current_sort_background_color=
mouseover_current_sort_foreground_color=
mouseover_current_sort_bold=
mouseover_current_sort_highlighted_background_color=
mouseover_current_sort_highlighted_foreground_color=
mouseover_current_sort_highlighted_bold=
alternate_row_background_color=
alternate_row_foreground_color=
alternate_row_bold=
alternate_row_highlighted_background_color=
alternate_row_highlighted_foreground_color=
alternate_row_highlighted_bold=
current_sort_alternate_row_background_color=
current_sort_alternate_row_foreground_color=
current_sort_alternate_row_bold=
current_sort_alternate_row_highlighted_background_color=
current_sort_alternate_row_highlighted_foreground_color=
current_sort_alternate_row_highlighted_bold=
hot_background_color=
hot_foreground_color=
hot_bold=
hot_highlighted_background_color=
hot_highlighted_foreground_color=
hot_highlighted_bold=
selected_hot_background_color=
selected_hot_foreground_color=
selected_hot_bold=
selected_hot_highlighted_background_color=
selected_hot_highlighted_foreground_color=
selected_hot_highlighted_bold=
selected_inactive_hot_background_color=
selected_inactive_hot_foreground_color=
selected_inactive_hot_bold=
selected_inactive_hot_highlighted_background_color=
selected_inactive_hot_highlighted_foreground_color=
selected_inactive_hot_highlighted_bold=
thumbnail_mouseover_background_color=
thumbnail_mouseover_foreground_color=
thumbnail_mouseover_bold=
thumbnail_mouseover_highlighted_background_color=
thumbnail_mouseover_highlighted_foreground_color=
thumbnail_mouseover_highlighted_bold=

Binary file not shown.

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Plugins.EveryThing.Constant
{
public class EveryThingConst
{
public const int EVERYTHING_OK = 0;
public const int EVERYTHING_ERROR_MEMORY = 1;
public const int EVERYTHING_ERROR_IPC = 2;
public const int EVERYTHING_ERROR_REGISTERCLASSEX = 3;
public const int EVERYTHING_ERROR_CREATEWINDOW = 4;
public const int EVERYTHING_ERROR_CREATETHREAD = 5;
public const int EVERYTHING_ERROR_INVALIDINDEX = 6;
public const int EVERYTHING_ERROR_INVALIDCALL = 7;
public const int EVERYTHING_REQUEST_FILE_NAME = 0x00000001;
public const int EVERYTHING_REQUEST_PATH = 0x00000002;
public const int EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME = 0x00000004;
public const int EVERYTHING_REQUEST_EXTENSION = 0x00000008;
public const int EVERYTHING_REQUEST_SIZE = 0x00000010;
public const int EVERYTHING_REQUEST_DATE_CREATED = 0x00000020;
public const int EVERYTHING_REQUEST_DATE_MODIFIED = 0x00000040;
public const int EVERYTHING_REQUEST_DATE_ACCESSED = 0x00000080;
public const int EVERYTHING_REQUEST_ATTRIBUTES = 0x00000100;
public const int EVERYTHING_REQUEST_FILE_LIST_FILE_NAME = 0x00000200;
public const int EVERYTHING_REQUEST_RUN_COUNT = 0x00000400;
public const int EVERYTHING_REQUEST_DATE_RUN = 0x00000800;
public const int EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED = 0x00001000;
public const int EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME = 0x00002000;
public const int EVERYTHING_REQUEST_HIGHLIGHTED_PATH = 0x00004000;
public const int EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME = 0x00008000;
public const int EVERYTHING_SORT_NAME_ASCENDING = 1;
public const int EVERYTHING_SORT_NAME_DESCENDING = 2;
public const int EVERYTHING_SORT_PATH_ASCENDING = 3;
public const int EVERYTHING_SORT_PATH_DESCENDING = 4;
public const int EVERYTHING_SORT_SIZE_ASCENDING = 5;
public const int EVERYTHING_SORT_SIZE_DESCENDING = 6;
public const int EVERYTHING_SORT_EXTENSION_ASCENDING = 7;
public const int EVERYTHING_SORT_EXTENSION_DESCENDING = 8;
public const int EVERYTHING_SORT_TYPE_NAME_ASCENDING = 9;
public const int EVERYTHING_SORT_TYPE_NAME_DESCENDING = 10;
public const int EVERYTHING_SORT_DATE_CREATED_ASCENDING = 11;
public const int EVERYTHING_SORT_DATE_CREATED_DESCENDING = 12;
public const int EVERYTHING_SORT_DATE_MODIFIED_ASCENDING = 13;
public const int EVERYTHING_SORT_DATE_MODIFIED_DESCENDING = 14;
public const int EVERYTHING_SORT_ATTRIBUTES_ASCENDING = 15;
public const int EVERYTHING_SORT_ATTRIBUTES_DESCENDING = 16;
public const int EVERYTHING_SORT_FILE_LIST_FILENAME_ASCENDING = 17;
public const int EVERYTHING_SORT_FILE_LIST_FILENAME_DESCENDING = 18;
public const int EVERYTHING_SORT_RUN_COUNT_ASCENDING = 19;
public const int EVERYTHING_SORT_RUN_COUNT_DESCENDING = 20;
public const int EVERYTHING_SORT_DATE_RECENTLY_CHANGED_ASCENDING = 21;
public const int EVERYTHING_SORT_DATE_RECENTLY_CHANGED_DESCENDING = 22;
public const int EVERYTHING_SORT_DATE_ACCESSED_ASCENDING = 23;
public const int EVERYTHING_SORT_DATE_ACCESSED_DESCENDING = 24;
public const int EVERYTHING_SORT_DATE_RUN_ASCENDING = 25;
public const int EVERYTHING_SORT_DATE_RUN_DESCENDING = 26;
public const int EVERYTHING_TARGET_MACHINE_X86 = 1;
public const int EVERYTHING_TARGET_MACHINE_X64 = 2;
public const int EVERYTHING_TARGET_MACHINE_ARM = 3;
}
}

View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Plugins.EveryThing
{
public class EveryThing32
{
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern UInt32 Everything_SetSearchW(string lpSearchString);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetMatchPath(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetMatchCase(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetMatchWholeWord(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetRegex(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetMax(UInt32 dwMax);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetOffset(UInt32 dwOffset);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetMatchPath();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetMatchCase();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetMatchWholeWord();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetRegex();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetMax();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetOffset();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern IntPtr Everything_GetSearchW();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetLastError();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_Query(bool bWait);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SortResultsByPath();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetNumFileResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetNumFolderResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetNumResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetTotFileResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetTotFolderResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetTotResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_IsVolumeResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_IsFolderResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_IsFileResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern void Everything_GetResultFullPathName(UInt32 nIndex, StringBuilder lpString, UInt32 nMaxCount);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_Reset();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultFileName(UInt32 nIndex);
// Everything 1.4
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetSort(UInt32 dwSortType);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetSort();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetResultListSort();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern void Everything_SetRequestFlags(UInt32 dwRequestFlags);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetRequestFlags();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetResultListRequestFlags();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultExtension(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultSize(UInt32 nIndex, out long lpFileSize);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultDateCreated(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultDateModified(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultDateAccessed(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetResultAttributes(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultFileListFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetResultRunCount(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultDateRun(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_GetResultDateRecentlyChanged(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedPath(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedFullPathAndFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_GetRunCountFromFileName(string lpFileName);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_SetRunCountFromFileName(string lpFileName, UInt32 dwRunCount);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern UInt32 Everything_IncRunCountFromFileName(string lpFileName);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything32.dll")]
public static extern bool Everything_Exit();
}
}

View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Plugins.EveryThing
{
public class EveryThing64
{
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern UInt32 Everything_SetSearchW(string lpSearchString);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetMatchPath(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetMatchCase(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetMatchWholeWord(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetRegex(bool bEnable);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetMax(UInt32 dwMax);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetOffset(UInt32 dwOffset);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetMatchPath();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetMatchCase();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetMatchWholeWord();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetRegex();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetMax();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetOffset();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern IntPtr Everything_GetSearchW();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetLastError();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_Query(bool bWait);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SortResultsByPath();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetNumFileResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetNumFolderResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetNumResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetTotFileResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetTotFolderResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetTotResults();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_IsVolumeResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_IsFolderResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_IsFileResult(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern void Everything_GetResultFullPathName(UInt32 nIndex, StringBuilder lpString, UInt32 nMaxCount);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_Reset();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultFileName(UInt32 nIndex);
// Everything 1.4
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetSort(UInt32 dwSortType);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetSort();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetResultListSort();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern void Everything_SetRequestFlags(UInt32 dwRequestFlags);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetRequestFlags();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetResultListRequestFlags();
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultExtension(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultSize(UInt32 nIndex, out long lpFileSize);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultDateCreated(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultDateModified(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultDateAccessed(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetResultAttributes(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultFileListFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetResultRunCount(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultDateRun(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_GetResultDateRecentlyChanged(UInt32 nIndex, out long lpFileTime);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedPath(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr Everything_GetResultHighlightedFullPathAndFileName(UInt32 nIndex);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_GetRunCountFromFileName(string lpFileName);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_SetRunCountFromFileName(string lpFileName, UInt32 dwRunCount);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern UInt32 Everything_IncRunCountFromFileName(string lpFileName);
[DllImport(@"lib\Plugins\EveryThing\lib\Everything64.dll")]
public static extern bool Everything_Exit();
}
}

View File

@@ -0,0 +1,347 @@
using GeekDesk.Constant;
using GeekDesk.Plugins.EveryThing.Constant;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GeekDesk.Plugins.EveryThing
{
public class EveryThingUtil
{
//每次加载20条
private static long pageCount = 20;
private static UInt32 ui = 0;
public static void EnableEveryThing(int delayTime = 2000)
{
string pluginsPath = Constants.PLUGINS_PATH;
bool Is64Bit = Environment.Is64BitOperatingSystem;
string everyThingPath = pluginsPath + "/EveryThing/" + (Is64Bit ? 64 : 32) + "/EveryThing.exe";
string installUtilPath = "C:\\Windows\\Microsoft.NET\\Framework"+ (Is64Bit ? "64" : "") + "\\v4.0.30319\\InstallUtil.exe";
new Thread(() =>
{
try
{
Thread.Sleep(delayTime);
//判断EveryThing服务是否存在
ServiceController sc = GetService("Everything");
if (sc != null)
{
//判断是否启动
if (sc.Status != ServiceControllerStatus.StartPending
&& sc.Status != ServiceControllerStatus.Running)
{
//启动服务
EveryThingService(ServiceType.START);
}
} else
{
//安装服务
EveryThingService(ServiceType.INSTALL);
}
Thread.Sleep(2000);
if (GetService("Everything") != null)
{
//启动程序
Process exeProcess = new Process();
exeProcess.StartInfo.FileName = everyThingPath;
exeProcess.Start();
int waitTime = 5000;
while (true && waitTime > 0)
{
Thread.Sleep(100);
waitTime -= 100;
exeProcess.CloseMainWindow();
}
}
} catch (Exception e)
{
}
}).Start();
}
enum ServiceType
{
START,
STOP,
INSTALL,
UNINSTALL
}
private static void EveryThingService(ServiceType type)
{
string pluginsPath = Constants.PLUGINS_PATH;
bool Is64Bit = Environment.Is64BitOperatingSystem;
string everyThingPath = pluginsPath + "/EveryThing/" + (Is64Bit ? 64 : 32) + "/EveryThing.exe";
Process p = new Process();
p.StartInfo.FileName = everyThingPath;
string arg;
switch(type)
{
default:
p.StartInfo.Verb = "runas";
arg = "-start-service";
break;
case ServiceType.STOP:
arg = "-stop-service";
break;
case ServiceType.INSTALL:
p.StartInfo.Verb = "runas";
arg = "-install-service";
break;
case ServiceType.UNINSTALL:
arg = "-uninstall-service";
break;
}
p.StartInfo.Arguments = arg;
p.Start();
}
public static ServiceController GetService(string serviceName)
{
ServiceController[] services = ServiceController.GetServices();
foreach (ServiceController s in services)
{
if (s.ServiceName.ToLower().Equals(serviceName.ToLower()))
{
return s;
}
}
return null;
}
public static void DisableEveryThing(bool uninstall = false)
{
try
{
if (Environment.Is64BitOperatingSystem)
{
EveryThing64.Everything_Exit();
}
else
{
EveryThing32.Everything_Exit();
}
}
catch (Exception e) { }
try
{
if (GetService("Everything") != null)
{
if (uninstall)
{
EveryThingService(ServiceType.UNINSTALL);
}
else
{
EveryThingService(ServiceType.STOP);
}
}
}
catch (Exception e) { }
}
public static bool HasNext()
{
return ui < Everything_GetNumResults();
}
public static ObservableCollection<IconInfo> Search(string text)
{
ui = 0;
//EveryThing全盘搜索
Everything_Reset();
EveryThingUtil.Everything_SetSearchW(text);
EveryThingUtil.Everything_SetRequestFlags(
EveryThingConst.EVERYTHING_REQUEST_FILE_NAME
| EveryThingConst.EVERYTHING_REQUEST_PATH
| EveryThingConst.EVERYTHING_REQUEST_DATE_MODIFIED
| EveryThingConst.EVERYTHING_REQUEST_SIZE);
EveryThingUtil.Everything_SetSort(
EveryThingConst.EVERYTHING_SORT_TYPE_NAME_DESCENDING
| EveryThingConst.EVERYTHING_SORT_RUN_COUNT_DESCENDING
| EveryThingConst.EVERYTHING_SORT_DATE_MODIFIED_DESCENDING
);
EveryThingUtil.Everything_Query(true);
return NextPage();
}
public static ObservableCollection<IconInfo> NextPage()
{
if (ui == 0)
{
pageCount = 40;
} else
{
pageCount = 20;
}
string filePath;
const int bufsize = 260;
StringBuilder buf = new StringBuilder(bufsize);
ObservableCollection<IconInfo> iconBakList = new ObservableCollection<IconInfo>();
for (long count = 0; ui < Everything_GetNumResults() && count < pageCount; count++, ui++)
{
buf.Clear();
EveryThingUtil.Everything_GetResultFullPathName(ui, buf, bufsize);
filePath = buf.ToString();
string tempPath = filePath;
string ext = "";
if (!ImageUtil.IsSystemItem(filePath))
{
ext = System.IO.Path.GetExtension(filePath).ToLower();
}
//if (".lnk".Equals(ext))
//{
// string targetPath = FileUtil.GetTargetPathByLnk(filePath);
// if (targetPath != null)
// {
// filePath = targetPath;
// }
//}
string name = System.IO.Path.GetFileNameWithoutExtension(tempPath);
if (string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(tempPath))
{
name = tempPath.Substring(tempPath.LastIndexOf("\\"));
}
IconInfo iconInfo = new IconInfo
{
Path_NoWrite = filePath,
LnkPath_NoWrite = tempPath,
BitmapImage_NoWrite = ImageUtil.GetBitmapIconByUnknownPath(filePath),
StartArg_NoWrite = FileUtil.GetArgByLnk(tempPath),
Name_NoWrite = name,
};
//缓存信息 异步加载图标
iconBakList.Add(iconInfo);
}
return iconBakList;
}
public static UInt32 Everything_SetSearchW(string lpSearchString)
{
if (Environment.Is64BitOperatingSystem)
{
return EveryThing64.Everything_SetSearchW(lpSearchString);
} else
{
return EveryThing32.Everything_SetSearchW(lpSearchString);
}
}
public static void Everything_SetRequestFlags(UInt32 dwRequestFlags)
{
if (Environment.Is64BitOperatingSystem)
{
EveryThing64.Everything_SetRequestFlags(dwRequestFlags);
}
else
{
EveryThing32.Everything_SetRequestFlags(dwRequestFlags);
}
}
public static void Everything_SetSort(UInt32 dwSortType)
{
if (Environment.Is64BitOperatingSystem)
{
EveryThing64.Everything_SetSort(dwSortType);
}
else
{
EveryThing32.Everything_SetSort(dwSortType);
}
}
public static bool Everything_Query(bool bWait)
{
if (Environment.Is64BitOperatingSystem)
{
return EveryThing64.Everything_Query(bWait);
}
else
{
return EveryThing32.Everything_Query(bWait);
}
}
public static UInt32 Everything_GetNumResults()
{
if (Environment.Is64BitOperatingSystem)
{
return EveryThing64.Everything_GetNumResults();
}
else
{
return EveryThing32.Everything_GetNumResults();
}
}
public static void Everything_GetResultFullPathName(UInt32 nIndex, StringBuilder lpString, UInt32 nMaxCount)
{
if (Environment.Is64BitOperatingSystem)
{
EveryThing64.Everything_GetResultFullPathName(nIndex, lpString, nMaxCount);
}
else
{
EveryThing32.Everything_GetResultFullPathName(nIndex, lpString, nMaxCount);
}
}
public static void Everything_Reset()
{
if (Environment.Is64BitOperatingSystem)
{
EveryThing64.Everything_Reset();
}
else
{
EveryThing32.Everything_Reset();
}
}
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShowSeconds.Common
{
public class Constants
{
public readonly static string MY_UUID = "8400A17AEEF7C029";
//dark theam
public readonly static System.Windows.Media.SolidColorBrush darkBG
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(46, 50, 54),
Opacity = 0.8
};
public readonly static System.Windows.Media.SolidColorBrush darkFont
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(255, 255, 255)
};
//light theam
public readonly static System.Windows.Media.SolidColorBrush lightBG
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(236, 244, 251),
Opacity = 1
};
public readonly static System.Windows.Media.SolidColorBrush lightFont
= new System.Windows.Media.SolidColorBrush
{
Color = System.Windows.Media.Color.FromRgb(65, 63, 61),
};
}
}

View File

@@ -0,0 +1,32 @@
<Window x:Class="ShowSeconds.SecondsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
Height="90"
Width="160"
WindowStyle="None"
Title=""
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"
Focusable="True"
Loaded="Window_Loaded"
>
<Grid Margin="20">
<Grid.Effect>
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
RenderingBias="Quality" ShadowDepth="2"/>
</Grid.Effect>
<Border x:Name="BGBorder" CornerRadius="8" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndSlideFromRight}, Event=Visibility, Delay=0}">
<TextBlock x:Name="SecondsText" HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
FontWeight="Bold"
Foreground="White"
Text="{Binding Seconds}"/>
</Border>
</Grid>
</Window>

View File

@@ -0,0 +1,318 @@
using GeekDesk.Util;
using Gma.System.MouseKeyHook;
using ShowSeconds.Common;
using GeekDesk.Util;
using ShowSeconds.ViewModel;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using GeekDesk.MyThread;
using GeekDesk;
using System.Collections;
namespace ShowSeconds
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class SecondsWindow : Window
{
private System.Drawing.Color beforeColor;
private System.Drawing.Color topBeforeColor;
private bool expandClock = true; //是否展开时钟
private System.Windows.Forms.Timer timer;
private static double lProportion = 0.82;
private static double tProportion = 0.03;
private static int sleepTime = 1000;
public SecondsWindow()
{
SecondsDataContext dc = new SecondsDataContext
{
Seconds = (DateTime.Now.Hour).ToString() + ":" +
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second)
};
InitializeComponent();
SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 47, 52, 44))
{
Opacity = 0.8
};
try
{
Hashtable settings = (Hashtable)ConfigurationManager.GetSection("ShowSecondsSettings");
lProportion = Convert.ToDouble(settings["LProportion"]);
tProportion = Convert.ToDouble(settings["TProportion"]);
sleepTime = Convert.ToInt32(settings["DelayTime"]);
}
catch (Exception ex)
{
lProportion = 0.82;
tProportion = 0.03;
sleepTime = 1000;
}
BGBorder.Background = scb;
this.DataContext = dc;
this.Topmost = true;
BGBorder.Visibility = Visibility.Collapsed;
this.Show();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
timer = new System.Windows.Forms.Timer();
timer.Interval = 1000;
timer.Tick += Timer_Tick;
Dispatcher secondsDP = DispatcherBuild.Build();
IKeyboardMouseEvents secondsHook = Hook.GlobalEvents();
secondsDP.Invoke((Action)(() =>
{
secondsHook.MouseDownExt += SecondsBakColorFun;
secondsHook.MouseUpExt += SecondsHookSetFuc;
}));
HideWindowUtil.HideAltTab(this);
}
private void Timer_Tick(object sender, EventArgs e)
{
string str = (DateTime.Now.Hour).ToString() + ":" +
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second);
SecondsDataContext dc = this.DataContext as SecondsDataContext;
dc.Seconds = str;
}
private static string FormatMS(int ms)
{
if (ms < 10)
{
return "0" + ms;
}
else
{
return ms.ToString();
}
}
private void SecondsHookSetFuc(object sender, MouseEventExtArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
if (ScreenUtil.IsPrimaryFullScreen()) return;
App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() =>
{
try
{
int x = e.X;
int y = e.Y;
double w = 1920;
double h = 1080;
double width = SystemParameters.PrimaryScreenWidth;
double height = SystemParameters.PrimaryScreenHeight;
if (x > 1843 / w * width
&& x < 1907 / w * width
&& y > 1037 / h * height
&& y < 1074 / h * height)
{
System.Drawing.Color c;
int count = sleepTime;
do
{
c = GetBottomBeforeColor();
if (c.A != beforeColor.A
|| c.R != beforeColor.R
|| c.G != beforeColor.G
|| c.B != beforeColor.B)
{
break;
}
Thread.Sleep(50);
count -= 50;
} while (count > 0);
if (c.A != beforeColor.A
|| c.R != beforeColor.R
|| c.G != beforeColor.G
|| c.B != beforeColor.B)
{
//判断是否展开时钟
System.Drawing.Color ct = GetTopBeforeColor();
if (ct.A != topBeforeColor.A
|| ct.R != topBeforeColor.R
|| ct.G != topBeforeColor.G
|| ct.B != topBeforeColor.B)
{
expandClock = true;
}
else
{
expandClock = false;
}
if (!BGBorder.IsVisible)
{
System.Drawing.Color theamColor = GetColor(1919, 1079);
if (CalculateLight(theamColor) > 255 / 2)
{
//light
BGBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(theamColor.A, theamColor.R, theamColor.G, theamColor.B));
SecondsText.Foreground = Constants.lightFont;
}
else
{
// dark
//BGBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(theamColor.A, theamColor.R, theamColor.G, theamColor.B));
BGBorder.Background = Constants.darkBG;
SecondsText.Foreground = Constants.darkFont;
}
SecondsDataContext dc = this.DataContext as SecondsDataContext;
dc.Seconds = (DateTime.Now.Hour).ToString() + ":" +
FormatMS(DateTime.Now.Minute) + ":" +
FormatMS(DateTime.Now.Second);
int sx = (int)(SystemParameters.PrimaryScreenWidth * lProportion);
int sMarginBottom = (int)(SystemParameters.WorkArea.Height * tProportion);
Left = sx - Width;
Top = SystemParameters.WorkArea.Height - Height;
BGBorder.Visibility = Visibility.Visible;
timer.Start();
}
else
{
BGBorder.Visibility = Visibility.Collapsed;
timer.Stop();
}
}
}
else if (true)
{
if ((expandClock && (x < 1574 / w * width
|| x > 1906 / w * width
|| y < 598 / h * height
|| y > 1020 / h * height)
)
|| !expandClock && (x < 1574 / w * width
|| x > 1906 / w * width
|| y < 950 / h * height
|| y > 1020 / h * height)
)
{
BGBorder.Visibility = Visibility.Collapsed;
timer.Stop();
}
}
}
catch (Exception e1) { }
}));
}
}
private static System.Windows.Window window = null;
public static void ShowWindow()
{
try
{
if (window == null || !window.Activate())
{
window = new SecondsWindow();
}
} catch (Exception e)
{
LogUtil.WriteErrorLog(e, "打开显秒窗口异常!");
}
}
public static void CloseWindow()
{
try
{
window.Close();
} catch (Exception e)
{
LogUtil.WriteErrorLog(e, "关闭显秒窗口异常!");
}
}
private void SecondsBakColorFun(object sender, MouseEventExtArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
beforeColor = GetBottomBeforeColor();
topBeforeColor = GetTopBeforeColor();
}
}
private static System.Drawing.Color GetBottomBeforeColor()
{
return GetColor(1760, 985);
}
private static System.Drawing.Color GetTopBeforeColor()
{
return GetColor(1751, 693);
}
private static System.Drawing.Color GetColor(int w2, int h2)
{
double w = 1920;
double h = 1080;
double width = SystemParameters.PrimaryScreenWidth;
double height = SystemParameters.PrimaryScreenHeight;
System.Drawing.Point p = new System.Drawing.Point((int)(w2 / w * width), (int)(h2 / h * height));
return ScreenUtil.GetColorAt(p);
}
private static int CalculateLight(System.Drawing.Color color)
{
int[] colorArr = new int[] { color.R, color.G, color.B };
int max = 0;
int min = 255;
foreach (int i in colorArr)
{
max = Math.Max(max, i);
min = Math.Min(min, i);
}
int avg = (max + min) / 2;
return avg;
}
}
}

View File

@@ -0,0 +1,25 @@
using System.ComponentModel;
namespace ShowSeconds.ViewModel
{
public class SecondsDataContext : INotifyPropertyChanged
{
private string seconds;
public string Seconds
{
set
{
seconds = value;
OnPropertyChanged("Seconds");
}
get { return seconds; }
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

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

View File

@@ -1,46 +1,77 @@
# GeekDesk 极客桌面
小巧、**美观**的桌面快速启动管理工具
谈一谈做GeekDesk的原因:
———— 大风, 雨夜...
「你来了」
「我来了」
目前的市场上也有一部分桌面图标管理工具, 但是**界面好点的收费**, **免费的界面差**
**windows11**都来了, 难道还要用界面停留在**win7时代**的软件吗
「你究竟想干什么!」
「我想做一款软件, 这个软件要Cool」
所以就萌生了做这款软件的想法, **免费 / 美观 / 高度定制化** 是从GeekDesk诞生开始就有的需求和方向, 未来也会向着这些方向发展
目前GeekDesk只有一个人在开发, 大家如果有好的建议也可以提Issue
「什么软件?」
「从最常用的桌面开始吧」
「哼!现在的软件多入牛毛, 会差你一个吗」
「我不知道, 但是我想做」
「你以为凭你一个人的力量能在这大海里掀起什么波浪吗」
「但只要我想就够了, 这是我的梦想!」
「梦想? 可笑, 这世界哪有什么梦想. 不过是一日三餐, 车子和房!」
「我想...就够了...」
「...」
———— 雨停, 狂风仍在呼啸...
<img src="https://s4.ax1x.com/2021/12/15/TSrwfU.png" a border="0" width="800px"/>
**免费 / 美观 / 高度定制化** 是从GeekDesk诞生开始就有的需求和方向, 未来也会向着这些方向发展
目前GeekDesk只有一个人在开发所以想法有限, 大家如果有好的建议也可以提Issue
另外如果你喜欢 GeekDesk的话, 或许可以为作者购买防脱洗发水
<img src="https://z3.ax1x.com/2021/07/20/WYdfmR.jpg" alt="WYdfmR.jpg" border="0" width="400px"/>
## 开发框架
- wpf
- .net 4.7.2
- [HandyControl](https://github.com/HandyOrg/HandyControl)
当然, 点个**Star**也是对作者的激励哦~ 😊😊😊
## 全局热键 鼠标跟随 快速启动 随时随地
- 支持自定义热键
- 支持鼠标跟随
<img src="https://z3.ax1x.com/2021/07/19/WJt4hQ.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
### GitHub
[https://github.com/BookerLiu/GeekDesk](https://github.com/BookerLiu/GeekDesk)
### 码云
[https://gitee.com/BookerLiu/GeekDesk](https://gitee.com/BookerLiu/GeekDesk)
<img src="https://z3.ax1x.com/2021/07/20/WYdfmR.jpg" alt="WYdfmR.jpg" border="0" width="400px"/>
## 全局热键 一键呼出 鼠标跟随
- 自定义热键 设置并使用自己习惯的快捷键
- 一键呼出 使用鼠标中键呼出
- 鼠标跟随 自动追随鼠标位置
<img src="https://s4.ax1x.com/2021/12/15/TSlg8f.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
## 自定义壁纸
- 随意选择自己喜欢的壁纸
<img src="https://s4.ax1x.com/2021/12/15/TSNx4H.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
[![WJlcIs.md.jpg](https://z3.ax1x.com/2021/07/19/WJlcIs.md.jpg)](https://imgtu.com/i/WJlcIs)
## 毛玻璃等界面效果
- 背景图片毛玻璃效果
- 界面透明度
- 界面圆角
<img src="https://z3.ax1x.com/2021/07/19/WGOYSU.gif" alt="WGOYSU.gif" border="0" width="800px"/>
<img src="https://s4.ax1x.com/2021/12/15/TSabTO.gif" alt="WGOYSU.gif" border="0" width="800px"/>
## 自定义菜单图标
- 80多个系统图标可供选择
- 另支持在线导入阿里巴巴icon图标
- 篇幅原因,公众号内回复 **自定义图标** 可以查看教程
<img src="https://z3.ax1x.com/2021/07/19/WJ3fDU.png" alt="WJ3fDU.png" border="0" width="450px"/>
- ~~篇幅原因,公众号内回复 **自定义图标** 可以查看教程~~ 现在软件内已经贴上教程链接啦 也欢迎大家关注我的公众号:blush:
<img src="https://s4.ax1x.com/2021/12/15/TSd1NF.gif" border="0" width="800px"/>
## 定时提醒 永不忘记
<img src="https://z3.ax1x.com/2021/07/19/WJU6df.gif" alt="WJU6df.gif" border="0" width="800px"/>
- 快捷键快速新建待办事项
<img src="https://s4.ax1x.com/2021/12/15/TSDCvj.gif" alt="WJU6df.gif" border="0" width="800px"/>
## LICENSE
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
- 商用需联系作者
## 开发框架
- wpf
- .net 4.7.2
- [HandyControl](https://github.com/HandyOrg/HandyControl)
## Stargazers over time
[![Stargazers over time](https://starchart.cc/Demo-Liu/GeekDesk.svg)](https://starchart.cc/Demo-Liu/GeekDesk)

View File

@@ -19,15 +19,15 @@
</Style.Setters>
</Style>
<LinearGradientBrush x:Key="BtnBG" Opacity="0.97">
<LinearGradientBrush x:Key="BtnBG" Opacity="0.7">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
<!--按钮样式-->
<Style x:Key="Btn1" TargetType="Button" BasedOn="{StaticResource ButtonInfo}">
<Style x:Key="MyBtnStyle" TargetType="Button" BasedOn="{StaticResource ButtonInfo}">
<Setter Property="Background" Value="{StaticResource BtnBG}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush">
<Setter.Value>
<SolidColorBrush Color="#E5E5E2"/>
@@ -36,7 +36,50 @@
<Setter Property="Foreground" Value="Black"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E5E5E2"/>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush Opacity="1">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Opacity" Value="1"/>
</Trigger>
</Style.Triggers>
</Style>
<!--CheckBox样式-->
<Style x:Key="MyCheckBoxStyle" TargetType="CheckBox" BasedOn="{StaticResource CheckBoxBaseStyle}">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0" Opacity="0.6">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="0"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0" Opacity="0.6">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0" Opacity="0.7">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
@@ -57,4 +100,40 @@
</Style>
<!--radio btn style-->
<Style x:Key="MyRadioBtnStyle" TargetType="RadioButton" BasedOn="{StaticResource RadioButtonIcon}">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.7"/>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="1"/>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
<!--text box style-->
<Style x:Key="MyTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource TextBoxBaseStyle}">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.7"/>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="0" />
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderThickness" Value="0" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

@@ -33,6 +33,8 @@ namespace GeekDesk.Task
private static void Check(object source, ElapsedEventArgs e)
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
try
{
if (MainWindow.appData.ToDoList.Count > 0)
{
@@ -46,7 +48,9 @@ namespace GeekDesk.Task
}
}
}
ClearMemory();
}
catch (Exception e1) { }
//ClearMemory();
}));
}

View File

@@ -1,9 +1,10 @@
{
"title": "GeekDesk版本更新",
"subTitle": "V2.5.11",
"subTitle": "V2.5.14",
"msgTitle": "本次更新内容如下",
"msg": "['依旧耗费了我大量精力开发,希望大家给我点个免费的Star', '这个版本有一些优化点, 大家可以自行探索, 另外征集新Logo的设计, 要求美观并能体现\\'极客\\'风格','本次重新打包了程序文件(文件目录更清爽了,注意,这次不要使用覆盖升级(2.5.10可覆盖)), 可以将旧版本根目录下的Data文件复制到新版本根目录, 然后使用新版本启动','修复了2.5.10版本部分相对路径创建导致启动崩溃的bug','增加可拖动图标到其它菜单的功能,取消了拖动时的动画','增加了列表展开动画的开关','增加了数据备份功能','优化部分动画','优化搜索功能(达到了可只用键盘或只用鼠标启动所需目标)','增加了相对路径(实验性,可能有bug)','增加列表加密功能(实验性,可能有bug)','其它已知问题修复']",
"msg": "['好久不见, 别来无恙, 辞职回老家了, 突然换了新环境有点不适应, 目前还处于工作中的迷茫期, 祝我们大家全都前程似锦', 'GeekDesk准备冲击一下Gitee GVP, 希望大家给我点一下码云(Gitee)和GitHub的star❤❤❤', '之后我会抽时间编写一下开发者文档, 方便大家更清楚的了解项目结构, 从而有更多的人参与进来开发(一直没有编写是因为太懒了), 不多说了, 看下这次更新内容吧', '集成Everything搜索,设置-->其它-->勾选Everything插件开启', '增加了关联文件夹功能, 右键点击左侧栏-->新建关联菜单', '增加强制置顶开关,设置-->显示设置-->勾选/取消 置于顶层', '右侧栏图标列表增加了自适应列宽, 不会出现图标显示一半的情况了', '简单添加了新手引导提示', '加密菜单bug修复 By @1062406901', '多显示器拾色器bug修复 By @1062406901', '拖动图标到菜单的异常修复 By @Hsxxxxxx', '优化部分UI', '其它bug修复及功能优化','关注微信公众号\\'抓几个娃\\'可以第一时间收到更新通知(公众号也是佛系维护, 希望能关注的人多一点吧, 让作者这个穷B挣口饭吃)']",
"githubUrl": "https://github.com/BookerLiu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases",
"version": "2.5.11"
"statisticUrl": "http://43.138.23.39:8989/bookerService/geekDeskController/userCountStatistic",
"version": "2.5.14"
}

View File

@@ -45,7 +45,6 @@ namespace GeekDesk.Util
else
{
LinearGradientBrush lgb = new LinearGradientBrush();
lgb.Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2));
GradientStop gs = new GradientStop
{
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color1),
@@ -60,6 +59,7 @@ namespace GeekDesk.Util
Offset = 1
};
lgb.GradientStops.Add(gs2);
lgb.Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2));
MainWindow.mainWindow.BGBorder.Background = lgb;
}

View File

@@ -43,6 +43,12 @@ namespace GeekDesk.Util
{
BinaryFormatter bf = new BinaryFormatter();
appData = bf.Deserialize(fs) as AppData;
//将菜单密码写入文件
if (!string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
{
SavePassword(appData.AppConfig.MenuPassword);
}
}
}
catch
@@ -69,14 +75,16 @@ namespace GeekDesk.Util
GlobalMsgNotification gm = new GlobalMsgNotification(msg);
HandyControl.Controls.Notification ntf = HandyControl.Controls.Notification.Show(gm, ShowAnimation.Fade, true);
gm.ntf = ntf;
} catch
}
catch
{
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
Application.Current.Shutdown();
return null;
}
} else
}
else
{
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
Application.Current.Shutdown();
@@ -122,6 +130,41 @@ namespace GeekDesk.Util
}
}
private static string GeneraterUUID()
{
try
{
if (!File.Exists(Constants.UUID_FILE_BAK_PATH) || string.IsNullOrEmpty(GetUniqueUUID()))
{
using (StreamWriter sw = new StreamWriter(Constants.UUID_FILE_BAK_PATH))
{
string uuid = Guid.NewGuid().ToString() + "-" + Constants.MY_UUID;
sw.Write(uuid);
return uuid;
}
}
} catch (Exception) { }
return "ERROR_UUID_GeneraterUUID_" + Constants.MY_UUID;
}
public static string GetUniqueUUID()
{
try
{
if (File.Exists(Constants.UUID_FILE_BAK_PATH))
{
using (StreamReader reader = new StreamReader(Constants.UUID_FILE_BAK_PATH))
{
return reader.ReadToEnd().Trim();
}
} else
{
return GeneraterUUID();
}
} catch(Exception) { }
return "ERROR_UUID_GetUniqueUUID_" + Constants.MY_UUID;
}
public static void BakAppData()
{
@@ -144,25 +187,6 @@ namespace GeekDesk.Util
/// <summary>
/// 判断当前屏幕(鼠标最后活动屏幕)是否有全屏化应用
/// </summary>
/// <returns></returns>
public static bool IsPrimaryFullScreen()
{
RECT rect = new RECT();
GetWindowRect(new HandleRef(null, GetForegroundWindow()), ref rect);
int windowHeight = rect.bottom - rect.top;
int screenHeight = (int)SystemParameters.PrimaryScreenHeight;
if (windowHeight >= screenHeight)
{
return true;
}
return false;
}
/// <summary>
/// 根据路径获取文件图标等信息
/// </summary>
@@ -263,20 +287,7 @@ namespace GeekDesk.Util
}
[StructLayout(LayoutKind.Sequential)]
private struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[DllImport("user32.dll")]
private static extern bool GetWindowRect(HandleRef hWnd, [In, Out] ref RECT rect);
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
@@ -284,6 +295,8 @@ namespace GeekDesk.Util
/// 排序图标
/// </summary>
public static void SortIconList()
{
try
{
if (MainWindow.appData.AppConfig.IconSortType != SortType.CUSTOM)
{
@@ -313,6 +326,9 @@ namespace GeekDesk.Util
MainWindow.appData.AppConfig.SelectedMenuIcons = MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList;
}
}
catch (Exception) { }
}

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using File = System.IO.File;
namespace GeekDesk.Util
{
@@ -45,17 +46,22 @@ namespace GeekDesk.Util
/// <returns></returns>
public static string GetArgByLnk(string filePath)
{
//return "";
try
{
WshShell shell = new WshShell();
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(filePath);
if (File.Exists(filePath))
{
object shortcutObj = shell.CreateShortcut(filePath);
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shortcutObj;
return shortcut.Arguments;
}
}
catch (Exception e)
{
LogUtil.WriteErrorLog(e, "获取启动参数失败! filePath=" + filePath);
return "";
//LogUtil.WriteErrorLog(e, "获取启动参数失败! filePath=" + filePath);
}
return "";
}
/// <summary>
@@ -172,12 +178,33 @@ namespace GeekDesk.Util
.ToString()
.Replace('/', Path.DirectorySeparatorChar)
);
} catch (Exception ex)
}
catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "建立相对路径出错:fromPath:" + fromPath + ",toPath:" + toPath);
}
return relativePath;
}
public static FileInfo GetFileByNameWithDir(string name, string dir)
{
DirectoryInfo d = new DirectoryInfo(dir);
FileInfo[] files = d.GetFiles();//文件
foreach (FileInfo fi in files)
{
if (fi.Name.Equals(name))
{
return fi;
}
}
DirectoryInfo[] directs = d.GetDirectories();
foreach (DirectoryInfo direct in directs)
{
return GetFileByNameWithDir(name, direct.FullName);
}
return null;
}
}
}

174
Util/FileWatcher.cs Normal file
View File

@@ -0,0 +1,174 @@
using GeekDesk.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public class FileWatcher
{
public static Dictionary<FileSystemWatcher, MenuInfo> linkMenuMap = new Dictionary<FileSystemWatcher, MenuInfo>();
/// <summary>
/// 实时文件夹监听
/// </summary>
/// <param name="path"></param>
public static void LinkMenuWatcher(MenuInfo menuInfo)
{
try
{
FileSystemWatcher fileSystemWatcher = new FileSystemWatcher
{
Path = menuInfo.LinkPath,
};
linkMenuMap.Add(fileSystemWatcher, menuInfo);
fileSystemWatcher.EnableRaisingEvents = true;
fileSystemWatcher.Changed += LinkIcon_Changed;
fileSystemWatcher.Deleted += LinkIcon_Deleted;
fileSystemWatcher.Created += LinkIcon_Created;
fileSystemWatcher.Renamed += LinkIcon_Renamed;
} catch (Exception e)
{
LogUtil.WriteErrorLog(e, "添加LinkMenu监听异常");
}
}
private static void LinkIcon_Renamed(object sender, RenamedEventArgs e)
{
IconInfo iconInfo = getIconInfoByPath(sender, e.OldFullPath);
iconInfo.Name = e.Name;
iconInfo.Path = e.FullPath;
}
private static void LinkIcon_Changed(object sender, FileSystemEventArgs e)
{
IconInfo iconInfo = getIconInfoByPath(sender, e.FullPath);
if (iconInfo != null)
{
IconInfo newIconInfo = CommonCode.GetIconInfoByPath(e.FullPath);
iconInfo.BitmapImage = newIconInfo.BitmapImage;
}
}
private static void LinkIcon_Deleted(object sender, FileSystemEventArgs e)
{
IconInfo iconInfo = getIconInfoByPath(sender, e.FullPath);
App.Current.Dispatcher.Invoke(() =>
{
linkMenuMap[sender as FileSystemWatcher].IconList.Remove(iconInfo);
});
}
private static void LinkIcon_Created(object sender, FileSystemEventArgs e)
{
IconInfo iconInfo = CommonCode.GetIconInfoByPath(e.FullPath);
App.Current.Dispatcher.Invoke(() =>
{
linkMenuMap[sender as FileSystemWatcher].IconList.Add(iconInfo);
});
}
private static IconInfo getIconInfoByPath(object sender, string path)
{
MenuInfo menuInfo = linkMenuMap[sender as FileSystemWatcher];
foreach (IconInfo iconInfo in menuInfo.IconList)
{
if (iconInfo.Path.Equals(path))
{
return iconInfo;
}
}
return null;
}
/// <summary>
/// 开启所有菜单监听
/// </summary>
/// <param name="appData"></param>
public static void EnableLinkMenuWatcher(AppData appData)
{
foreach (MenuInfo menuInfo in appData.MenuList)
{
if (menuInfo.MenuType == Constant.MenuType.LINK)
{
LinkMenuWatcher(menuInfo);
}
}
RefreshLinkMenuIcon(appData);
}
private static void RefreshLinkMenuIcon(AppData appData)
{
new Thread(() =>
{
try
{
foreach (MenuInfo menuInfo in appData.MenuList)
{
if (menuInfo.MenuType == Constant.MenuType.LINK)
{
DirectoryInfo dirInfo = new DirectoryInfo(menuInfo.LinkPath);
FileSystemInfo[] fileInfos = dirInfo.GetFileSystemInfos();
ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
foreach (FileSystemInfo fileInfo in fileInfos)
{
IconInfo iconInfo = CommonCode.GetIconInfoByPath_NoWrite(fileInfo.FullName);
iconList.Add(iconInfo);
}
App.Current.Dispatcher.Invoke(() =>
{
foreach (IconInfo iconInfo in iconList)
{
menuInfo.IconList = null;
menuInfo.IconList = iconList;
}
});
}
}
}
catch (Exception) { }
}).Start();
}
/// <summary>
/// 移除菜单监听
/// </summary>
/// <param name="menuInfo"></param>
public static void RemoveLinkMenuWatcher(MenuInfo menuInfo)
{
try
{
foreach (FileSystemWatcher watcher in linkMenuMap.Keys)
{
if (linkMenuMap[watcher] == menuInfo)
{
//释放资源
watcher.Changed -= LinkIcon_Changed;
watcher.Created -= LinkIcon_Created;
watcher.Deleted -= LinkIcon_Deleted;
watcher.Renamed -= LinkIcon_Renamed;
watcher.EnableRaisingEvents = false;
watcher.Dispose();
linkMenuMap.Remove(watcher);
}
}
}
catch (Exception e)
{
//nothing
}
}
}
}

227
Util/HideWindowUtil.cs Normal file
View File

@@ -0,0 +1,227 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Interop;
namespace GeekDesk.Util
{
public class HideWindowUtil
{
public enum GetWindowLongFields
{
// ...
GWL_EXSTYLE = (-20),
// ...
}
public static void HideAltTab(Window window)
{
try
{
WindowInteropHelper wndHelper = new WindowInteropHelper(window);
int exStyle = (int)HideWindowUtil.GetWindowLong(wndHelper.Handle, (int)HideWindowUtil.GetWindowLongFields.GWL_EXSTYLE);
exStyle |= (int)HideWindowUtil.ExtendedWindowStyles.WS_EX_TOOLWINDOW;
HideWindowUtil.SetWindowLong(wndHelper.Handle, (int)HideWindowUtil.GetWindowLongFields.GWL_EXSTYLE, (IntPtr)exStyle);
} catch (Exception e)
{
}
}
[DllImport("user32.dll")]
public static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);
public static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong)
{
int error = 0;
IntPtr result = IntPtr.Zero;
// Win32 SetWindowLong doesn't clear error on success
SetLastError(0);
if (IntPtr.Size == 4)
{
// use SetWindowLong
Int32 tempResult = IntSetWindowLong(hWnd, nIndex, IntPtrToInt32(dwNewLong));
error = Marshal.GetLastWin32Error();
result = new IntPtr(tempResult);
}
else
{
// use SetWindowLongPtr
result = IntSetWindowLongPtr(hWnd, nIndex, dwNewLong);
error = Marshal.GetLastWin32Error();
}
if ((result == IntPtr.Zero) && (error != 0))
{
throw new System.ComponentModel.Win32Exception(error);
}
return result;
}
[DllImport("user32.dll", EntryPoint = "SetWindowLongPtr", SetLastError = true)]
private static extern IntPtr IntSetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
[DllImport("user32.dll", EntryPoint = "SetWindowLong", SetLastError = true)]
private static extern Int32 IntSetWindowLong(IntPtr hWnd, int nIndex, Int32 dwNewLong);
private static int IntPtrToInt32(IntPtr intPtr)
{
return unchecked((int)intPtr.ToInt64());
}
[DllImport("kernel32.dll", EntryPoint = "SetLastError")]
public static extern void SetLastError(int dwErrorCode);
/// <summary>
/// 扩展的窗口风格
/// </summary>
/// 代码:[Extended Window Styles (Windows)](https://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx )
/// code from [Extended Window Styles (Windows)](https://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx )
[Flags]
public enum ExtendedWindowStyles : long
{
/// <summary>
/// The window accepts drag-drop files
/// </summary>
WS_EX_ACCEPTFILES = 0x00000010L,
/// <summary>
/// Forces a top-level window onto the taskbar when the window is visible
/// </summary>
WS_EX_APPWINDOW = 0x00040000L,
/// <summary>
/// The window has a border with a sunken edge.
/// </summary>
WS_EX_CLIENTEDGE = 0x00000200L,
/// <summary>
/// Paints all descendants of a window in bottom-to-top painting order using double-buffering. For more information, see Remarks. This cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC.Windows 2000: This style is not supported.
/// </summary>
WS_EX_COMPOSITED = 0x02000000L,
/// <summary>
/// The title bar of the window includes a question mark. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message. The child window should pass the message to the parent window procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the child window.WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.
/// </summary>
WS_EX_CONTEXTHELP = 0x00000400L,
/// <summary>
/// The window itself contains child windows that should take part in dialog box navigation. If this style is specified, the dialog manager recurses into children of this window when performing navigation operations such as handling the TAB key, an arrow key, or a keyboard mnemonic.
/// </summary>
WS_EX_CONTROLPARENT = 0x00010000L,
/// <summary>
/// The window has a double border; the window can, optionally, be created with a title bar by specifying the WS_CAPTION style in the dwStyle parameter.
/// </summary>
WS_EX_DLGMODALFRAME = 0x00000001L,
/// <summary>
/// The window is a layered window. This style cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC.Windows 8: The WS_EX_LAYERED style is supported for top-level windows and child windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.
/// </summary>
WS_EX_LAYERED = 0x00080000,
/// <summary>
/// If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the horizontal origin of the window is on the right edge. Increasing horizontal values advance to the left.
/// </summary>
WS_EX_LAYOUTRTL = 0x00400000L,
/// <summary>
/// The window has generic left-aligned properties. This is the default.
/// </summary>
WS_EX_LEFT = 0x00000000L,
/// <summary>
/// If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the vertical scroll bar (if present) is to the left of the client area. For other languages, the style is ignored.
/// </summary>
WS_EX_LEFTSCROLLBAR = 0x00004000L,
/// <summary>
/// The window text is displayed using left-to-right reading-order properties. This is the default.
/// </summary>
WS_EX_LTRREADING = 0x00000000L,
/// <summary>
/// The window is a MDI child window.
/// </summary>
WS_EX_MDICHILD = 0x00000040L,
/// <summary>
/// A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window.To activate the window, use the SetActiveWindow or SetForegroundWindow function.The window does not appear on the taskbar by default. To force the window to appear on the taskbar, use the WS_EX_APPWINDOW style.
/// </summary>
WS_EX_NOACTIVATE = 0x08000000L,
/// <summary>
/// The window does not pass its window layout to its child windows.
/// </summary>
WS_EX_NOINHERITLAYOUT = 0x00100000L,
/// <summary>
/// The child window created with this style does not send the WM_PARENTNOTIFY message to its parent window when it is created or destroyed.
/// </summary>
WS_EX_NOPARENTNOTIFY = 0x00000004L,
/// <summary>
/// The window does not render to a redirection surface. This is for windows that do not have visible content or that use mechanisms other than surfaces to provide their visual.
/// </summary>
WS_EX_NOREDIRECTIONBITMAP = 0x00200000L,
/// <summary>
/// The window is an overlapped window.
/// </summary>
WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE),
/// <summary>
/// The window is palette window, which is a modeless dialog box that presents an array of commands.
/// </summary>
WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST),
/// <summary>
/// The window has generic "right-aligned" properties. This depends on the window class. This style has an effect only if the shell language is Hebrew, Arabic, or another language that supports reading-order alignment; otherwise, the style is ignored.Using the WS_EX_RIGHT style for static or edit controls has the same effect as using the SS_RIGHT or ES_RIGHT style, respectively. Using this style with button controls has the same effect as using BS_RIGHT and BS_RIGHTBUTTON styles.
/// </summary>
WS_EX_RIGHT = 0x00001000L,
/// <summary>
/// The vertical scroll bar (if present) is to the right of the client area. This is the default.
/// </summary>
WS_EX_RIGHTSCROLLBAR = 0x00000000L,
/// <summary>
/// If the shell language is Hebrew, Arabic, or another language that supports reading-order alignment, the window text is displayed using right-to-left reading-order properties. For other languages, the style is ignored.
/// </summary>
WS_EX_RTLREADING = 0x00002000L,
/// <summary>
/// The window has a three-dimensional border style intended to be used for items that do not accept user input.
/// </summary>
WS_EX_STATICEDGE = 0x00020000L,
/// <summary>
/// The window is intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. If a tool window has a system menu, its icon is not displayed on the title bar. However, you can display the system menu by right-clicking or by typing ALT+SPACE.
/// </summary>
WS_EX_TOOLWINDOW = 0x00000080L,
/// <summary>
/// The window should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function.
/// </summary>
WS_EX_TOPMOST = 0x00000008L,
/// <summary>
/// The window should not be painted until siblings beneath the window (that were created by the same thread) have been painted. The window appears transparent because the bits of underlying sibling windows have already been painted.To achieve transparency without these restrictions, use the SetWindowRgn function.
/// </summary>
WS_EX_TRANSPARENT = 0x00000020L,
/// <summary>
/// The window has a border with a raised edge
/// </summary>
WS_EX_WINDOWEDGE = 0x00000100L
}
}
}

View File

@@ -20,6 +20,7 @@ namespace GeekDesk.Util
/// <returns></returns>
public static BitmapImage ByteArrToImage(byte[] array)
{
if (array == null) return null;
using (var ms = new System.IO.MemoryStream(array))
{
BitmapImage image = new BitmapImage();
@@ -39,6 +40,7 @@ namespace GeekDesk.Util
/// <returns></returns>
public static byte[] BitmapImageToByte(BitmapImage bi)
{
if (bi == null) return null;
using (MemoryStream memStream = new MemoryStream())
{
PngBitmapEncoder encoder = new PngBitmapEncoder();
@@ -119,6 +121,34 @@ namespace GeekDesk.Util
}
public static BitmapImage GetBitmapIconByUnknownPath(string path)
{
//string base64 = ImageUtil.FileImageToBase64(path, System.Drawing.Imaging.ImageFormat.Png);
string ext = "";
if (!ImageUtil.IsSystemItem(path))
{
ext = System.IO.Path.GetExtension(path).ToLower();
}
string iconPath = null;
if (".lnk".Equals(ext))
{
string targetPath = FileUtil.GetTargetPathByLnk(path);
iconPath = FileUtil.GetIconPathByLnk(path);
if (targetPath != null)
{
path = targetPath;
}
}
if (StringUtil.IsEmpty(iconPath))
{
iconPath = path;
}
return ImageUtil.GetBitmapIconByPath(iconPath);
}
/// <summary>
///
/// </summary>
@@ -173,6 +203,10 @@ namespace GeekDesk.Util
{
try
{
FileInfo file = new FileInfo(filePath);
if (file.Exists && file.Length > 0
&& !System.IO.Path.GetExtension(filePath).Contains("psd"))
{
Image img = Image.FromFile(filePath);
if (img.Width <= tWidth && img.Height <= tHeight)
@@ -217,6 +251,10 @@ namespace GeekDesk.Util
File.Delete(tempPath);
return bm;
}
} else
{
return Base64ToBitmapImage(Constants.DEFAULT_IMG_IMAGE_BASE64);
}
}
catch (Exception e)
{
@@ -334,6 +372,9 @@ namespace GeekDesk.Util
public static bool IsImage(string path)
{
try
{
string ext = Path.GetExtension(path);
if (!string.IsNullOrEmpty(ext))
{
string strExt = Path.GetExtension(path).Substring(1);
string suffixs = "bmp,jpg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,WMF,webp,avif";
@@ -345,6 +386,7 @@ namespace GeekDesk.Util
return true;
}
}
}
return false;
}
catch (Exception)

View File

@@ -490,6 +490,7 @@ namespace GeekDesk.Util
return false;
ListBoxItem item = this.GetListBoxItem( this.indexToSelect );
if (item == null) return false;
Rect bounds = VisualTreeHelper.GetDescendantBounds( item );
Point ptInItem = this.listBox.TranslatePoint( this.ptMouseDown, item );

131
Util/MessageUtil.cs Normal file
View File

@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public class MessageUtil
{
public const int WM_COPYDATA = 0x004A;
public static bool SendMsgByPName(string processName, string msg)
{
try
{
Process[] processArr = Process.GetProcessesByName(processName);
if (processArr != null && processArr.Length > 0)
{
foreach (Process process in processArr)
{
IntPtr windowHandle = process.MainWindowHandle;
// 发送消息
CopyDataStruct cds = new CopyDataStruct(IntPtr.Zero, msg);
SendMessage(
windowHandle,
WM_COPYDATA,
0, ref cds);
}
return true;
}
else
{
return false;
}
} catch (Exception e)
{
LogUtil.WriteErrorLog(e, processName + "P发送消息失败!");
return false;
}
}
public static bool SendMsgByWName(string windowName, string msg)
{
try
{
IntPtr hwnd = FindWindow(null, windowName);
if (hwnd != IntPtr.Zero)
{
// 发送消息
CopyDataStruct cds = new CopyDataStruct(IntPtr.Zero, msg);
SendMessage(
hwnd,
WM_COPYDATA,
0, ref cds);
} else
{
return false;
}
return true;
}
catch (Exception e)
{
LogUtil.WriteErrorLog(e, windowName + "W发送消息失败!");
return false;
}
}
public static bool CheckProcessIsRuning(string processName)
{
try
{
Process[] processArr = Process.GetProcessesByName(processName);
return (processArr != null && processArr.Length > 0);
}
catch (Exception e)
{
LogUtil.WriteErrorLog(e, processName + "检查进程名失败!");
return false;
}
}
public static bool CheckWindowIsRuning(string windowName)
{
try
{
IntPtr hwnd = FindWindow(null, windowName);
return (hwnd != IntPtr.Zero);
} catch(Exception)
{
return false;
}
}
[DllImport("User32.dll", EntryPoint = "FindWindow")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(
IntPtr hWnd, //目标窗体句柄
int Msg, //WM_COPYDATA
int wParam, //自定义数值
ref CopyDataStruct lParam //传递消息的结构体,
);
[StructLayout(LayoutKind.Sequential)]
public struct CopyDataStruct
{
public CopyDataStruct(IntPtr custom, string msg)
{
this.custom = custom;
this.msg = msg;
this.msgLength = msg.Length + 1;
}
public IntPtr custom;//用户定义数据
public int msgLength;//字符串长度
[MarshalAs(UnmanagedType.LPStr)]
public string msg;//字符串
}
[DllImport("user32")]
public static extern bool ChangeWindowMessageFilter(uint msg, int flags);
}
}

156
Util/MouseHook.cs Normal file
View File

@@ -0,0 +1,156 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GeekDesk.Util
{
public class MouseHook
{
private Point point;
private Point Point
{
get { return point; }
set
{
if (point != value)
{
point = value;
if (MouseMoveEvent != null)
{
var e = new MouseEventArgs(MouseButtons.None, 0, point.X, point.Y, 0);
MouseMoveEvent(this, e);
}
}
}
}
private int hHook;
private const int WM_MOUSEMOVE = 0x200;
private const int WM_LBUTTONDOWN = 0x201;
private const int WM_RBUTTONDOWN = 0x204;
private const int WM_MBUTTONDOWN = 0x207;
private const int WM_LBUTTONUP = 0x202;
private const int WM_RBUTTONUP = 0x205;
private const int WM_MBUTTONUP = 0x208;
private const int WM_LBUTTONDBLCLK = 0x203;
private const int WM_RBUTTONDBLCLK = 0x206;
private const int WM_MBUTTONDBLCLK = 0x209;
public const int WH_MOUSE_LL = 14;
public Win32Api.HookProc hProc;
public MouseHook()
{
this.Point = new Point();
}
public int SetHook()
{
hProc = new Win32Api.HookProc(MouseHookProc);
hHook = Win32Api.SetWindowsHookEx(WH_MOUSE_LL, hProc, IntPtr.Zero, 0);
return hHook;
}
public void UnHook()
{
Win32Api.UnhookWindowsHookEx(hHook);
}
private int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam)
{
Win32Api.MouseHookStruct MyMouseHookStruct = (Win32Api.MouseHookStruct)Marshal.PtrToStructure(lParam, typeof(Win32Api.MouseHookStruct));
if (nCode < 0)
{
return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);
}
else
{
if (MouseClickEvent != null)
{
MouseButtons button = MouseButtons.None;
int clickCount = 0;
switch ((Int32)wParam)
{
case WM_LBUTTONDOWN:
button = MouseButtons.Left;
clickCount = 1;
MouseDownEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));
break;
case WM_RBUTTONDOWN:
button = MouseButtons.Right;
clickCount = 1;
MouseDownEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));
break;
case WM_MBUTTONDOWN:
button = MouseButtons.Middle;
clickCount = 1;
MouseDownEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));
break;
case WM_LBUTTONUP:
button = MouseButtons.Left;
clickCount = 1;
MouseUpEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));
break;
case WM_RBUTTONUP:
button = MouseButtons.Right;
clickCount = 1;
MouseUpEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));
break;
case WM_MBUTTONUP:
button = MouseButtons.Middle;
clickCount = 1;
MouseUpEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));
break;
}
var e = new MouseEventArgs(button, clickCount, point.X, point.Y, 0);
MouseClickEvent(this, e);
}
this.Point = new Point(MyMouseHookStruct.pt.x, MyMouseHookStruct.pt.y);
return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);
}
}
public delegate void MouseMoveHandler(object sender, MouseEventArgs e);
public event MouseMoveHandler MouseMoveEvent;
public delegate void MouseClickHandler(object sender, MouseEventArgs e);
public event MouseClickHandler MouseClickEvent;
public delegate void MouseDownHandler(object sender, MouseEventArgs e);
public event MouseDownHandler MouseDownEvent;
public delegate void MouseUpHandler(object sender, MouseEventArgs e);
public event MouseUpHandler MouseUpEvent;
public class Win32Api
{
[StructLayout(LayoutKind.Sequential)]
public class POINT
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential)]
public class MouseHookStruct
{
public POINT pt;
public int hwnd;
public int wHitTestCode;
public int dwExtraInfo;
}
public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern bool UnhookWindowsHookEx(int idHook);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);
}
}
}

277
Util/ProcessUtil.cs Normal file
View File

@@ -0,0 +1,277 @@
using GeekDesk.Constant;
using GeekDesk.ViewModel;
using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public class ProcessUtil
{
public static void StartIconApp(IconInfo icon, IconStartType type, bool useRelativePath = false)
{
App.Current.Dispatcher.Invoke(() =>
{
try
{
using (Process p = new Process())
{
string startArg = icon.StartArg;
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
{
StartSystemApp(startArg, type);
}
else
{
string path;
if (useRelativePath)
{
string fullPath = Path.Combine(Constants.APP_DIR, icon.RelativePath);
path = Path.GetFullPath(fullPath);
}
else
{
path = icon.Path;
}
p.StartInfo.FileName = path;
if (!StringUtil.IsEmpty(startArg))
{
p.StartInfo.Arguments = startArg;
}
if (icon.IconType == IconType.OTHER)
{
if (!File.Exists(path) && !Directory.Exists(path))
{
//如果没有使用相对路径 那么使用相对路径启动一次
if (!useRelativePath)
{
StartIconApp(icon, type, true);
return;
}
else
{
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
return;
}
}
p.StartInfo.WorkingDirectory = path.Substring(0, path.LastIndexOf("\\"));
switch (type)
{
case IconStartType.ADMIN_STARTUP:
//p.StartInfo.Arguments = "1";//启动参数
p.StartInfo.Verb = "runas";
//p.StartInfo.CreateNoWindow = false; //设置显示窗口
p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
//p.StartInfo.ErrorDialog = false;
if (MainWindow.appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (MainWindow.appData.AppConfig.MarginHide)
{
if (!MarginHide.IsMargin())
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;// c#好像不能case穿透
case IconStartType.DEFAULT_STARTUP:
if (MainWindow.appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (MainWindow.appData.AppConfig.MarginHide)
{
if (!MarginHide.IsMargin())
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;
case IconStartType.SHOW_IN_EXPLORE:
p.StartInfo.FileName = "Explorer.exe";
p.StartInfo.Arguments = "/e,/select," + icon.Path;
break;
}
}
else
{
if (MainWindow.appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (MainWindow.appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
}
p.Start();
if (useRelativePath)
{
//如果使用相对路径启动成功 那么重新设置程序绝对路径
icon.Path = path;
}
}
}
icon.Count++;
//隐藏搜索框
if (RunTimeStatus.SEARCH_BOX_SHOW)
{
MainWindow.mainWindow.HidedSearchBox();
}
}
catch (Exception e)
{
if (!useRelativePath)
{
StartIconApp(icon, type, true);
}
else
{
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(可能为不支持的启动方式)!");
LogUtil.WriteErrorLog(e, "程序启动失败:path=" + icon.Path + ",type=" + type);
}
}
});
}
private static void StartSystemApp(string startArg, IconStartType type)
{
if (type == IconStartType.SHOW_IN_EXPLORE)
{
Growl.WarningGlobal("系统项目不支持打开文件位置操作!");
return;
}
switch (startArg)
{
case "Calculator":
Process.Start("calc.exe");
break;
case "Computer":
Process.Start("explorer.exe");
break;
case "GroupPolicy":
Process.Start("gpedit.msc");
break;
case "Notepad":
Process.Start("notepad");
break;
case "Network":
Process.Start("ncpa.cpl");
break;
case "RecycleBin":
Process.Start("shell:RecycleBinFolder");
break;
case "Registry":
Process.Start("regedit.exe");
break;
case "Mstsc":
if (type == IconStartType.ADMIN_STARTUP)
{
Process.Start("mstsc", "-admin");
}
else
{
Process.Start("mstsc");
}
break;
case "Control":
Process.Start("Control");
break;
case "CMD":
if (type == IconStartType.ADMIN_STARTUP)
{
using (Process process = new Process())
{
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Verb = "runas";
process.Start();
}
}
else
{
Process.Start("cmd");
}
break;
case "Services":
Process.Start("services.msc");
break;
}
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (MainWindow.appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
[Flags]
private enum ProcessAccessFlags : uint
{
QueryLimitedInformation = 0x00001000
}
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool QueryFullProcessImageName(
[In] IntPtr hProcess,
[In] int dwFlags,
[Out] StringBuilder lpExeName,
ref int lpdwSize);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr OpenProcess(
ProcessAccessFlags processAccess,
bool bInheritHandle,
int processId);
public static String GetProcessFilename(Process p)
{
int capacity = 2000;
StringBuilder builder = new StringBuilder(capacity);
IntPtr ptr = OpenProcess(ProcessAccessFlags.QueryLimitedInformation, false, p.Id);
if (!QueryFullProcessImageName(ptr, 0, builder, ref capacity))
{
return String.Empty;
}
return builder.ToString();
}
}
}

156
Util/ScreenUtil.cs Normal file
View File

@@ -0,0 +1,156 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
namespace GeekDesk.Util
{
public class ScreenUtil
{
[DllImport("user32.dll")]
static extern bool GetCursorPos(ref System.Drawing.Point lpPoint);
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern int BitBlt(IntPtr hDC, int x, int y, int nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, int dwRop);
[StructLayout(LayoutKind.Sequential)]
private struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
//取得前台窗口句柄函数
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
//取得桌面窗口句柄函数
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow();
//取得Shell窗口句柄函数
[DllImport("user32.dll")]
private static extern IntPtr GetShellWindow();
//取得窗口大小函数
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowRect(IntPtr hwnd, out RECT rc);
//获取窗口标题
[DllImport("user32", SetLastError = true)]
private static extern int GetWindowText(
IntPtr hWnd,//窗口句柄
StringBuilder lpString,//标题
int nMaxCount //最大值
);
//获取类的名字
[DllImport("user32.dll")]
private static extern int GetClassName(
IntPtr hWnd,//句柄
StringBuilder lpString, //类名
int nMaxCount); //最大值
/// <summary>
/// 判断当前屏幕(鼠标最后活动屏幕)是否有全屏化应用
/// </summary>
/// <returns></returns>
public static bool IsPrimaryFullScreen()
{
//桌面窗口句柄
IntPtr desktopHandle; //Window handle for the desktop
//Shell窗口句柄
IntPtr shellHandle; //Window handle for the shell 因为桌面窗口和Shell窗口也是全屏要排除在其他全屏程序之外。 //取得桌面和Shell窗口句柄
desktopHandle = GetDesktopWindow();
shellHandle = GetShellWindow(); //取得前台窗口句柄并判断是否全屏
bool runningFullScreen = false;
RECT appBounds;
Rectangle screenBounds;
IntPtr hWnd;
//取得前台窗口
hWnd = GetForegroundWindow();
StringBuilder sb = new StringBuilder(256);
try
{
GetClassName(hWnd, sb, sb.Capacity);
}
catch { }
if (sb.ToString().ToLower().Equals("workerw")) return false;
if (hWnd != null && !hWnd.Equals(IntPtr.Zero))
{
//判断是否桌面或shell
if (!(hWnd.Equals(desktopHandle) || hWnd.Equals(shellHandle)))
{
//取得窗口大小
GetWindowRect(hWnd, out appBounds);
//判断是否全屏
screenBounds = Screen.FromHandle(hWnd).Bounds;
if ((appBounds.bottom - appBounds.top) == screenBounds.Height
&& (appBounds.right - appBounds.left) == screenBounds.Width)
runningFullScreen = true;
}
}
return runningFullScreen;
}
public static Color GetColorAt(System.Drawing.Point location)
{
Bitmap screenPixel = new Bitmap(1, 1, PixelFormat.Format32bppArgb);
using (Graphics gdest = Graphics.FromImage(screenPixel))
{
using (Graphics gsrc = Graphics.FromHwnd(IntPtr.Zero))
{
IntPtr hSrcDC = gsrc.GetHdc();
IntPtr hDC = gdest.GetHdc();
int retval = BitBlt(hDC, 0, 0, 1, 1, hSrcDC, location.X, location.Y, (int)CopyPixelOperation.SourceCopy);
gdest.ReleaseHdc();
gsrc.ReleaseHdc();
}
}
return screenPixel.GetPixel(0, 0);
}
[DllImport("gdi32")]
static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
public const int HORZRES = 8;
public const int VERTRES = 10;
public const int DESKTOPVERTRES = 117;
public const int DESKTOPHORZRES = 118;
/// <summary>
/// 获取屏幕缩放比例
/// </summary>
/// <returns></returns>
public static double GetScreenScalingFactor()
{
try
{
var g = Graphics.FromHwnd(IntPtr.Zero);
IntPtr desktop = g.GetHdc();
var physicalScreenHeight = GetDeviceCaps(desktop, (int)DESKTOPVERTRES);
var screenScalingFactor =
(double)physicalScreenHeight / SystemParameters.PrimaryScreenHeight;
//SystemParameters.PrimaryScreenHeight;
return screenScalingFactor;
} catch (Exception e)
{
return 1;
}
}
}
}

75
Util/ScrollUtil.cs Normal file
View File

@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace GeekDesk.Util
{
public class ScrollUtil
{
public static bool IsBootomScrollView(ScrollViewer view)
{
try
{
bool isBottom = false;
double dVer = view.VerticalOffset;
double vViewport = view.ViewportHeight;
double eextent = view.ExtentHeight;
if (dVer + vViewport >= eextent)
{
isBottom = true;
}
else
{
isBottom = false;
}
return isBottom;
} catch (Exception e)
{
return false;
}
}
public static bool IsTopScrollView(ScrollViewer view)
{
try
{
return (int)view.VerticalOffset == 0;
}
catch (Exception e)
{
return false;
}
}
public static T FindSimpleVisualChild<T>(DependencyObject element) where T : class
{
try
{
while (element != null)
{
if (element is T)
return element as T;
if (VisualTreeHelper.GetChildrenCount(element) > 0)
{
element = VisualTreeHelper.GetChild(element, 0);
}
}
return null;
}
catch (Exception e)
{
return null;
}
}
}
}

837
Util/UserActivityHook.cs Normal file
View File

@@ -0,0 +1,837 @@
using System;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;
using System.ComponentModel;
namespace GeekDesk.Util
{
/// <summary>
/// This class allows you to tap keyboard and mouse and / or to detect their activity even when an
/// application runes in background or does not have any user interface at all. This class raises
/// common .NET events with KeyEventArgs and MouseEventArgs so you can easily retrive any information you need.
/// </summary>
public class UserActivityHook
{
#region Windows structure definitions
/// <summary>
/// The POINT structure defines the x- and y- coordinates of a point.
/// </summary>
/// <remarks>
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/rectangl_0tiq.asp
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
private class POINT
{
/// <summary>
/// Specifies the x-coordinate of the point.
/// </summary>
public int x;
/// <summary>
/// Specifies the y-coordinate of the point.
/// </summary>
public int y;
}
/// <summary>
/// The MOUSEHOOKSTRUCT structure contains information about a mouse event passed to a WH_MOUSE hook procedure, MouseProc.
/// </summary>
/// <remarks>
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/cwpstruct.asp
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
private class MouseHookStruct
{
/// <summary>
/// Specifies a POINT structure that contains the x- and y-coordinates of the cursor, in screen coordinates.
/// </summary>
public POINT pt;
/// <summary>
/// Handle to the window that will receive the mouse message corresponding to the mouse event.
/// </summary>
public int hwnd;
/// <summary>
/// Specifies the hit-test value. For a list of hit-test values, see the description of the WM_NCHITTEST message.
/// </summary>
public int wHitTestCode;
/// <summary>
/// Specifies extra information associated with the message.
/// </summary>
public int dwExtraInfo;
}
/// <summary>
/// The MSLLHOOKSTRUCT structure contains information about a low-level keyboard input event.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
private class MouseLLHookStruct
{
/// <summary>
/// Specifies a POINT structure that contains the x- and y-coordinates of the cursor, in screen coordinates.
/// </summary>
public POINT pt;
/// <summary>
/// If the message is WM_MOUSEWHEEL, the high-order word of this member is the wheel delta.
/// The low-order word is reserved. A positive value indicates that the wheel was rotated forward,
/// away from the user; a negative value indicates that the wheel was rotated backward, toward the user.
/// One wheel click is defined as WHEEL_DELTA, which is 120.
///If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP,
/// or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released,
/// and the low-order word is reserved. This value can be one or more of the following values. Otherwise, mouseData is not used.
///XBUTTON1
///The first X button was pressed or released.
///XBUTTON2
///The second X button was pressed or released.
/// </summary>
public int mouseData;
/// <summary>
/// Specifies the event-injected flag. An application can use the following value to test the mouse flags. Value Purpose
///LLMHF_INJECTED Test the event-injected flag.
///0
///Specifies whether the event was injected. The value is 1 if the event was injected; otherwise, it is 0.
///1-15
///Reserved.
/// </summary>
public int flags;
/// <summary>
/// Specifies the time stamp for this message.
/// </summary>
public int time;
/// <summary>
/// Specifies extra information associated with the message.
/// </summary>
public int dwExtraInfo;
}
/// <summary>
/// The KBDLLHOOKSTRUCT structure contains information about a low-level keyboard input event.
/// </summary>
/// <remarks>
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/cwpstruct.asp
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
private class KeyboardHookStruct
{
/// <summary>
/// Specifies a virtual-key code. The code must be a value in the range 1 to 254.
/// </summary>
public int vkCode;
/// <summary>
/// Specifies a hardware scan code for the key.
/// </summary>
public int scanCode;
/// <summary>
/// Specifies the extended-key flag, event-injected flag, context code, and transition-state flag.
/// </summary>
public int flags;
/// <summary>
/// Specifies the time stamp for this message.
/// </summary>
public int time;
/// <summary>
/// Specifies extra information associated with the message.
/// </summary>
public int dwExtraInfo;
}
#endregion
#region Windows function imports
/// <summary>
/// The SetWindowsHookEx function installs an application-defined hook procedure into a hook chain.
/// You would install a hook procedure to monitor the system for certain types of events. These events
/// are associated either with a specific thread or with all threads in the same desktop as the calling thread.
/// </summary>
/// <param name="idHook">
/// [in] Specifies the type of hook procedure to be installed. This parameter can be one of the following values.
/// </param>
/// <param name="lpfn">
/// [in] Pointer to the hook procedure. If the dwThreadId parameter is zero or specifies the identifier of a
/// thread created by a different process, the lpfn parameter must point to a hook procedure in a dynamic-link
/// library (DLL). Otherwise, lpfn can point to a hook procedure in the code associated with the current process.
/// </param>
/// <param name="hMod">
/// [in] Handle to the DLL containing the hook procedure pointed to by the lpfn parameter.
/// The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by
/// the current process and if the hook procedure is within the code associated with the current process.
/// </param>
/// <param name="dwThreadId">
/// [in] Specifies the identifier of the thread with which the hook procedure is to be associated.
/// If this parameter is zero, the hook procedure is associated with all existing threads running in the
/// same desktop as the calling thread.
/// </param>
/// <returns>
/// If the function succeeds, the return value is the handle to the hook procedure.
/// If the function fails, the return value is NULL. To get extended error information, call GetLastError.
/// </returns>
/// <remarks>
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
/// </remarks>
[DllImport("user32.dll", CharSet = CharSet.Auto,
CallingConvention = CallingConvention.StdCall, SetLastError = true)]
private static extern int SetWindowsHookEx(
int idHook,
HookProc lpfn,
IntPtr hMod,
int dwThreadId);
/// <summary>
/// The UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.
/// </summary>
/// <param name="idHook">
/// [in] Handle to the hook to be removed. This parameter is a hook handle obtained by a previous call to SetWindowsHookEx.
/// </param>
/// <returns>
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero. To get extended error information, call GetLastError.
/// </returns>
/// <remarks>
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
/// </remarks>
[DllImport("user32.dll", CharSet = CharSet.Auto,
CallingConvention = CallingConvention.StdCall, SetLastError = true)]
private static extern int UnhookWindowsHookEx(int idHook);
/// <summary>
/// The CallNextHookEx function passes the hook information to the next hook procedure in the current hook chain.
/// A hook procedure can call this function either before or after processing the hook information.
/// </summary>
/// <param name="idHook">Ignored.</param>
/// <param name="nCode">
/// [in] Specifies the hook code passed to the current hook procedure.
/// The next hook procedure uses this code to determine how to process the hook information.
/// </param>
/// <param name="wParam">
/// [in] Specifies the wParam value passed to the current hook procedure.
/// The meaning of this parameter depends on the type of hook associated with the current hook chain.
/// </param>
/// <param name="lParam">
/// [in] Specifies the lParam value passed to the current hook procedure.
/// The meaning of this parameter depends on the type of hook associated with the current hook chain.
/// </param>
/// <returns>
/// This value is returned by the next hook procedure in the chain.
/// The current hook procedure must also return this value. The meaning of the return value depends on the hook type.
/// For more information, see the descriptions of the individual hook procedures.
/// </returns>
/// <remarks>
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
/// </remarks>
[DllImport("user32.dll", CharSet = CharSet.Auto,
CallingConvention = CallingConvention.StdCall)]
private static extern int CallNextHookEx(
int idHook,
int nCode,
int wParam,
IntPtr lParam);
/// <summary>
/// The CallWndProc hook procedure is an application-defined or library-defined callback
/// function used with the SetWindowsHookEx function. The HOOKPROC type defines a pointer
/// to this callback function. CallWndProc is a placeholder for the application-defined
/// or library-defined function name.
/// </summary>
/// <param name="nCode">
/// [in] Specifies whether the hook procedure must process the message.
/// If nCode is HC_ACTION, the hook procedure must process the message.
/// If nCode is less than zero, the hook procedure must pass the message to the
/// CallNextHookEx function without further processing and must return the
/// value returned by CallNextHookEx.
/// </param>
/// <param name="wParam">
/// [in] Specifies whether the message was sent by the current thread.
/// If the message was sent by the current thread, it is nonzero; otherwise, it is zero.
/// </param>
/// <param name="lParam">
/// [in] Pointer to a CWPSTRUCT structure that contains details about the message.
/// </param>
/// <returns>
/// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx.
/// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx
/// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC
/// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook
/// procedure does not call CallNextHookEx, the return value should be zero.
/// </returns>
/// <remarks>
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/callwndproc.asp
/// </remarks>
private delegate int HookProc(int nCode, int wParam, IntPtr lParam);
/// <summary>
/// The ToAscii function translates the specified virtual-key code and keyboard
/// state to the corresponding character or characters. The function translates the code
/// using the input language and physical keyboard layout identified by the keyboard layout handle.
/// </summary>
/// <param name="uVirtKey">
/// [in] Specifies the virtual-key code to be translated.
/// </param>
/// <param name="uScanCode">
/// [in] Specifies the hardware scan code of the key to be translated.
/// The high-order bit of this value is set if the key is up (not pressed).
/// </param>
/// <param name="lpbKeyState">
/// [in] Pointer to a 256-byte array that contains the current keyboard state.
/// Each element (byte) in the array contains the state of one key.
/// If the high-order bit of a byte is set, the key is down (pressed).
/// The low bit, if set, indicates that the key is toggled on. In this function,
/// only the toggle bit of the CAPS LOCK key is relevant. The toggle state
/// of the NUM LOCK and SCROLL LOCK keys is ignored.
/// </param>
/// <param name="lpwTransKey">
/// [out] Pointer to the buffer that receives the translated character or characters.
/// </param>
/// <param name="fuState">
/// [in] Specifies whether a menu is active. This parameter must be 1 if a menu is active, or 0 otherwise.
/// </param>
/// <returns>
/// If the specified key is a dead key, the return value is negative. Otherwise, it is one of the following values.
/// Value Meaning
/// 0 The specified virtual key has no translation for the current state of the keyboard.
/// 1 One character was copied to the buffer.
/// 2 Two characters were copied to the buffer. This usually happens when a dead-key character
/// (accent or diacritic) stored in the keyboard layout cannot be composed with the specified
/// virtual key to form a single character.
/// </returns>
/// <remarks>
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/toascii.asp
/// </remarks>
[DllImport("user32")]
private static extern int ToAscii(
int uVirtKey,
int uScanCode,
byte[] lpbKeyState,
byte[] lpwTransKey,
int fuState);
/// <summary>
/// The GetKeyboardState function copies the status of the 256 virtual keys to the
/// specified buffer.
/// </summary>
/// <param name="pbKeyState">
/// [in] Pointer to a 256-byte array that contains keyboard key states.
/// </param>
/// <returns>
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero. To get extended error information, call GetLastError.
/// </returns>
/// <remarks>
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/toascii.asp
/// </remarks>
[DllImport("user32")]
private static extern int GetKeyboardState(byte[] pbKeyState);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
private static extern short GetKeyState(int vKey);
#endregion
#region Windows constants
//values from Winuser.h in Microsoft SDK.
/// <summary>
/// Windows NT/2000/XP: Installs a hook procedure that monitors low-level mouse input events.
/// </summary>
private const int WH_MOUSE_LL = 14;
/// <summary>
/// Windows NT/2000/XP: Installs a hook procedure that monitors low-level keyboard input events.
/// </summary>
private const int WH_KEYBOARD_LL = 13;
/// <summary>
/// Installs a hook procedure that monitors mouse messages. For more information, see the MouseProc hook procedure.
/// </summary>
private const int WH_MOUSE = 7;
/// <summary>
/// Installs a hook procedure that monitors keystroke messages. For more information, see the KeyboardProc hook procedure.
/// </summary>
private const int WH_KEYBOARD = 2;
/// <summary>
/// The WM_MOUSEMOVE message is posted to a window when the cursor moves.
/// </summary>
private const int WM_MOUSEMOVE = 0x200;
/// <summary>
/// The WM_LBUTTONDOWN message is posted when the user presses the left mouse button
/// </summary>
private const int WM_LBUTTONDOWN = 0x201;
/// <summary>
/// The WM_RBUTTONDOWN message is posted when the user presses the right mouse button
/// </summary>
private const int WM_RBUTTONDOWN = 0x204;
/// <summary>
/// The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button
/// </summary>
private const int WM_MBUTTONDOWN = 0x207;
/// <summary>
/// The WM_LBUTTONUP message is posted when the user releases the left mouse button
/// </summary>
private const int WM_LBUTTONUP = 0x202;
/// <summary>
/// The WM_RBUTTONUP message is posted when the user releases the right mouse button
/// </summary>
private const int WM_RBUTTONUP = 0x205;
/// <summary>
/// The WM_MBUTTONUP message is posted when the user releases the middle mouse button
/// </summary>
private const int WM_MBUTTONUP = 0x208;
/// <summary>
/// The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button
/// </summary>
private const int WM_LBUTTONDBLCLK = 0x203;
/// <summary>
/// The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button
/// </summary>
private const int WM_RBUTTONDBLCLK = 0x206;
/// <summary>
/// The WM_RBUTTONDOWN message is posted when the user presses the right mouse button
/// </summary>
private const int WM_MBUTTONDBLCLK = 0x209;
/// <summary>
/// The WM_MOUSEWHEEL message is posted when the user presses the mouse wheel.
/// </summary>
private const int WM_MOUSEWHEEL = 0x020A;
/// <summary>
/// The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem
/// key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed.
/// </summary>
private const int WM_KEYDOWN = 0x100;
/// <summary>
/// The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem
/// key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed,
/// or a keyboard key that is pressed when a window has the keyboard focus.
/// </summary>
private const int WM_KEYUP = 0x101;
/// <summary>
/// The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user
/// presses the F10 key (which activates the menu bar) or holds down the ALT key and then
/// presses another key. It also occurs when no window currently has the keyboard focus;
/// in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that
/// receives the message can distinguish between these two contexts by checking the context
/// code in the lParam parameter.
/// </summary>
private const int WM_SYSKEYDOWN = 0x104;
/// <summary>
/// The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user
/// releases a key that was pressed while the ALT key was held down. It also occurs when no
/// window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent
/// to the active window. The window that receives the message can distinguish between
/// these two contexts by checking the context code in the lParam parameter.
/// </summary>
private const int WM_SYSKEYUP = 0x105;
private const byte VK_SHIFT = 0x10;
private const byte VK_CAPITAL = 0x14;
private const byte VK_NUMLOCK = 0x90;
#endregion
/// <summary>
/// Creates an instance of UserActivityHook object and sets mouse and keyboard hooks.
/// </summary>
/// <exception cref="Win32Exception">Any windows problem.</exception>
public UserActivityHook()
{
Start();
}
/// <summary>
/// Creates an instance of UserActivityHook object and installs both or one of mouse and/or keyboard hooks and starts rasing events
/// </summary>
/// <param name="InstallMouseHook"><b>true</b> if mouse events must be monitored</param>
/// <param name="InstallKeyboardHook"><b>true</b> if keyboard events must be monitored</param>
/// <exception cref="Win32Exception">Any windows problem.</exception>
/// <remarks>
/// To create an instance without installing hooks call new UserActivityHook(false, false)
/// </remarks>
public UserActivityHook(bool InstallMouseHook, bool InstallKeyboardHook)
{
Start(InstallMouseHook, InstallKeyboardHook);
}
/// <summary>
/// Destruction.
/// </summary>
~UserActivityHook()
{
//uninstall hooks and do not throw exceptions
Stop(true, true, false);
}
/// <summary>
/// Occurs when the user moves the mouse, presses any mouse button or scrolls the wheel
/// </summary>
///
public bool EnableMouse = false;
public event MouseEventHandler OnMouseLeftDown;
public event MouseEventHandler OnMouseLeftUp;
public event MouseEventHandler OnMouseWheelDown;
public event MouseEventHandler OnMouseWheelUp;
public bool MouseLeftDownEnable()
{
return OnMouseLeftDown != null;
}
public bool MouseLeftUpEnable()
{
return OnMouseLeftUp != null;
}
public bool MouseWheelDownEnable()
{
return OnMouseWheelDown != null;
}
public bool MouseWheelUpEnable()
{
return OnMouseWheelUp != null;
}
/// <summary>
/// Occurs when the user presses a key
/// </summary>
public event KeyEventHandler KeyDown;
/// <summary>
/// Occurs when the user presses and releases
/// </summary>
public event KeyPressEventHandler KeyPress;
/// <summary>
/// Occurs when the user releases a key
/// </summary>
public event KeyEventHandler KeyUp;
/// <summary>
/// Stores the handle to the mouse hook procedure.
/// </summary>
private int hMouseHook = 0;
/// <summary>
/// Stores the handle to the keyboard hook procedure.
/// </summary>
private int hKeyboardHook = 0;
/// <summary>
/// Declare MouseHookProcedure as HookProc type.
/// </summary>
private static HookProc MouseHookProcedure;
/// <summary>
/// Declare KeyboardHookProcedure as HookProc type.
/// </summary>
private static HookProc KeyboardHookProcedure;
/// <summary>
/// Installs both mouse and keyboard hooks and starts rasing events
/// </summary>
/// <exception cref="Win32Exception">Any windows problem.</exception>
public void Start()
{
this.Start(true, true);
}
/// <summary>
/// Installs both or one of mouse and/or keyboard hooks and starts rasing events
/// </summary>
/// <param name="InstallMouseHook"><b>true</b> if mouse events must be monitored</param>
/// <param name="InstallKeyboardHook"><b>true</b> if keyboard events must be monitored</param>
/// <exception cref="Win32Exception">Any windows problem.</exception>
public void Start(bool InstallMouseHook, bool InstallKeyboardHook)
{
this.EnableMouse = InstallMouseHook;
// install Mouse hook only if it is not installed and must be installed
if (hMouseHook == 0 && EnableMouse)
{
// Create an instance of HookProc.
MouseHookProcedure = new HookProc(MouseHookProc);
//install hook
hMouseHook = SetWindowsHookEx(
WH_MOUSE_LL,
MouseHookProcedure,
Marshal.GetHINSTANCE(
Assembly.GetExecutingAssembly().GetModules()[0]),
0);
//If SetWindowsHookEx fails.
if (hMouseHook == 0)
{
//Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute.SetLastError flag set.
int errorCode = Marshal.GetLastWin32Error();
//do cleanup
Stop(true, false, false);
//Initializes and throws a new instance of the Win32Exception class with the specified error.
throw new Win32Exception(errorCode);
}
}
// install Keyboard hook only if it is not installed and must be installed
if (hKeyboardHook == 0 && InstallKeyboardHook)
{
// Create an instance of HookProc.
KeyboardHookProcedure = new HookProc(KeyboardHookProc);
//install hook
hKeyboardHook = SetWindowsHookEx(
WH_KEYBOARD_LL,
KeyboardHookProcedure,
Marshal.GetHINSTANCE(
Assembly.GetExecutingAssembly().GetModules()[0]),
0);
//If SetWindowsHookEx fails.
if (hKeyboardHook == 0)
{
//Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute.SetLastError flag set.
int errorCode = Marshal.GetLastWin32Error();
//do cleanup
Stop(false, true, false);
//Initializes and throws a new instance of the Win32Exception class with the specified error.
throw new Win32Exception(errorCode);
}
}
}
/// <summary>
/// Stops monitoring both mouse and keyboard events and rasing events.
/// </summary>
/// <exception cref="Win32Exception">Any windows problem.</exception>
public void Stop()
{
this.Stop(true, true, true);
}
/// <summary>
/// Stops monitoring both or one of mouse and/or keyboard events and rasing events.
/// </summary>
/// <param name="UninstallMouseHook"><b>true</b> if mouse hook must be uninstalled</param>
/// <param name="UninstallKeyboardHook"><b>true</b> if keyboard hook must be uninstalled</param>
/// <param name="ThrowExceptions"><b>true</b> if exceptions which occured during uninstalling must be thrown</param>
/// <exception cref="Win32Exception">Any windows problem.</exception>
public void Stop(bool UninstallMouseHook, bool UninstallKeyboardHook, bool ThrowExceptions)
{
//if mouse hook set and must be uninstalled
if (hMouseHook != 0 && UninstallMouseHook)
{
//uninstall hook
int retMouse = UnhookWindowsHookEx(hMouseHook);
//reset invalid handle
hMouseHook = 0;
//if failed and exception must be thrown
if (retMouse == 0 && ThrowExceptions)
{
//Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute.SetLastError flag set.
int errorCode = Marshal.GetLastWin32Error();
//Initializes and throws a new instance of the Win32Exception class with the specified error.
throw new Win32Exception(errorCode);
}
}
//if keyboard hook set and must be uninstalled
if (hKeyboardHook != 0 && UninstallKeyboardHook)
{
//uninstall hook
int retKeyboard = UnhookWindowsHookEx(hKeyboardHook);
//reset invalid handle
hKeyboardHook = 0;
//if failed and exception must be thrown
if (retKeyboard == 0 && ThrowExceptions)
{
//Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute.SetLastError flag set.
int errorCode = Marshal.GetLastWin32Error();
//Initializes and throws a new instance of the Win32Exception class with the specified error.
throw new Win32Exception(errorCode);
}
}
}
/// <summary>
/// A callback function which will be called every time a mouse activity detected.
/// </summary>
/// <param name="nCode">
/// [in] Specifies whether the hook procedure must process the message.
/// If nCode is HC_ACTION, the hook procedure must process the message.
/// If nCode is less than zero, the hook procedure must pass the message to the
/// CallNextHookEx function without further processing and must return the
/// value returned by CallNextHookEx.
/// </param>
/// <param name="wParam">
/// [in] Specifies whether the message was sent by the current thread.
/// If the message was sent by the current thread, it is nonzero; otherwise, it is zero.
/// </param>
/// <param name="lParam">
/// [in] Pointer to a CWPSTRUCT structure that contains details about the message.
/// </param>
/// <returns>
/// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx.
/// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx
/// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC
/// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook
/// procedure does not call CallNextHookEx, the return value should be zero.
/// </returns>
private int MouseHookProc(int nCode, int wParam, IntPtr lParam)
{
// if ok and someone listens to our events
if ((nCode >= 0) && EnableMouse)
{
//Marshall the data from callback.
MouseLLHookStruct mouseHookStruct = (MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseLLHookStruct));
//detect button clicked
MouseButtons button = MouseButtons.None;
short mouseDelta = 0;
switch (wParam)
{
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
button = MouseButtons.Left;
break;
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
//case WM_RBUTTONUP:
//case WM_RBUTTONDBLCLK:
button = MouseButtons.Right;
break;
case WM_MOUSEWHEEL:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
button = MouseButtons.Middle;
//If the message is WM_MOUSEWHEEL, the high-order word of mouseData member is the wheel delta.
//One wheel click is defined as WHEEL_DELTA, which is 120.
//(value >> 16) & 0xffff; retrieves the high-order word from the given 32-bit value
mouseDelta = (short)((mouseHookStruct.mouseData >> 16) & 0xffff);
//TODO: X BUTTONS (I havent them so was unable to test)
//If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP,
//or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released,
//and the low-order word is reserved. This value can be one or more of the following values.
//Otherwise, mouseData is not used.
break;
}
//double clicks
int clickCount = 0;
if (button != MouseButtons.None)
if (wParam == WM_LBUTTONDBLCLK || wParam == WM_RBUTTONDBLCLK) clickCount = 2;
else clickCount = 1;
//generate event
MouseEventArgs e = new MouseEventArgs(
button,
clickCount,
mouseHookStruct.pt.x,
mouseHookStruct.pt.y,
mouseDelta);
//raise it
switch (wParam)
{
case WM_LBUTTONDOWN:
this.OnMouseLeftDown?.Invoke(this, e);
break;
case WM_LBUTTONUP:
this.OnMouseLeftUp?.Invoke(this, e);
break;
case WM_RBUTTONDOWN:
break;
case WM_RBUTTONUP:
break;
case WM_MOUSEWHEEL:
break;
case WM_MBUTTONDOWN:
this.OnMouseWheelDown?.Invoke(this, e);
break;
case WM_MBUTTONUP:
this.OnMouseWheelUp?.Invoke(this, e);
break;
}
}
//call next hook
return CallNextHookEx(hMouseHook, nCode, wParam, lParam);
}
/// <summary>
/// A callback function which will be called every time a keyboard activity detected.
/// </summary>
/// <param name="nCode">
/// [in] Specifies whether the hook procedure must process the message.
/// If nCode is HC_ACTION, the hook procedure must process the message.
/// If nCode is less than zero, the hook procedure must pass the message to the
/// CallNextHookEx function without further processing and must return the
/// value returned by CallNextHookEx.
/// </param>
/// <param name="wParam">
/// [in] Specifies whether the message was sent by the current thread.
/// If the message was sent by the current thread, it is nonzero; otherwise, it is zero.
/// </param>
/// <param name="lParam">
/// [in] Pointer to a CWPSTRUCT structure that contains details about the message.
/// </param>
/// <returns>
/// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx.
/// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx
/// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC
/// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook
/// procedure does not call CallNextHookEx, the return value should be zero.
/// </returns>
private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam)
{
//indicates if any of underlaing events set e.Handled flag
bool handled = false;
//it was ok and someone listens to events
if ((nCode >= 0) && (KeyDown != null || KeyUp != null || KeyPress != null))
{
//read structure KeyboardHookStruct at lParam
KeyboardHookStruct MyKeyboardHookStruct = (KeyboardHookStruct)Marshal.PtrToStructure(lParam, typeof(KeyboardHookStruct));
//raise KeyDown
if (KeyDown != null && (wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN))
{
Keys keyData = (Keys)MyKeyboardHookStruct.vkCode;
KeyEventArgs e = new KeyEventArgs(keyData);
KeyDown(this, e);
handled = handled || e.Handled;
}
// raise KeyPress
if (KeyPress != null && wParam == WM_KEYDOWN)
{
bool isDownShift = ((GetKeyState(VK_SHIFT) & 0x80) == 0x80 ? true : false);
bool isDownCapslock = (GetKeyState(VK_CAPITAL) != 0 ? true : false);
byte[] keyState = new byte[256];
GetKeyboardState(keyState);
byte[] inBuffer = new byte[2];
if (ToAscii(MyKeyboardHookStruct.vkCode,
MyKeyboardHookStruct.scanCode,
keyState,
inBuffer,
MyKeyboardHookStruct.flags) == 1)
{
char key = (char)inBuffer[0];
if ((isDownCapslock ^ isDownShift) && Char.IsLetter(key)) key = Char.ToUpper(key);
KeyPressEventArgs e = new KeyPressEventArgs(key);
KeyPress(this, e);
handled = handled || e.Handled;
}
}
// raise KeyUp
if (KeyUp != null && (wParam == WM_KEYUP || wParam == WM_SYSKEYUP))
{
Keys keyData = (Keys)MyKeyboardHookStruct.vkCode;
KeyEventArgs e = new KeyEventArgs(keyData);
KeyUp(this, e);
handled = handled || e.Handled;
}
}
//if event handled in application do not handoff to other listeners
if (handled)
return 1;
else
return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);
}
}
}

167
Util/WindowUtil.cs Normal file
View File

@@ -0,0 +1,167 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Interop;
namespace GeekDesk.Util
{
public class WindowUtil
{
public enum GetWindowCmd : uint
{
GW_HWNDFIRST = 0,
GW_HWNDLAST = 1,
GW_HWNDNEXT = 2,
GW_HWNDPREV = 3,
GW_OWNER = 4,
GW_CHILD = 5,
GW_ENABLEDPOPUP = 6
}
[Flags]
public enum SetWindowPosFlags
{
SWP_NOSIZE = 0x0001,
SWP_NOMOVE = 0x0002,
SWP_NOZORDER = 0x0004,
SWP_NOREDRAW = 0x0008,
SWP_NOACTIVATE = 0x0010,
SWP_FRAMECHANGED = 0x0020,
SWP_SHOWWINDOW = 0x0040,
SWP_HIDEWINDOW = 0x0080,
SWP_NOCOPYBITS = 0x0100,
SWP_NOOWNERZORDER = 0x0200,
SWP_NOSENDCHANGING = 0x0400
}
//取得前台窗口句柄函数
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
//取得桌面窗口句柄函数
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern IntPtr GetWindow(HandleRef hWnd, int nCmd);
[DllImport("user32.dll")]
private static extern IntPtr SetParent(IntPtr child, IntPtr parent);
[DllImport("user32.dll", EntryPoint = "GetDCEx", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern bool SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, int x, int y, int cx, int cy, int flags);
[DllImport("user32.dll")]
private static extern int ReleaseDC(IntPtr window, IntPtr handle);
[DllImport("user32.dll")]
static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private const int GWL_STYLE = -16;
private const int WS_MAXIMIZEBOX = 0x10000;
public static void DisableMaxWindow(Window window)
{
var hwnd = new WindowInteropHelper(window).Handle;
var value = GetWindowLong(hwnd, GWL_STYLE);
SetWindowLong(hwnd, GWL_STYLE, (int)(value & ~WS_MAXIMIZEBOX));
}
public static void SetOwner(Window window, Window parentWindow)
{
SetOwner(window, new WindowInteropHelper(parentWindow).Handle);
}
public static void SetOwner(Window window, IntPtr parentHandle)
{
WindowInteropHelper helper = new WindowInteropHelper(window);
helper.Owner = parentHandle;
}
/// <summary>
///
/// </summary>
/// <param name="window"></param>
/// <returns></returns>
public static bool WindowIsTop(Window window)
{
IntPtr handle = new WindowInteropHelper(window).Handle;
IntPtr deskHandle = GetDesktopHandle(window, DesktopLayer.Progman);
IntPtr topHandle = GetForegroundWindow();
//暂时不能正确获取桌面handle 但发现焦点在桌面时 window title为空
string windowTitle = GetWindowTitle(topHandle);
return topHandle.Equals(handle) || topHandle.Equals(deskHandle) || string.IsNullOrEmpty(windowTitle);
}
private static string GetWindowTitle(IntPtr handle)
{
const int nChars = 256;
StringBuilder Buff = new StringBuilder(nChars);
if (GetWindowText(handle, Buff, nChars) > 0)
{
return Buff.ToString();
}
return null;
}
public const int GW_CHILD = 5;
public static IntPtr GetDesktopHandle(Window window, DesktopLayer layer)
{
HandleRef hWnd;
IntPtr hDesktop = new IntPtr();
switch (layer)
{
case DesktopLayer.Progman:
hDesktop = FindWindow("Progman", null);//第一层桌面
break;
case DesktopLayer.SHELLDLL:
hDesktop = FindWindow("Progman", null);//第一层桌面
hWnd = new HandleRef(window, hDesktop);
hDesktop = GetWindow(hWnd, GW_CHILD);//第2层桌面
break;
case DesktopLayer.FolderView:
hDesktop = FindWindow("Progman", null);//第一层桌面
hWnd = new HandleRef(window, hDesktop);
hDesktop = GetWindow(hWnd, GW_CHILD);//第2层桌面
hWnd = new HandleRef(window, hDesktop);
hDesktop = GetWindow(hWnd, GW_CHILD);//第3层桌面
hWnd = new HandleRef(window, hDesktop);
hDesktop = GetWindow(hWnd, GW_CHILD);//第4层桌面
break;
}
return hDesktop;
}
}
public enum DesktopLayer
{
Progman = 0,
SHELLDLL = 1,
FolderView = 2
}
}

View File

@@ -103,7 +103,57 @@ namespace GeekDesk.ViewModel
private bool itemSpradeAnimation; //列表展开动画
private bool? secondsWindow; //秒数窗口 默认打开
private bool? enableEveryThing;
private bool? alwaysTopmost;
public bool? AlwaysTopmost
{
get
{
if (alwaysTopmost == null) alwaysTopmost = false;
return alwaysTopmost;
}
set
{
alwaysTopmost = value;
OnPropertyChanged("AlwaysTopmost");
}
}
public bool? EnableEveryThing
{
get
{
if (enableEveryThing == null) enableEveryThing = false;
return enableEveryThing;
}
set
{
enableEveryThing = value;
OnPropertyChanged("EnableEveryThing");
}
}
#region GetSet
public bool? SecondsWindow
{
get
{
if (secondsWindow == null) secondsWindow = true;
return secondsWindow;
}
set
{
secondsWindow = value;
OnPropertyChanged("SecondsWindow");
}
}
public bool ItemSpradeAnimation
{
get

View File

@@ -283,6 +283,7 @@ namespace GeekDesk.ViewModel
{
bitmapImage = value;
ImageByteArr_NoWrite = ImageUtil.BitmapImageToByte(bitmapImage);
OnPropertyChanged("BitmapImage_NoWrite");
}
}
@@ -346,8 +347,11 @@ namespace GeekDesk.ViewModel
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
if (propertyName!=null && propertyName.Contains("NoWrite"))
{
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
}
}
}

View File

@@ -21,8 +21,36 @@ namespace GeekDesk.ViewModel
private string geometryColor; //几何图标颜色
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
private bool isEncrypt; //是否加密
private MenuType menuType; //菜单类型 普通, 关联
private string linkPath; //关联路径
public string LinkPath
{
get
{
return linkPath;
}
set
{
linkPath = value;
OnPropertyChanged("LinkPath");
}
}
public MenuType MenuType
{
get
{
return menuType;
}
set
{
menuType = value;
OnPropertyChanged("MenuType");
}
}
public bool IsEncrypt
{
get

View File

@@ -13,7 +13,7 @@ namespace GeekDesk.ViewModel.Temp
//gradientBGParams = (ObservableCollection<GradientBGParam>)ConfigurationManager.GetSection("SystemBGs")
gradientBGParams = new ObservableCollection<GradientBGParam>
{
new GradientBGParam("魅惑妖术", "#FFDDE1", "#EE9CA7"),
new GradientBGParam("魅惑妖术", "#EE9CA7", "#FFDDE1"),
new GradientBGParam ("森林之友", "#EBF7E3", "#A8E4C0"),
new GradientBGParam("完美谢幕", "#D76D77", "#FFAF7B")
};

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public class GuideInfoList
{
public static ObservableCollection<GuideInfo> mainWindowGuideList = new ObservableCollection<GuideInfo>();
static GuideInfoList()
{
GuideInfo guideInfo = new GuideInfo
{
Title1 = "引导提示",
Title2 = "图标列表区",
GuideText = "右侧高亮区域是图标列表区, 将文件拖动到图标列表区将自动创建快捷方式, 或者鼠标右键单击添加系统项目"
};
mainWindowGuideList.Add(guideInfo);
guideInfo = new GuideInfo
{
Title1 = "引导提示",
Title2 = "菜单栏",
GuideText = "左侧高亮区域是菜单栏, 右键单击左侧区域可以创建菜单, 右键单击菜单可以对菜单进行操作"
};
mainWindowGuideList.Add(guideInfo);
guideInfo = new GuideInfo
{
Title1 = "引导提示",
Title2 = "拖动区域",
GuideText = "左键按住上部高亮区域可以拖动程序窗体"
};
mainWindowGuideList.Add(guideInfo);
guideInfo = new GuideInfo
{
Title1 = "引导提示",
Title2 = "设置和关闭",
GuideText = "高亮区域的两个按钮分别是设置和关闭按钮, 你可以点击设置按钮重新打开引导提示, 设置窗口中可自定义开启或关闭众多功能, 赶紧探索使用吧"
};
mainWindowGuideList.Add(guideInfo);
}
public class GuideInfo
{
private string title1;
private string title2;
private string guideText;
public string Title1 { get; set; }
public string Title2 { get; set; }
public string GuideText { get; set; }
}
public enum GuidePopOffect
{
TOP,
INNER_TOP,
LEFT,
INNER_LEFT,
CENTER,
RIGHT,
INNER_RIGHT,
BOTTOM,
INNER_BOTTOM
}
}
}

View File

@@ -21,8 +21,15 @@ namespace GeekDesk.ViewModel.Temp
}
}
public static void RemoveAll()
{
while (IconList.Count > 0)
{
IconList.RemoveAt(IconList.Count - 1);
}
}
public static event PropertyChangedEventHandler PropertyChanged;
private static event PropertyChangedEventHandler PropertyChanged;
private static void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(null, new PropertyChangedEventArgs(propertyName));

Some files were not shown because too many files have changed in this diff Show More