Compare commits
91 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f65c303a0 | ||
|
|
6ae4312bdf | ||
|
|
001270e4ad | ||
|
|
aa2ca80822 | ||
|
|
43314a3006 | ||
|
|
a682f27223 | ||
|
|
7360412c97 | ||
|
|
a50d88f2c2 | ||
|
|
3fa3a42bb3 | ||
|
|
904e9a2999 | ||
|
|
6f62e6b2a0 | ||
|
|
bf4111cc81 | ||
|
|
39bb8e0c67 | ||
|
|
01350dff43 | ||
|
|
8efab6bdee | ||
|
|
cbaeb71a0c | ||
|
|
b8a6c9b91d | ||
|
|
001d807bb3 | ||
|
|
93e70e4525 | ||
|
|
240008ce2c | ||
|
|
6cfa9b1361 | ||
|
|
8f043ffd05 | ||
|
|
6e58afcdea | ||
|
|
896dc26f11 | ||
|
|
d44cc90100 | ||
|
|
da7588273e | ||
|
|
c7ef24a5b1 | ||
|
|
6b6372847c | ||
|
|
3995084776 | ||
|
|
7d061abadc | ||
|
|
9d174ed2fc | ||
|
|
444697b457 | ||
|
|
2ecad2fea2 | ||
|
|
e46d64193b | ||
|
|
e42f2c3c73 | ||
|
|
0aa7969e4a | ||
|
|
1a88194d26 | ||
|
|
b47dd0fbf7 | ||
|
|
50cebd48ce | ||
|
|
4c5c88769f | ||
|
|
2fc38fdb5f | ||
|
|
c310fd441f | ||
|
|
302e8bff8b | ||
|
|
12ac544e42 | ||
|
|
d72ea7a43a | ||
|
|
f868eb77b6 | ||
|
|
efb8c537d3 | ||
|
|
f56991410b | ||
|
|
9cbbd6cf45 | ||
|
|
524b134d16 | ||
|
|
5c17348312 | ||
|
|
bc7d125801 | ||
|
|
f1a5e64617 | ||
|
|
cbffdada7a | ||
|
|
bf5a6da448 | ||
|
|
28d6fe07d4 | ||
|
|
e0824f3067 | ||
|
|
5d51b0dbe9 | ||
|
|
39607bdcb5 | ||
|
|
a0ba6d4ecd | ||
|
|
a7a2ee9f08 | ||
|
|
1a1350ee53 | ||
|
|
ddabf0a113 | ||
|
|
09ab951ccd | ||
|
|
84727d8040 | ||
|
|
d01a27b827 | ||
|
|
5cfaf9a37d | ||
|
|
d4891e08a0 | ||
|
|
00657550b2 | ||
|
|
718a7f48d2 | ||
|
|
e578fbbb9b | ||
|
|
2d66ccf61b | ||
|
|
ed0eaee98f | ||
|
|
4941037081 | ||
|
|
f7b3cf71c7 | ||
|
|
2d2f1672dd | ||
|
|
072985d2b6 | ||
|
|
e5f1368c8b | ||
|
|
89ebbbed78 | ||
|
|
c1d6aec622 | ||
|
|
fbcd55b586 | ||
|
|
9053f4c25b | ||
|
|
13fbacba40 | ||
|
|
dee1caa435 | ||
|
|
dedf20528f | ||
|
|
33b9d3af42 | ||
|
|
4f59c2c64d | ||
|
|
701734e048 | ||
|
|
78b685c9ed | ||
|
|
746eda8b84 | ||
|
|
b4215fb27d |
33
App.config
33
App.config
@@ -2,7 +2,16 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<section name="SystemIcons" type="System.Configuration.DictionarySectionHandler" />
|
<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>
|
</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="800" />
|
||||||
|
</ShowSecondsSettings>
|
||||||
<SystemIcons>
|
<SystemIcons>
|
||||||
<add key="Calculator" value="计算器" />
|
<add key="Calculator" value="计算器" />
|
||||||
<add key="Computer" value="此电脑" />
|
<add key="Computer" value="此电脑" />
|
||||||
@@ -16,11 +25,15 @@
|
|||||||
<add key="CMD" value="命令行" />
|
<add key="CMD" value="命令行" />
|
||||||
<add key="Services" value="服务" />
|
<add key="Services" value="服务" />
|
||||||
</SystemIcons>
|
</SystemIcons>
|
||||||
|
<SystemBGs>
|
||||||
|
<GradientBGParam Color1="#FCCF31" Color2="#F55555" Name="诸神黄昏" />
|
||||||
|
</SystemBGs>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
</startup>
|
</startup>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<probing privatePath="lib" />
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0" />
|
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0" />
|
||||||
@@ -41,16 +54,22 @@
|
|||||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.1.1.0" newVersion="2.1.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="Version" value="2.4.14" />
|
<add key="Version" value="2.5.12" />
|
||||||
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
|
<add key="GitHubUrl" value="https://github.com/BookerLiu/GeekDesk" />
|
||||||
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
|
<add key="GiteeUrl" value="https://gitee.com/BookerLiu/GeekDesk/tree/master" />
|
||||||
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
<add key="GitHubUpdateUrl" value="https://raw.githubusercontent.com/BookerLiu/GeekDesk/master/Update.json" />
|
||||||
<add key="GiteeUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
<add key="GiteeUpdateUrl" value="https://gitee.com/BookerLiu/GeekDesk/raw/master/Update.json" />
|
||||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
<!--<add key="GiteeUpdateUrl" value="file:///D:/WorkSpace/workspace-VS/GeekDesk/Update.json" />-->
|
||||||
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
|
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||||
|
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
|
||||||
|
<add key="ShowPublicWeChat" value="Y" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<system.web>
|
<system.web>
|
||||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||||
|
|||||||
2
App.xaml
2
App.xaml
@@ -13,6 +13,8 @@
|
|||||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
||||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
||||||
<ResourceDictionary Source="/GeekDesk;component/Resource/Dictionary/CommonStyle.xaml"/>
|
<ResourceDictionary Source="/GeekDesk;component/Resource/Dictionary/CommonStyle.xaml"/>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/XamlFlair.WPF;component/DefaultAnimations.xaml"/>
|
||||||
|
<ResourceDictionary Source="/GeekDesk;component/Resource/Dictionary/XamlFlairSettings.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|||||||
23
App.xaml.cs
23
App.xaml.cs
@@ -1,11 +1,8 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using Microsoft.Win32;
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Input;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace GeekDesk
|
namespace GeekDesk
|
||||||
@@ -27,7 +24,6 @@ namespace GeekDesk
|
|||||||
|
|
||||||
private void App_Startup(object sender, StartupEventArgs e)
|
private void App_Startup(object sender, StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out bool ret);
|
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out bool ret);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
@@ -35,6 +31,10 @@ namespace GeekDesk
|
|||||||
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out ret);
|
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out ret);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
|
MessageUtil.SendMsgByWName(
|
||||||
|
"GeekDesk_Main_" + Constants.MY_UUID,
|
||||||
|
"ShowApp"
|
||||||
|
);
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,7 @@ namespace GeekDesk
|
|||||||
void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
e.Handled = true;//使用这一行代码告诉运行时,该异常被处理了,不再作为UnhandledException抛出了。
|
e.Handled = true;//使用这一行代码告诉运行时,该异常被处理了,不再作为UnhandledException抛出了。
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
LogUtil.WriteErrorLog(e, "未捕获异常!");
|
LogUtil.WriteErrorLog(e, "未捕获异常!");
|
||||||
if (Constants.DEV)
|
if (Constants.DEV)
|
||||||
{
|
{
|
||||||
@@ -55,6 +56,18 @@ namespace GeekDesk
|
|||||||
LogUtil.WriteErrorLog(e, "严重异常!");
|
LogUtil.WriteErrorLog(e, "严重异常!");
|
||||||
MessageBox.Show("GeekDesk遇到未知问题崩溃!");
|
MessageBox.Show("GeekDesk遇到未知问题崩溃!");
|
||||||
}
|
}
|
||||||
|
public static void DoEvents()
|
||||||
|
{
|
||||||
|
var frame = new DispatcherFrame();
|
||||||
|
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
|
||||||
|
new DispatcherOperationCallback(
|
||||||
|
delegate (object f)
|
||||||
|
{
|
||||||
|
((DispatcherFrame)f).Continue = false;
|
||||||
|
return null;
|
||||||
|
}), frame);
|
||||||
|
Dispatcher.PushFrame(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
11
Constant/BGStyle.cs
Normal file
11
Constant/BGStyle.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/// <summary>
|
||||||
|
/// 背景风格
|
||||||
|
/// </summary>
|
||||||
|
namespace GeekDesk.Constant
|
||||||
|
{
|
||||||
|
public enum BGStyle
|
||||||
|
{
|
||||||
|
ImgBac = 1, //图片
|
||||||
|
GradientBac = 2 //渐变色
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace GeekDesk.Constant
|
namespace GeekDesk.Constant
|
||||||
{
|
{
|
||||||
@@ -17,14 +13,28 @@ namespace GeekDesk.Constant
|
|||||||
|
|
||||||
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
|
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
|
||||||
|
|
||||||
|
public static string MY_UUID = "8400A17AEEF7C029";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// app数据文件路径
|
/// app数据文件路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string DATA_FILE_PATH = APP_DIR + "Data"; //app数据文件路径
|
public static string DATA_FILE_PATH = APP_DIR + "Data"; //app数据文件路径
|
||||||
|
|
||||||
public static string LOG_FILE_PATH = APP_DIR + "Log.log";
|
/// <summary>
|
||||||
|
/// 备份文件路径
|
||||||
|
/// </summary>
|
||||||
|
public static string DATA_FILE_BAK_PATH = APP_DIR + "bak\\Data.bak"; //app备份数据文件路径
|
||||||
|
|
||||||
|
public static string PW_FILE_BAK_PATH = APP_DIR + "bak\\pw.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 string ERROR_FILE_PATH = APP_DIR + "Error.log";
|
|
||||||
|
|
||||||
public static int SHADOW_WIDTH = 20;
|
public static int SHADOW_WIDTH = 20;
|
||||||
|
|
||||||
|
|||||||
10
Constant/HotKeyType.cs
Normal file
10
Constant/HotKeyType.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace GeekDesk.Constant
|
||||||
|
{
|
||||||
|
public enum HotKeyType
|
||||||
|
{
|
||||||
|
|
||||||
|
Main = 0, //主窗口
|
||||||
|
ToDo = 1, //待办任务
|
||||||
|
ColorPicker = 2 //拾色器
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
/// <summary>
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 图标应用启动方式
|
/// 图标应用启动方式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
namespace GeekDesk.Constant
|
namespace GeekDesk.Constant
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace GeekDesk.Constant
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace GeekDesk.Constant
|
|
||||||
{
|
{
|
||||||
public enum IconType
|
public enum IconType
|
||||||
{
|
{
|
||||||
|
|||||||
16
Constant/PasswordType.cs
Normal file
16
Constant/PasswordType.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GeekDesk.Constant
|
||||||
|
{
|
||||||
|
public enum PasswordType
|
||||||
|
{
|
||||||
|
INPUT = 0, //键入密码
|
||||||
|
CREATE = 1, //新建密码
|
||||||
|
ALTER = 2, //修改密码
|
||||||
|
CANCEL = 3, //取消密码
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace GeekDesk.Constant
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace GeekDesk.Constant
|
|
||||||
{
|
{
|
||||||
internal class RunTimeStatus
|
internal class RunTimeStatus
|
||||||
{
|
{
|
||||||
@@ -20,7 +14,49 @@ namespace GeekDesk.Constant
|
|||||||
public static bool MARGIN_HIDE_AND_OTHER_SHOW = false;
|
public static bool MARGIN_HIDE_AND_OTHER_SHOW = false;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否锁定主面板 锁定后 不执行隐藏动作
|
||||||
|
/// </summary>
|
||||||
|
public static bool LOCK_APP_PANEL = false;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否弹出了菜单密码框
|
||||||
|
/// </summary>
|
||||||
|
public static bool SHOW_MENU_PASSWORDBOX = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否弹出了右键菜单
|
||||||
|
/// </summary>
|
||||||
|
public static bool SHOW_RIGHT_BTN_MENU = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否点击了面板功能按钮
|
||||||
|
/// </summary>
|
||||||
|
public static bool APP_BTN_IS_DOWN = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否正在编辑菜单
|
||||||
|
/// </summary>
|
||||||
|
public static bool IS_MENU_EDIT = false;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图标card 鼠标滚轮是否正在工作
|
||||||
|
/// 用来控制popup的显示 否则低性能机器会造成卡顿
|
||||||
|
/// </summary>
|
||||||
|
public static bool ICONLIST_MOUSE_WHEEL = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 控制多少毫秒后 关闭(ICONLIST_MOUSE_WHEEL)鼠标滚轮运行状态
|
||||||
|
/// </summary>
|
||||||
|
public static int MOUSE_WHEEL_WAIT_MS = 100;
|
||||||
|
/// <summary>
|
||||||
|
/// 与关闭popup 配合使用, 避免线程结束后不显示popup
|
||||||
|
/// </summary>
|
||||||
|
public static bool MOUSE_ENTER_ICON = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 控制每次刷新搜索结果 鼠标移动后显示popup
|
||||||
|
/// </summary>
|
||||||
|
public static int MOUSE_MOVE_COUNT = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
Constant/SearchType.cs
Normal file
14
Constant/SearchType.cs
Normal 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 SearchType
|
||||||
|
{
|
||||||
|
HOT_KEY = 0, //快捷键
|
||||||
|
KEY_DOWN = 1, //按下即搜
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace GeekDesk.Constant
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace GeekDesk.Constant
|
|
||||||
{
|
{
|
||||||
public enum TodoTaskExecType
|
public enum TodoTaskExecType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
/// <summary>
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新源
|
/// 更新源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
namespace GeekDesk.Constant
|
namespace GeekDesk.Constant
|
||||||
|
|||||||
15
Constant/WidthTypeEnum.cs
Normal file
15
Constant/WidthTypeEnum.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
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 //右侧托盘宽度的一半
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,18 +5,8 @@ using GeekDesk.ViewModel;
|
|||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.Other
|
namespace GeekDesk.Control.Other
|
||||||
{
|
{
|
||||||
@@ -72,7 +62,7 @@ namespace GeekDesk.Control.Other
|
|||||||
}
|
}
|
||||||
ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
|
ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
|
||||||
ToDoTask.activityBacklog.Remove(info);//激活任务删除
|
ToDoTask.activityBacklog.Remove(info);//激活任务删除
|
||||||
CommonCode.SaveAppData(appData);
|
CommonCode.SaveAppData(appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Control.Windows;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using Microsoft.Win32;
|
|
||||||
using System;
|
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.Other
|
namespace GeekDesk.Control.Other
|
||||||
|
|||||||
54
Control/Other/GlobalMsgNotification.xaml
Normal file
54
Control/Other/GlobalMsgNotification.xaml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<Border x:Class="GeekDesk.Control.Other.GlobalMsgNotification"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
BorderThickness="0"
|
||||||
|
Style="{StaticResource BorderBG}"
|
||||||
|
Margin="15"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}"
|
||||||
|
Width="320"
|
||||||
|
Height="400">
|
||||||
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="AliceBlue" Opacity="0.96"/>
|
||||||
|
</Border.Background>
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
<StackPanel>
|
||||||
|
<Image Source="/Resource/Image/BacklogImg.png" Width="260" Margin="0,20,0,0"/>
|
||||||
|
<hc:Card Width="260" Height="220" BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="0,20,0,0">
|
||||||
|
|
||||||
|
<Border CornerRadius="4,4,0,0" Height="160" Padding="10,0,10,0">
|
||||||
|
<ScrollViewer>
|
||||||
|
<TextBlock TextOptions.TextFormattingMode="Display"
|
||||||
|
TextOptions.TextHintingMode="Animated"
|
||||||
|
UseLayoutRounding="True"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
FontStyle="Normal"
|
||||||
|
FontSize="15"
|
||||||
|
LineHeight="22"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Text="{Binding Msg}"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
|
<!--<hc:Card.Footer>
|
||||||
|
<StackPanel Margin="10" Width="160">
|
||||||
|
|
||||||
|
<TextBlock TextWrapping="NoWrap" FontSize="20" Style="{DynamicResource TextBlockLargeBold}" TextTrimming="CharacterEllipsis"
|
||||||
|
Text="{Binding Title}"
|
||||||
|
HorizontalAlignment="Left"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock TextWrapping="NoWrap" Style="{DynamicResource TextBlockDefault}" TextTrimming="CharacterEllipsis"
|
||||||
|
Margin="0,6,0,0"
|
||||||
|
HorizontalAlignment="Left"/>
|
||||||
|
</StackPanel>
|
||||||
|
</hc:Card.Footer>-->
|
||||||
|
</hc:Card>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<Button Click="Close_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
61
Control/Other/GlobalMsgNotification.xaml.cs
Normal file
61
Control/Other/GlobalMsgNotification.xaml.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Task;
|
||||||
|
using GeekDesk.Util;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using HandyControl.Controls;
|
||||||
|
using Quartz;
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace GeekDesk.Control.Other
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// BacklogNotificatin.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class GlobalMsgNotification
|
||||||
|
{
|
||||||
|
|
||||||
|
public Notification ntf;
|
||||||
|
public GlobalMsgNotification(DialogMsg msg)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.DataContext = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class DialogMsg
|
||||||
|
{
|
||||||
|
public string msg;
|
||||||
|
public string title;
|
||||||
|
|
||||||
|
public string Msg
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
msg = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
title = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Close_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ntf.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
74
Control/Other/GradientBGDialog.xaml
Normal file
74
Control/Other/GradientBGDialog.xaml
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<Border x:Class="GeekDesk.Control.Other.GradientBGDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
CornerRadius="4"
|
||||||
|
>
|
||||||
|
<Grid>
|
||||||
|
<StackPanel>
|
||||||
|
<Grid Width="750"
|
||||||
|
Height="550"
|
||||||
|
Panel.ZIndex="0"
|
||||||
|
MouseDown="DragMove"
|
||||||
|
>
|
||||||
|
<Grid.Background>
|
||||||
|
<SolidColorBrush Color="Black" Opacity="0.01"/>
|
||||||
|
</Grid.Background>
|
||||||
|
</Grid>
|
||||||
|
<hc:TransitioningContentControl TransitionMode="Fade"
|
||||||
|
Panel.ZIndex="99"
|
||||||
|
Width="600"
|
||||||
|
Height="400"
|
||||||
|
Margin="0,-620,0,0">
|
||||||
|
<Border Style="{StaticResource BorderBG}">
|
||||||
|
<Grid>
|
||||||
|
<ListBox x:Name="GradientBGs"
|
||||||
|
ItemsSource="{Binding}"
|
||||||
|
Background="Transparent"
|
||||||
|
Margin="20,20,20,50"
|
||||||
|
BorderThickness="0"
|
||||||
|
>
|
||||||
|
<ListBox.ItemContainerStyle>
|
||||||
|
<Style TargetType="ListBoxItem">
|
||||||
|
<Setter Property="Margin" Value="10"/>
|
||||||
|
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
|
</Style>
|
||||||
|
</ListBox.ItemContainerStyle>
|
||||||
|
<ListBox.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<WrapPanel Background="Transparent"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ListBox.ItemsPanel>
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border CornerRadius="4" Width="100" Height="100"
|
||||||
|
MouseLeftButtonDown="BGBorder_MouseLeftButtonDown"
|
||||||
|
Tag="{Binding}">
|
||||||
|
<Border.Background>
|
||||||
|
<LinearGradientBrush>
|
||||||
|
<GradientStop Offset="0" Color="{Binding Color1}"/>
|
||||||
|
<GradientStop Offset="1" Color="{Binding Color2}"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Border.Background>
|
||||||
|
<Border Width="100" Height="30" VerticalAlignment="Bottom">
|
||||||
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="Gray" Opacity="0.4"/>
|
||||||
|
</Border.Background>
|
||||||
|
<TextBlock Text="{Binding Name}" TextAlignment="Center" VerticalAlignment="Center" FontSize="17" FontWeight="Bold" Foreground="White"/>
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</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"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
52
Control/Other/GradientBGDialog.xaml.cs
Normal file
52
Control/Other/GradientBGDialog.xaml.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using GeekDesk.Util;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using GeekDesk.ViewModel.Temp;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace GeekDesk.Control.Other
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TextDialog.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class GradientBGDialog
|
||||||
|
{
|
||||||
|
public HandyControl.Controls.Dialog dialog;
|
||||||
|
|
||||||
|
public GradientBGDialog()
|
||||||
|
{
|
||||||
|
this.DataContext = GradientBGParamList.GradientBGParams;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Close_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
dialog.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BGBorder_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
GradientBGParam bgParam = (sender as Border).Tag as GradientBGParam;
|
||||||
|
MainWindow.appData.AppConfig.GradientBGParam = bgParam;
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移动窗口
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
|
{
|
||||||
|
Window.GetWindow(this).DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
CornerRadius="4"
|
CornerRadius="4"
|
||||||
Width="350"
|
Width="350"
|
||||||
Height="450"
|
Height="450"
|
||||||
@@ -10,29 +11,39 @@
|
|||||||
<Border.Resources>
|
<Border.Resources>
|
||||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||||
<Setter Property="Width" Value="75"/>
|
<Setter Property="Width" Value="75"/>
|
||||||
<Setter Property="TextAlignment" Value="Center"/>
|
<Setter Property="TextAlignment" Value="Left"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
<Setter Property="Margin" Value="0,8,0,0"/>
|
<Setter Property="Margin" Value="5,8,0,0"/>
|
||||||
<Setter Property="FontSize" Value="14"/>
|
<Setter Property="FontSize" Value="14"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||||
</Border.Resources>
|
</Border.Resources>
|
||||||
<hc:SimplePanel Margin="10" VerticalAlignment="Center">
|
<hc:SimplePanel Margin="10" VerticalAlignment="Center">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<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"/>
|
<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">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||||
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
||||||
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
|
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<TextBlock Text="相对路径:" Style="{StaticResource LeftTB}"/>
|
||||||
|
<TextBlock Text="{Binding RelativePath, Mode=OneWay}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Margin="0,8,0,0"
|
||||||
|
Width="230"
|
||||||
|
FontSize="14"
|
||||||
|
TextTrimming="WordEllipsis"
|
||||||
|
hc:Poptip.Placement="Bottom"
|
||||||
|
hc:Poptip.Content="{Binding RelativePath, Mode=OneWay, Converter={StaticResource StringAppendConvert}, ConverterParameter='\{\}\\\n(同盘符下才会建立相对路径)'}"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,15,0,0">
|
||||||
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
||||||
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
|
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
|
||||||
<Button Content="修改" Click="EditImage"/>
|
<Button Content="修改" Click="EditImage"/>
|
||||||
<Button Content="重置" Click="ReStoreImage"/>
|
<Button Content="重置" Click="ReStoreImage"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="4,15,0,0">
|
||||||
<hc:UniformSpacingPanel Spacing="10">
|
|
||||||
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
|
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -41,12 +52,11 @@
|
|||||||
</CheckBox.Background>
|
</CheckBox.Background>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||||
<hc:UniformSpacingPanel Spacing="10">
|
|
||||||
<TextBlock Text="启动参数:" Style="{StaticResource LeftTB}"/>
|
<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" Text="{Binding StartArg, Mode=OneWay}" Width="230" Height="100" TextWrapping="Wrap" FontSize="14"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<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 Btn1}" Click="SaveProperty" Margin="265,10,0,0"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using GeekDesk.Util;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ namespace GeekDesk.Control.Other
|
|||||||
info.Name = IconName.Text;
|
info.Name = IconName.Text;
|
||||||
info.AdminStartUp = IconIsAdmin.IsChecked.Value;
|
info.AdminStartUp = IconIsAdmin.IsChecked.Value;
|
||||||
info.StartArg = StartArg.Text;
|
info.StartArg = StartArg.Text;
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
dialog.Close();
|
dialog.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
IconInfo info = this.DataContext as IconInfo;
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -73,7 +73,7 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
IconInfo info = this.DataContext as IconInfo;
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e1)
|
catch (Exception e1)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using GeekDesk.ViewModel;
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
|
||||||
@@ -53,7 +52,7 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList.Add(info);
|
MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList.Add(info);
|
||||||
}
|
}
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
dialog.Close();
|
dialog.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +65,7 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
IconInfo info = this.DataContext as IconInfo;
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -87,14 +86,15 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
IconInfo info = this.DataContext as IconInfo;
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
} catch (Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
|
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
|
||||||
LogUtil.WriteErrorLog(ex, "修改图标失败!");
|
LogUtil.WriteErrorLog(ex, "修改图标失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
30
Control/Other/MyColorPickerDialog.xaml
Normal file
30
Control/Other/MyColorPickerDialog.xaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<Border x:Class="GeekDesk.Control.Other.MyColorPickerDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
CornerRadius="4"
|
||||||
|
>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<StackPanel>
|
||||||
|
<Grid Width="750"
|
||||||
|
Height="550"
|
||||||
|
Panel.ZIndex="0"
|
||||||
|
MouseDown="DragMove"
|
||||||
|
>
|
||||||
|
<Grid.Background>
|
||||||
|
<SolidColorBrush Color="Black" Opacity="0.01"/>
|
||||||
|
</Grid.Background>
|
||||||
|
</Grid>
|
||||||
|
<hc:ColorPicker x:Name="MyColorPicker"
|
||||||
|
Panel.ZIndex="99"
|
||||||
|
Margin="0,-500,0,0"
|
||||||
|
Confirmed="MyColorPicker_Confirmed"
|
||||||
|
Canceled="MyColorPicker_Canceled"
|
||||||
|
ToggleButton.Checked="MyColorPicker_Checked"
|
||||||
|
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
</Border>
|
||||||
106
Control/Other/MyColorPickerDialog.xaml.cs
Normal file
106
Control/Other/MyColorPickerDialog.xaml.cs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
using GeekDesk.Control.Windows;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
|
||||||
|
namespace GeekDesk.Control.Other
|
||||||
|
{
|
||||||
|
|
||||||
|
public enum ColorType
|
||||||
|
{
|
||||||
|
COLOR_1 = 1,
|
||||||
|
COLOR_2 = 2,
|
||||||
|
TEXT_COLOR = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// TextDialog.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class MyColorPickerDialog
|
||||||
|
{
|
||||||
|
public static ColorType COLOR_TYPE = new ColorType();
|
||||||
|
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
|
|
||||||
|
public static HandyControl.Controls.Dialog dialog;
|
||||||
|
private System.Windows.Controls.Primitives.ToggleButton toggleButton = null;
|
||||||
|
|
||||||
|
private static ColorType colorType;
|
||||||
|
|
||||||
|
|
||||||
|
public MyColorPickerDialog(string strType, string token)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
switch (strType)
|
||||||
|
{
|
||||||
|
case "Color1":
|
||||||
|
colorType = ColorType.COLOR_1; break;
|
||||||
|
case "Color2":
|
||||||
|
colorType = ColorType.COLOR_2; break;
|
||||||
|
default:
|
||||||
|
colorType = ColorType.TEXT_COLOR; break;
|
||||||
|
}
|
||||||
|
dialog = HandyControl.Controls.Dialog.Show(this, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 取消按钮事件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void MyColorPicker_Canceled(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MyColorPickerClose(sender);
|
||||||
|
}
|
||||||
|
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||||
|
{
|
||||||
|
MyColorPickerClose(sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||||
|
{
|
||||||
|
SolidColorBrush scb = MyColorPicker.SelectedBrush;
|
||||||
|
switch (colorType)
|
||||||
|
{
|
||||||
|
case ColorType.COLOR_1:
|
||||||
|
appConfig.GradientBGParam.Color1 = scb.ToString(); break;
|
||||||
|
case ColorType.COLOR_2:
|
||||||
|
appConfig.GradientBGParam.Color2 = scb.ToString(); break;
|
||||||
|
default:
|
||||||
|
appConfig.TextColor = scb.ToString(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移动窗口
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
|
{
|
||||||
|
Window.GetWindow(this).DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void MyColorPicker_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
toggleButton = e.OriginalSource as System.Windows.Controls.Primitives.ToggleButton;
|
||||||
|
|
||||||
|
PixelColorPickerWindow colorPickerWindow = new PixelColorPickerWindow(MyColorPicker);
|
||||||
|
colorPickerWindow.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyColorPickerClose(object sender)
|
||||||
|
{
|
||||||
|
dialog.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
75
Control/Other/PasswordDialog.xaml
Normal file
75
Control/Other/PasswordDialog.xaml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<Border x:Class="GeekDesk.Control.Other.PasswordDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||||
|
CornerRadius="6"
|
||||||
|
Width="300"
|
||||||
|
Height="150"
|
||||||
|
BorderThickness="0"
|
||||||
|
>
|
||||||
|
<Border.Resources>
|
||||||
|
<Style x:Key="PassBox" TargetType="PasswordBox" BasedOn="{StaticResource PasswordBoxBaseStyle}">
|
||||||
|
<Setter Property="Height" Value="40"/>
|
||||||
|
<Setter Property="Width" Value="40"/>
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||||
|
<Setter Property="FontSize" Value="18"/>
|
||||||
|
<Setter Property="Focusable" Value="True"/>
|
||||||
|
<Setter Property="MaxLength" Value="1"/>
|
||||||
|
<EventSetter Event="PasswordChanged" Handler="PasswordBox_PasswordChanged"/>
|
||||||
|
<EventSetter Event="PreviewKeyDown" Handler="PasswordBox_KeyDown"/>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="NextTB" TargetType="TextBlock">
|
||||||
|
<Setter Property="Foreground" Value="#408CCB"/>
|
||||||
|
<Setter Property="TextDecorations" Value="Underline"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Foreground" Value="Red"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Resources>
|
||||||
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="White" Opacity="0.7"/>
|
||||||
|
</Border.Background>
|
||||||
|
<StackPanel VerticalAlignment="Center">
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||||
|
<TextBlock x:Name="Title" Text="请输入密码"
|
||||||
|
FontSize="15"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<Grid Height="65" x:Name="PasswordGrid" Visibility="Visible" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
|
||||||
|
<TextBlock x:Name="HintMsg"
|
||||||
|
Visibility="Hidden"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Width="250"
|
||||||
|
TextAlignment="Center"
|
||||||
|
Margin="0,3,0,0"
|
||||||
|
Text="提示:"
|
||||||
|
hc:Poptip.Content="{Binding ElementName=HintMsg, Path=Text}"
|
||||||
|
Foreground="Gray"/>
|
||||||
|
<hc:UniformSpacingPanel Margin="0,20,0,0" Spacing="10" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||||
|
<PasswordBox x:Name="P1" Tag="P1" Style="{StaticResource PassBox}"/>
|
||||||
|
<PasswordBox x:Name="P2" Tag="P2" Style="{StaticResource PassBox}"/>
|
||||||
|
<PasswordBox x:Name="P3" Tag="P3" Style="{StaticResource PassBox}"/>
|
||||||
|
<PasswordBox x:Name="P4" Tag="P4" Style="{StaticResource PassBox}"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<TextBlock HorizontalAlignment="Right"
|
||||||
|
x:Name="ErrorMsg"
|
||||||
|
Margin="0,65,37,-65"
|
||||||
|
Foreground="Red"
|
||||||
|
Text="密码输入错误"
|
||||||
|
Visibility="Visible"/>
|
||||||
|
</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:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="202,35,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||||
|
<TextBlock Text="跳过" MouseLeftButtonDown="NextTB_MouseLeftButtonDown" Style="{StaticResource NextTB}"/>
|
||||||
|
<TextBlock Text="完成" MouseLeftButtonDown="DoneTB_MouseLeftButtonDown" Style="{StaticResource NextTB}"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
280
Control/Other/PasswordDialog.xaml.cs
Normal file
280
Control/Other/PasswordDialog.xaml.cs
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace GeekDesk.Control.Other
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TextDialog.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class PasswordDialog
|
||||||
|
{
|
||||||
|
private AppData appData = MainWindow.appData;
|
||||||
|
|
||||||
|
public PasswordType type;
|
||||||
|
public MenuInfo menuInfo;
|
||||||
|
public int count = 0;
|
||||||
|
private string tempPassword = null;
|
||||||
|
private PasswordType tempType;
|
||||||
|
public PasswordDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
PasswordBox pb = sender as PasswordBox;
|
||||||
|
if (!string.IsNullOrEmpty(pb.Password))
|
||||||
|
{
|
||||||
|
char c = pb.Password.ToCharArray()[0];
|
||||||
|
if (c > '9' || c < '0')
|
||||||
|
{
|
||||||
|
pb.Password = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string tag = pb.Tag.ToString();
|
||||||
|
switch (tag)
|
||||||
|
{
|
||||||
|
case "P1":
|
||||||
|
if (!string.IsNullOrEmpty(pb.Password))
|
||||||
|
{
|
||||||
|
P2.Focus();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "P2":
|
||||||
|
if (!string.IsNullOrEmpty(pb.Password))
|
||||||
|
{
|
||||||
|
P3.Focus();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "P3":
|
||||||
|
if (!string.IsNullOrEmpty(pb.Password))
|
||||||
|
{
|
||||||
|
P4.Focus();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "P4":
|
||||||
|
if (string.IsNullOrEmpty(pb.Password))
|
||||||
|
{
|
||||||
|
P3.Focus();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(P1.Password)
|
||||||
|
&& !string.IsNullOrEmpty(P2.Password)
|
||||||
|
&& !string.IsNullOrEmpty(P3.Password)
|
||||||
|
&& !string.IsNullOrEmpty(P4.Password))
|
||||||
|
{
|
||||||
|
string pw = P1.Password
|
||||||
|
+ P2.Password
|
||||||
|
+ P3.Password
|
||||||
|
+ P4.Password;
|
||||||
|
pw = MD5Util.CreateMD5(pw);
|
||||||
|
if (type == PasswordType.INPUT || type == PasswordType.CANCEL)
|
||||||
|
{
|
||||||
|
if (pw.Equals(appData.AppConfig.MenuPassword))
|
||||||
|
{
|
||||||
|
//隐藏弹框
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Collapsed;
|
||||||
|
//赋值
|
||||||
|
MainWindow.appData.AppConfig.SelectedMenuIcons
|
||||||
|
= appData.MenuList[
|
||||||
|
MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex
|
||||||
|
].IconList;
|
||||||
|
//显示数据托盘
|
||||||
|
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Visible;
|
||||||
|
//取消加密操作
|
||||||
|
if (type == PasswordType.CANCEL)
|
||||||
|
{
|
||||||
|
menuInfo.IsEncrypt = false;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//密码比对不一致
|
||||||
|
ErrorMsg.Text = "密码输入错误";
|
||||||
|
ErrorMsg.Visibility = Visibility.Visible;
|
||||||
|
if (!string.IsNullOrEmpty(appData.AppConfig.PasswordHint))
|
||||||
|
{
|
||||||
|
//显示提示信息
|
||||||
|
HintMsg.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (type == PasswordType.CREATE)
|
||||||
|
{
|
||||||
|
//创建密码
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
tempPassword = pw;
|
||||||
|
Title.Text = "再次输入密码";
|
||||||
|
ClearVal();
|
||||||
|
SetFocus(0);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (tempPassword.Equals(pw))
|
||||||
|
{
|
||||||
|
//两次密码设置一致 显示提示输入框
|
||||||
|
Title.Text = "填写密码提示";
|
||||||
|
PasswordGrid.Visibility = Visibility.Collapsed;
|
||||||
|
HintGrid.Visibility = Visibility.Visible;
|
||||||
|
HintBox.Focus();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
ErrorMsg.Text = "两次密码输入不一致";
|
||||||
|
ErrorMsg.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (type == PasswordType.ALTER)
|
||||||
|
{
|
||||||
|
//修改密码
|
||||||
|
if (appData.AppConfig.MenuPassword.Equals(pw))
|
||||||
|
{
|
||||||
|
tempType = type;
|
||||||
|
type = PasswordType.CREATE;
|
||||||
|
Title.Text = "设置新密码";
|
||||||
|
ClearVal();
|
||||||
|
SetFocus(0);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//密码比对不一致
|
||||||
|
ErrorMsg.Text = "密码输入错误";
|
||||||
|
ErrorMsg.Visibility = Visibility.Visible;
|
||||||
|
HintMsg.Text = MainWindow.appData.AppConfig.PasswordHint;
|
||||||
|
HintMsg.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//密码未输入完全 隐藏错误信息
|
||||||
|
if (ErrorMsg.IsVisible)
|
||||||
|
{
|
||||||
|
ErrorMsg.Visibility = Visibility.Hidden;
|
||||||
|
HintMsg.Visibility = Visibility.Hidden;
|
||||||
|
HintMsg.Visibility = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetFocus(int time = 100)
|
||||||
|
{
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
Thread.Sleep(time);
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(P1.Password))
|
||||||
|
{
|
||||||
|
P1.Focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(P2.Password))
|
||||||
|
{
|
||||||
|
P2.Focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(P3.Password))
|
||||||
|
{
|
||||||
|
P3.Focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
P4.Focus();
|
||||||
|
});
|
||||||
|
}).Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearVal()
|
||||||
|
{
|
||||||
|
P1.Clear();
|
||||||
|
P2.Clear();
|
||||||
|
P3.Clear();
|
||||||
|
P4.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 跳过设置密码提示
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void NextTB_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
appData.AppConfig.PasswordHint = "";
|
||||||
|
DonePassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DoneTB_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
string hint = HintBox.Text.Trim();
|
||||||
|
appData.AppConfig.PasswordHint = hint;
|
||||||
|
DonePassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DonePassword()
|
||||||
|
{
|
||||||
|
appData.AppConfig.MenuPassword = tempPassword;
|
||||||
|
CommonCode.SavePassword(tempPassword);
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Collapsed;
|
||||||
|
PasswordGrid.Visibility = Visibility.Visible;
|
||||||
|
HintGrid.Visibility = Visibility.Collapsed;
|
||||||
|
if (tempType == PasswordType.ALTER)
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.Success("密码修改成功!", "MainWindowGrowl");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
menuInfo.IsEncrypt = true;
|
||||||
|
HandyControl.Controls.Growl.Success(menuInfo.MenuName + " 已加密!", "MainWindowGrowl");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PasswordBox_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Back)
|
||||||
|
{
|
||||||
|
if (P2.IsKeyboardFocused)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(P2.Password))
|
||||||
|
{
|
||||||
|
P1.Password = "";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
P2.Password = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (P3.IsKeyboardFocused)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(P3.Password))
|
||||||
|
{
|
||||||
|
P2.Password = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
P3.Password = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (P4.IsKeyboardFocused)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(P4.Password))
|
||||||
|
{
|
||||||
|
P3.Password = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
P4.Password = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetFocus(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
@@ -16,25 +17,36 @@
|
|||||||
<Grid MouseDown="DragMove">
|
<Grid MouseDown="DragMove">
|
||||||
<hc:SimplePanel Margin="20,50,20,20" >
|
<hc:SimplePanel Margin="20,50,20,20" >
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
|
<Image Source="/Resource/Image/About.png"
|
||||||
|
Width="400"
|
||||||
|
Height="100"
|
||||||
|
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndContract}, Delay=250}"
|
||||||
|
/>
|
||||||
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk V"/>
|
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk V"/>
|
||||||
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
|
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
|
||||||
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
||||||
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
|
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
|
||||||
|
|
||||||
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Demo-liu"
|
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Star"
|
||||||
Command="hc:ControlCommands.OpenLink"
|
MouseEnter="SC_MouseEnter"
|
||||||
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
|
MouseLeave="SC_MouseLeave"
|
||||||
Margin="0,0,10,0" Color="#24292F"/>
|
Command="hc:ControlCommands.OpenLink"
|
||||||
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Demo-liu"
|
CommandParameter="https://github.com/BookerLiu/GeekDesk"
|
||||||
Command="hc:ControlCommands.OpenLink"
|
Margin="0,0,10,0" Color="#24292F"
|
||||||
CommandParameter="https://gitee.com/demo_liu/GeekDesk"
|
/>
|
||||||
Margin="0,0,10,0" Color="#C71D23"/>
|
|
||||||
|
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Star"
|
||||||
|
MouseEnter="SC_MouseEnter"
|
||||||
|
MouseLeave="SC_MouseLeave"
|
||||||
|
Command="hc:ControlCommands.OpenLink"
|
||||||
|
CommandParameter="https://gitee.com/BookerLiu/GeekDesk"
|
||||||
|
Margin="0,0,10,0" Color="#C71D23"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" HorizontalAlignment="Center" Margin="0,5,0,0">
|
<hc:UniformSpacingPanel Spacing="10" HorizontalAlignment="Center" Margin="0,5,0,0">
|
||||||
<hc:Shield Subject="公众号" Visibility="Visible" Status="抓几个娃" Margin="0,0,5,0" Color="#04913B">
|
<hc:Shield x:Name="PublicWeChatPanel" Subject="公众号" Visibility="Visible" Status="抓几个娃" Margin="0,0,5,0" Color="#04913B">
|
||||||
<hc:Poptip.Instance>
|
<hc:Poptip.Instance>
|
||||||
<hc:Poptip PlacementType="Top">
|
<hc:Poptip PlacementType="Top">
|
||||||
<hc:Poptip.Content>
|
<hc:Poptip.Content>
|
||||||
|
|||||||
@@ -1,20 +1,9 @@
|
|||||||
using System;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using GeekDesk.Util;
|
|
||||||
using GeekDesk.Constant;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.Config
|
namespace GeekDesk.Control.UserControls.Config
|
||||||
{
|
{
|
||||||
@@ -27,6 +16,15 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
AppInfo.Text += ConfigurationManager.AppSettings["Version"];
|
AppInfo.Text += ConfigurationManager.AppSettings["Version"];
|
||||||
|
string showPublicWeChat = ConfigurationManager.AppSettings["ShowPublicWeChat"];
|
||||||
|
if ("Y".Equals(showPublicWeChat))
|
||||||
|
{
|
||||||
|
PublicWeChatPanel.Visibility = Visibility.Visible;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
PublicWeChatPanel.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
PublicWeChat.Source = ImageUtil.Base64ToBitmapImage(Constants.PUBLIC_WE_CHAT_IMG_BASE64);
|
PublicWeChat.Source = ImageUtil.Base64ToBitmapImage(Constants.PUBLIC_WE_CHAT_IMG_BASE64);
|
||||||
WeChatCode.Source = ImageUtil.Base64ToBitmapImage(Constants.WE_CHAT_CODE_IMG_BASE64);
|
WeChatCode.Source = ImageUtil.Base64ToBitmapImage(Constants.WE_CHAT_CODE_IMG_BASE64);
|
||||||
ZFBCode.Source = ImageUtil.Base64ToBitmapImage(Constants.ZFB_CODE_IMG_BASE64);
|
ZFBCode.Source = ImageUtil.Base64ToBitmapImage(Constants.ZFB_CODE_IMG_BASE64);
|
||||||
@@ -45,5 +43,14 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
Window.GetWindow(this).DragMove();
|
Window.GetWindow(this).DragMove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SC_MouseEnter(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
this.Cursor = Cursors.Hand;
|
||||||
|
}
|
||||||
|
private void SC_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
this.Cursor = Cursors.Arrow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,17 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
|
||||||
|
d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
|
||||||
|
xmlns:cst="clr-namespace:GeekDesk.Constant"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
d:DesignHeight="300" d:DesignWidth="450">
|
d:DesignHeight="450" d:DesignWidth="450">
|
||||||
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
||||||
|
<cvt:SearchTypeConvert x:Key="SearchTypeConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid Background="Transparent" MouseDown="DragMove"
|
<Grid Background="Transparent" MouseDown="DragMove"
|
||||||
>
|
>
|
||||||
@@ -80,15 +84,7 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,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="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
|
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
|
||||||
@@ -105,34 +101,93 @@
|
|||||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
|
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
|
<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="快捷键"
|
||||||
|
IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=0}"/>
|
||||||
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
|
Style="{StaticResource RadioButtonIcon}" Content="按键即搜"
|
||||||
|
IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=1}"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="热键设置" VerticalAlignment="Center"/>
|
<TextBlock Text="热键设置" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板:" VerticalAlignment="Center" Width="55"/>
|
<TextBlock Text="主面板:" VerticalAlignment="Center" Margin="0,5,0,0" Width="55"/>
|
||||||
<hc:TextBox HorizontalAlignment="Left"
|
<hc:TextBox HorizontalAlignment="Left"
|
||||||
Tag="Main"
|
Tag="{x:Static cst:HotKeyType.Main}"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
IsReadOnlyCaretVisible="True"
|
IsReadOnlyCaretVisible="True"
|
||||||
Width="200"
|
Width="170"
|
||||||
Text="{Binding HotkeyStr}"
|
Text="{Binding HotkeyStr}"
|
||||||
KeyDown="HotKeyDown"
|
KeyDown="HotKeyDown"
|
||||||
KeyUp="HotKeyUp"
|
KeyUp="HotKeyUp"
|
||||||
/>
|
InputMethod.IsInputMethodEnabled="False"
|
||||||
|
/>
|
||||||
|
<CheckBox Content="启用"
|
||||||
|
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>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="新建待办:" Width="55"/>
|
<TextBlock Text="待办任务:" Margin="0,5,0,0" Width="55"/>
|
||||||
<hc:TextBox HorizontalAlignment="Left"
|
<hc:TextBox HorizontalAlignment="Left"
|
||||||
Tag="ToDo"
|
Tag="{x:Static cst:HotKeyType.ToDo}"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
IsReadOnlyCaretVisible="True"
|
IsReadOnlyCaretVisible="True"
|
||||||
Width="200"
|
Width="170"
|
||||||
Text="{Binding ToDoHotkeyStr}"
|
Text="{Binding ToDoHotkeyStr}"
|
||||||
KeyDown="HotKeyDown"
|
KeyDown="HotKeyDown"
|
||||||
KeyUp="HotKeyUp"
|
KeyUp="HotKeyUp"
|
||||||
/>
|
InputMethod.IsInputMethodEnabled="False"
|
||||||
|
/>
|
||||||
|
<CheckBox Content="启用"
|
||||||
|
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>
|
||||||
|
</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"
|
||||||
|
Tag="{x:Static cst:HotKeyType.ColorPicker}"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
IsReadOnly="True"
|
||||||
|
IsReadOnlyCaretVisible="True"
|
||||||
|
Width="170"
|
||||||
|
Text="{Binding ColorPickerHotkeyStr}"
|
||||||
|
KeyDown="HotKeyDown"
|
||||||
|
KeyUp="HotKeyUp"
|
||||||
|
InputMethod.IsInputMethodEnabled="False"
|
||||||
|
/>
|
||||||
|
<CheckBox Content="启用"
|
||||||
|
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>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -1,26 +1,13 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.Control.Windows;
|
|
||||||
using GeekDesk.MyThread;
|
using GeekDesk.MyThread;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Data;
|
|
||||||
using Microsoft.Win32;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using static GeekDesk.Util.GlobalHotKey;
|
using static GeekDesk.Util.GlobalHotKey;
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.Config
|
namespace GeekDesk.Control.UserControls.Config
|
||||||
@@ -48,95 +35,128 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void HotKeyDown(object sender, KeyEventArgs e)
|
private void HotKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
string tag = (sender as TextBox).Tag.ToString();
|
lock (this)
|
||||||
|
|
||||||
Key downKey = e.Key;
|
|
||||||
if (downKey == Key.System)
|
|
||||||
{
|
{
|
||||||
downKey = e.SystemKey;
|
HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
|
||||||
}
|
|
||||||
|
|
||||||
bool main = false;
|
Key downKey = e.Key;
|
||||||
if ("Main".Equals(tag))
|
if (downKey == Key.System)
|
||||||
{
|
|
||||||
main = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
|
|
||||||
{
|
|
||||||
if (hotkeyFinished)
|
|
||||||
{
|
{
|
||||||
if (main)
|
downKey = e.SystemKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CheckIsEnable(hkType)) return;
|
||||||
|
|
||||||
|
|
||||||
|
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
|
||||||
|
{
|
||||||
|
if (hotkeyFinished)
|
||||||
{
|
{
|
||||||
appConfig.Hotkey = 0;
|
switch (hkType)
|
||||||
appConfig.HotkeyStr = "";
|
{
|
||||||
appConfig.HotkeyModifiers = 0;
|
case HotKeyType.Main:
|
||||||
|
appConfig.Hotkey = Key.None;
|
||||||
|
appConfig.HotkeyStr = "";
|
||||||
|
appConfig.HotkeyModifiers = GlobalHotKey.HotkeyModifiers.None;
|
||||||
|
break;
|
||||||
|
case HotKeyType.ToDo:
|
||||||
|
appConfig.ToDoHotkey = Key.None;
|
||||||
|
appConfig.ToDoHotkeyStr = "";
|
||||||
|
appConfig.ToDoHotkeyModifiers = GlobalHotKey.HotkeyModifiers.None;
|
||||||
|
break;
|
||||||
|
case HotKeyType.ColorPicker:
|
||||||
|
appConfig.ColorPickerHotkey = Key.None;
|
||||||
|
appConfig.ColorPickerHotkeyStr = "";
|
||||||
|
appConfig.ColorPickerHotkeyModifiers = GlobalHotKey.HotkeyModifiers.None;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
hotkeyFinished = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//首次按下按键
|
||||||
|
if ((HotKeyType.Main == hkType && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|
||||||
|
|| (HotKeyType.ToDo == hkType && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0))
|
||||||
|
|| (HotKeyType.ColorPicker == hkType && (appConfig.ColorPickerHotkeyStr == null || appConfig.ColorPickerHotkeyStr.Length == 0))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (CheckModifierKeys(downKey))
|
||||||
|
{
|
||||||
|
//辅助键
|
||||||
|
switch (hkType)
|
||||||
|
{
|
||||||
|
case HotKeyType.Main:
|
||||||
|
appConfig.HotkeyStr = GetKeyName(downKey);
|
||||||
|
appConfig.HotkeyModifiers = GetModifierKeys(downKey);
|
||||||
|
break;
|
||||||
|
case HotKeyType.ToDo:
|
||||||
|
appConfig.ToDoHotkeyStr = GetKeyName(downKey);
|
||||||
|
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
|
||||||
|
break;
|
||||||
|
case HotKeyType.ColorPicker:
|
||||||
|
appConfig.ColorPickerHotkeyStr = GetKeyName(downKey);
|
||||||
|
appConfig.ColorPickerHotkeyModifiers = GetModifierKeys(downKey);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
prevKeyTemp = downKey;
|
||||||
|
keysTemp.Add(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appConfig.ToDoHotkey = 0;
|
//非首次按下 需要判断前一个键值是否为辅助键
|
||||||
appConfig.ToDoHotkeyStr = "";
|
if (CheckModifierKeys(prevKeyTemp)
|
||||||
appConfig.ToDoHotkeyModifiers = 0;
|
&& ((downKey >= Key.A && downKey <= Key.Z)
|
||||||
}
|
|| (downKey >= Key.F1 && downKey <= Key.F12)
|
||||||
hotkeyFinished = false;
|
|| (downKey >= Key.D0 && downKey <= Key.D9)
|
||||||
}
|
|| downKey == Key.Oem3
|
||||||
//首次按下按键
|
))
|
||||||
if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|
|
||||||
|| (!main && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0)))
|
|
||||||
{
|
|
||||||
if (CheckModifierKeys(downKey))
|
|
||||||
{
|
|
||||||
//辅助键
|
|
||||||
if (main)
|
|
||||||
{
|
{
|
||||||
appConfig.HotkeyStr = GetKeyName(downKey);
|
KeyUtil.KeyProp keyProp = new KeyUtil.KeyProp();
|
||||||
appConfig.HotkeyModifiers = GetModifierKeys(downKey);
|
KeyUtil.KeyToChar(downKey, ref keyProp, true);
|
||||||
|
string downKeyStr = keyProp.character.ToString();
|
||||||
|
if (keyProp.character == '\x00')
|
||||||
|
{
|
||||||
|
downKeyStr = downKey.ToString();
|
||||||
|
}
|
||||||
|
switch (hkType)
|
||||||
|
{
|
||||||
|
case HotKeyType.Main:
|
||||||
|
appConfig.Hotkey = downKey;
|
||||||
|
appConfig.HotkeyStr += downKeyStr;
|
||||||
|
break;
|
||||||
|
case HotKeyType.ToDo:
|
||||||
|
appConfig.ToDoHotkey = downKey;
|
||||||
|
appConfig.ToDoHotkeyStr += downKeyStr;
|
||||||
|
break;
|
||||||
|
case HotKeyType.ColorPicker:
|
||||||
|
appConfig.ColorPickerHotkey = downKey;
|
||||||
|
appConfig.ColorPickerHotkeyStr += downKeyStr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
prevKeyTemp = downKey;
|
||||||
|
keysTemp.Add(e);
|
||||||
}
|
}
|
||||||
else
|
else if (CheckModifierKeys(downKey))
|
||||||
{
|
{
|
||||||
appConfig.ToDoHotkeyStr = GetKeyName(downKey);
|
switch (hkType)
|
||||||
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
|
{
|
||||||
}
|
case HotKeyType.Main:
|
||||||
prevKeyTemp = downKey;
|
appConfig.HotkeyStr += GetKeyName(downKey);
|
||||||
keysTemp.Add(e);
|
appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
|
||||||
}
|
break;
|
||||||
}
|
case HotKeyType.ToDo:
|
||||||
else
|
appConfig.ToDoHotkeyStr += GetKeyName(downKey);
|
||||||
{
|
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
|
||||||
//非首次按下 需要判断前一个键值是否为辅助键
|
break;
|
||||||
if (CheckModifierKeys(prevKeyTemp)
|
case HotKeyType.ColorPicker:
|
||||||
&& ((downKey >= Key.A && downKey <= Key.Z)
|
appConfig.ColorPickerHotkeyStr += GetKeyName(downKey);
|
||||||
|| (downKey >= Key.F1 && downKey <= Key.F12)
|
appConfig.ColorPickerHotkeyModifiers |= GetModifierKeys(downKey);
|
||||||
|| (downKey >= Key.D0 && downKey <= Key.D9)))
|
break;
|
||||||
{
|
}
|
||||||
if (main)
|
|
||||||
{
|
|
||||||
appConfig.Hotkey = downKey;
|
|
||||||
appConfig.HotkeyStr += downKey.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
appConfig.ToDoHotkey = downKey;
|
|
||||||
appConfig.ToDoHotkeyStr += downKey.ToString();
|
|
||||||
}
|
|
||||||
prevKeyTemp = downKey;
|
|
||||||
keysTemp.Add(e);
|
|
||||||
}
|
|
||||||
else if (CheckModifierKeys(downKey))
|
|
||||||
{
|
|
||||||
if (main)
|
|
||||||
{
|
|
||||||
appConfig.HotkeyStr += GetKeyName(downKey);
|
|
||||||
appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
appConfig.ToDoHotkeyStr += GetKeyName(downKey);
|
|
||||||
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
prevKeyTemp = downKey;
|
prevKeyTemp = downKey;
|
||||||
keysTemp.Add(e);
|
keysTemp.Add(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,15 +211,9 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
//[MethodImpl(MethodImplOptions.Synchronized)]
|
||||||
private void HotKeyUp(object sender, KeyEventArgs e)
|
private void HotKeyUp(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
string tag = (sender as TextBox).Tag.ToString();
|
|
||||||
bool main = false;
|
|
||||||
if ("Main".Equals(tag))
|
|
||||||
{
|
|
||||||
main = true;
|
|
||||||
}
|
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
bool allKeyUp = true;
|
bool allKeyUp = true;
|
||||||
@@ -218,30 +232,55 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
prevKeyTemp = Key.None;
|
prevKeyTemp = Key.None;
|
||||||
hotkeyFinished = true;
|
hotkeyFinished = true;
|
||||||
|
|
||||||
if (main)
|
HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
|
||||||
{
|
if (!CheckIsEnable(hkType)) return;
|
||||||
if (MainWindow.hotKeyId != -1)
|
|
||||||
{
|
|
||||||
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
|
|
||||||
GlobalHotKey.Dispose(MainWindow.hotKeyId);
|
|
||||||
}
|
|
||||||
MainWindow.RegisterHotKey(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (MainWindow.toDoHotKeyId != -1)
|
|
||||||
{
|
|
||||||
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
|
||||||
GlobalHotKey.Dispose(MainWindow.toDoHotKeyId);
|
|
||||||
}
|
|
||||||
MainWindow.RegisterCreateToDoHotKey(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
switch (hkType)
|
||||||
|
{
|
||||||
|
case HotKeyType.Main:
|
||||||
|
if (MainWindow.hotKeyId != -1)
|
||||||
|
{
|
||||||
|
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
|
||||||
|
GlobalHotKey.Dispose(MainWindow.hotKeyId);
|
||||||
|
}
|
||||||
|
MainWindow.RegisterHotKey(false);
|
||||||
|
break;
|
||||||
|
case HotKeyType.ToDo:
|
||||||
|
if (MainWindow.toDoHotKeyId != -1)
|
||||||
|
{
|
||||||
|
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
||||||
|
GlobalHotKey.Dispose(MainWindow.toDoHotKeyId);
|
||||||
|
}
|
||||||
|
MainWindow.RegisterCreateToDoHotKey(false);
|
||||||
|
break;
|
||||||
|
case HotKeyType.ColorPicker:
|
||||||
|
if (MainWindow.colorPickerHotKeyId != -1)
|
||||||
|
{
|
||||||
|
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
||||||
|
GlobalHotKey.Dispose(MainWindow.colorPickerHotKeyId);
|
||||||
|
}
|
||||||
|
MainWindow.RegisterColorPickerHotKey(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CheckIsEnable(HotKeyType hkType)
|
||||||
|
{
|
||||||
|
switch (hkType)
|
||||||
|
{
|
||||||
|
case HotKeyType.Main:
|
||||||
|
return true == appConfig.EnableAppHotKey;
|
||||||
|
case HotKeyType.ToDo:
|
||||||
|
return true == appConfig.EnableTodoHotKey;
|
||||||
|
case HotKeyType.ColorPicker:
|
||||||
|
return true == appConfig.EnableColorPickerHotKey;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 移动窗口
|
/// 移动窗口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -267,15 +306,6 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Animation_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed)
|
|
||||||
{
|
|
||||||
MainWindow.mainWindow.Visibility = Visibility.Visible;
|
|
||||||
// 执行一下动画 防止太过突兀
|
|
||||||
MainWindow.FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -285,15 +315,68 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void MouseMiddle_Changed(object sender, RoutedEventArgs e)
|
private void MouseMiddle_Changed(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (appConfig.MouseMiddleShow)
|
//if (appConfig.MouseMiddleShow)
|
||||||
{
|
//{
|
||||||
MouseHookThread.MiddleHook();
|
// MouseHookThread.MiddleHook();
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
MouseHookThread.Dispose();
|
// MouseHookThread.DisposeMiddle();
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
MouseHookThread.Dispose();
|
||||||
|
MouseHookThread.Hook();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启用热键
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void EnableHotKey_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
HotKeyType hkType = (HotKeyType)(sender as CheckBox).Tag;
|
||||||
|
switch (hkType)
|
||||||
|
{
|
||||||
|
case HotKeyType.Main:
|
||||||
|
if (true == appConfig.EnableAppHotKey)
|
||||||
|
{
|
||||||
|
MainWindow.RegisterHotKey(false);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (MainWindow.hotKeyId != -1)
|
||||||
|
{
|
||||||
|
GlobalHotKey.Dispose(MainWindow.hotKeyId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case HotKeyType.ToDo:
|
||||||
|
if (true == appConfig.EnableTodoHotKey)
|
||||||
|
{
|
||||||
|
MainWindow.RegisterCreateToDoHotKey(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (MainWindow.hotKeyId != -1)
|
||||||
|
{
|
||||||
|
GlobalHotKey.Dispose(MainWindow.toDoHotKeyId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case HotKeyType.ColorPicker:
|
||||||
|
if (true == appConfig.EnableColorPickerHotKey)
|
||||||
|
{
|
||||||
|
MainWindow.RegisterColorPickerHotKey(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (MainWindow.hotKeyId != -1)
|
||||||
|
{
|
||||||
|
GlobalHotKey.Dispose(MainWindow.colorPickerHotKeyId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns: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"
|
mc:Ignorable="d"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
d:DesignHeight="400" d:DesignWidth="500"
|
d:DesignHeight="400" d:DesignWidth="500"
|
||||||
@@ -41,6 +41,20 @@
|
|||||||
</CheckBox.Background>
|
</CheckBox.Background>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
<TextBlock Text="插件" Margin="0,20,0,0"/>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
|
||||||
|
<CheckBox Content="时钟显秒" 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="TopLeft">
|
||||||
|
<CheckBox.Background>
|
||||||
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</CheckBox.Background>
|
||||||
|
</CheckBox>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
<TextBlock Text="排序方式" Margin="0,25,0,0"/>
|
<TextBlock Text="排序方式" Margin="0,25,0,0"/>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||||
@@ -93,6 +107,16 @@
|
|||||||
Foreground="Black"
|
Foreground="Black"
|
||||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<TextBlock Text="其它" Margin="0,25,0,0"/>
|
||||||
|
<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}"
|
||||||
|
Click="BakDataFile"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -1,20 +1,15 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.MyThread;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
using ShowSeconds;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Management;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.Config
|
namespace GeekDesk.Control.UserControls.Config
|
||||||
{
|
{
|
||||||
@@ -118,5 +113,85 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
CountLowSort.Visibility = Visibility.Visible;
|
CountLowSort.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BakDataFile(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CommonCode.BakAppData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowSeconds_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//if (MainWindow.appData.AppConfig.SecondsWindow == true)
|
||||||
|
//{
|
||||||
|
// //StartSecondsWindow();
|
||||||
|
// //SecondsWindow.ShowWindow();
|
||||||
|
// MouseHookThread.Dispose();
|
||||||
|
// MouseHookThread.Hook();
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// MouseHookThread.Dispose();
|
||||||
|
// MouseHookThread.Hook();
|
||||||
|
//}
|
||||||
|
|
||||||
|
MouseHookThread.Dispose();
|
||||||
|
MouseHookThread.Hook();
|
||||||
|
}
|
||||||
|
|
||||||
|
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) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,35 +2,116 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
|
||||||
|
d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
d:DesignHeight="500" d:DesignWidth="450">
|
d:DesignHeight="500" d:DesignWidth="450">
|
||||||
|
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<cvt:BGStyleConvert x:Key="BGStyleConvert"/>
|
||||||
|
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||||
|
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
|
||||||
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid MouseDown="DragMove" Background="Transparent">
|
<Grid Background="Transparent">
|
||||||
<StackPanel Margin="20" >
|
<StackPanel Margin="20" >
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
|
<TextBlock Text="背景风格" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="图片路径:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
<TextBlock Text="{Binding BacImgName}" Width="200"
|
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="图 片"
|
||||||
Margin="0,5,0,0"
|
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=1}"/>
|
||||||
VerticalAlignment="Center"
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
hc:Poptip.HitMode="None"
|
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="纯 色"
|
||||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=2}"/>
|
||||||
hc:Poptip.Content="{Binding BacImgName}"
|
|
||||||
hc:Poptip.Placement="TopLeft"
|
|
||||||
/>
|
|
||||||
<Button Content="修改" Click="BGButton_Click"/>
|
|
||||||
<Button Content="默认" Click="DefaultButton_Click"/>
|
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
<UniformGrid x:Name="ImgBGConf">
|
||||||
<CheckBox x:Name="IconIsAdmin" Content="毛玻璃效果" IsChecked="{Binding BlurEffect}">
|
<hc:TransitioningContentControl TransitionMode="Fade"
|
||||||
|
Height="130">
|
||||||
|
<StackPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="图片背景" VerticalAlignment="Center"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,15,0,0" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="图片路径:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||||
|
<TextBlock Text="{Binding BacImgName}" Width="200"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
hc:Poptip.HitMode="None"
|
||||||
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
|
hc:Poptip.Content="{Binding BacImgName}"
|
||||||
|
hc:Poptip.Placement="TopLeft"
|
||||||
|
/>
|
||||||
|
<Button Content="修改" Click="BGButton_Click"/>
|
||||||
|
<Button Content="默认" 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>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
|
||||||
|
</UniformGrid>
|
||||||
|
|
||||||
|
<UniformGrid x:Name="GradientBGConf">
|
||||||
|
<hc:TransitioningContentControl TransitionMode="Fade"
|
||||||
|
Height="130">
|
||||||
|
<StackPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="纯色背景" VerticalAlignment="Center"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="色彩1:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||||
|
<TextBlock Text="{Binding GradientBGParam.Color1, NotifyOnTargetUpdated=True}"
|
||||||
|
TargetUpdated="Color_TargetUpdated"
|
||||||
|
Width="65"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
/>
|
||||||
|
<Button 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"/>
|
||||||
|
<TextBlock Text="{Binding GradientBGParam.Color2, NotifyOnTargetUpdated=True}"
|
||||||
|
TargetUpdated="Color_TargetUpdated"
|
||||||
|
Width="65"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
/>
|
||||||
|
<Button Content="设置" Tag="Color2" Click="ColorButton_Click"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<Button Content="系统预设"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
hc:Poptip.HitMode="None"
|
||||||
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
|
hc:Poptip.Content="{Binding GradientBGParam.Name, Converter={StaticResource StringAppendConvert}, ConverterParameter=当前设置: \{\}}"
|
||||||
|
hc:Poptip.Placement="Top"
|
||||||
|
Click="SysBG_Click"
|
||||||
|
/>
|
||||||
|
</StackPanel>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
</UniformGrid>
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
<GradientStop Color="#FF9EA3A6"/>
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
@@ -38,8 +119,16 @@
|
|||||||
</CheckBox.Background>
|
</CheckBox.Background>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,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 x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -49,11 +138,20 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<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>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<StackPanel>
|
|
||||||
|
<StackPanel Margin="0,15,0,0">
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="托盘不透明度" VerticalAlignment="Center"/>
|
<TextBlock Text="卡片不透明度" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<hc:PreviewSlider Value="{Binding CardOpacity}"
|
<hc:PreviewSlider Value="{Binding CardOpacity}"
|
||||||
@@ -66,15 +164,17 @@
|
|||||||
</hc:PreviewSlider>
|
</hc:PreviewSlider>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
<TextBlock Text="背景不透明度" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
||||||
Maximum="100"
|
ValueChanged="BGOpacity_ValueChanged"
|
||||||
Width="350"
|
Maximum="100"
|
||||||
>
|
Width="350"
|
||||||
|
>
|
||||||
<hc:PreviewSlider.PreviewContent>
|
<hc:PreviewSlider.PreviewContent>
|
||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
</hc:PreviewSlider.PreviewContent>
|
||||||
@@ -82,7 +182,7 @@
|
|||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<!--<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
@@ -95,7 +195,7 @@
|
|||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
</hc:PreviewSlider.PreviewContent>
|
||||||
</hc:PreviewSlider>
|
</hc:PreviewSlider>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>-->
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
||||||
@@ -131,28 +231,27 @@
|
|||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
|
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
|
||||||
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Width="100"/>
|
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Foreground="{Binding TextColor}" Width="100"/>
|
||||||
<Button Content="选择" Margin="0,-10,0,0" Click="ColorButton_Click"/>
|
<Button Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<StackPanel x:Name="ColorPanel" Panel.ZIndex="1"
|
<!--<StackPanel x:Name="ColorPanel" Panel.ZIndex="1"
|
||||||
Visibility="Collapsed"
|
Visibility="Collapsed"
|
||||||
Height="500"
|
Height="500"
|
||||||
Width="450"
|
Width="450"
|
||||||
VerticalAlignment="Center">
|
VerticalAlignment="Center">
|
||||||
<StackPanel.Background>
|
<StackPanel.Background>
|
||||||
<SolidColorBrush Color="AliceBlue" Opacity="0"/>
|
<SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
|
||||||
</StackPanel.Background>
|
</StackPanel.Background>-->
|
||||||
|
|
||||||
<hc:ColorPicker Name="MyColorPicker"
|
<!--<hc:ColorPicker Name="MyColorPicker"
|
||||||
ToggleButton.Checked="MyColorPicker_Checked"
|
|
||||||
Canceled="MyColorPicker_Canceled"
|
Canceled="MyColorPicker_Canceled"
|
||||||
Confirmed="MyColorPicker_Confirmed"
|
Confirmed="MyColorPicker_Confirmed"
|
||||||
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>
|
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>-->
|
||||||
|
|
||||||
</StackPanel>
|
<!--</StackPanel>-->
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,41 +1,39 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Control.Other;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls.Primitives;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.Config
|
namespace GeekDesk.Control.UserControls.Config
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MotionControl.xaml 的交互逻辑
|
/// MotionControl.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ThemeControl : System.Windows.Controls.UserControl
|
public partial class ThemeControl : System.Windows.Controls.UserControl
|
||||||
{
|
{
|
||||||
|
|
||||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
|
|
||||||
private System.Windows.Controls.Primitives.ToggleButton toggleButton = null;
|
|
||||||
public ThemeControl()
|
public ThemeControl()
|
||||||
{
|
{
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
if (appConfig.BGStyle != BGStyle.GradientBac)
|
||||||
|
{
|
||||||
|
GradientBGConf.Visibility = Visibility.Collapsed;
|
||||||
|
ImgBGConf.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImgBGConf.Visibility = Visibility.Collapsed;
|
||||||
|
GradientBGConf.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -64,7 +62,7 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
LogUtil.WriteErrorLog(ex, "修改背景失败,已重置为默认背景!");
|
LogUtil.WriteErrorLog(ex, "修改背景失败,已重置为默认背景!");
|
||||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||||
}
|
}
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -81,47 +79,16 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
LogUtil.WriteErrorLog(ex, "修改背景失败2,已重置为默认背景!");
|
LogUtil.WriteErrorLog(ex, "修改背景失败2,已重置为默认背景!");
|
||||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||||
}
|
}
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ColorButton_Click(object sender, RoutedEventArgs e)
|
private void ColorButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ColorPanel.Visibility = Visibility.Visible;
|
string tag = (sender as Button).Tag.ToString();
|
||||||
|
new MyColorPickerDialog(tag, "ConfigWindowDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 取消按钮事件
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void MyColorPicker_Canceled(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
MyColorPickerClose(sender);
|
|
||||||
}
|
|
||||||
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
|
||||||
{
|
|
||||||
MyColorPickerClose(sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
|
||||||
{
|
|
||||||
SolidColorBrush scb = MyColorPicker.SelectedBrush;
|
|
||||||
appConfig.TextColor = scb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 移动窗口
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.LeftButton == MouseButtonState.Pressed)
|
|
||||||
{
|
|
||||||
Window.GetWindow(this).DragMove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PreviewSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
private void PreviewSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -131,6 +98,7 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
};
|
};
|
||||||
System.Threading.ThreadStart ts = new System.Threading.ThreadStart(cbu.CheckButtonUp);
|
System.Threading.ThreadStart ts = new System.Threading.ThreadStart(cbu.CheckButtonUp);
|
||||||
System.Threading.Thread t = new System.Threading.Thread(ts);
|
System.Threading.Thread t = new System.Threading.Thread(ts);
|
||||||
|
t.IsBackground = true;
|
||||||
t.Start();
|
t.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,26 +126,47 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MyColorPicker_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
toggleButton = e.OriginalSource as System.Windows.Controls.Primitives.ToggleButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public void BGStyle_Changed(object sender, RoutedEventArgs e)
|
||||||
private void MyColorPickerClose(object sender)
|
|
||||||
{
|
{
|
||||||
if (toggleButton != null && toggleButton.IsChecked == true)
|
BGSettingUtil.BGSetting();
|
||||||
|
if (appConfig.BGStyle != BGStyle.GradientBac)
|
||||||
{
|
{
|
||||||
HandyControl.Controls.ColorPicker cp = sender as HandyControl.Controls.ColorPicker;
|
GradientBGConf.Visibility = Visibility.Collapsed;
|
||||||
const BindingFlags InstanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
ImgBGConf.Visibility = Visibility.Visible;
|
||||||
Type type = cp.GetType();
|
}
|
||||||
toggleButton.IsChecked = false;
|
else
|
||||||
MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags);
|
{
|
||||||
mi.Invoke(cp, new object[] { null, null });
|
ImgBGConf.Visibility = Visibility.Collapsed;
|
||||||
|
GradientBGConf.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
ColorPanel.Visibility = Visibility.Collapsed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BGOpacity_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||||
|
{
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Color_TargetUpdated(object sender, DataTransferEventArgs e)
|
||||||
|
{
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SysBG_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
GradientBGDialog gbg = new GradientBGDialog();
|
||||||
|
gbg.dialog = HandyControl.Controls.Dialog.Show(gbg, "ConfigWindowDialog");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Animation_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed)
|
||||||
|
{
|
||||||
|
appConfig.IsShow = true;
|
||||||
|
}
|
||||||
|
appConfig.IsShow = null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,4 @@
|
|||||||
using GeekDesk.ViewModel;
|
using System.Windows.Controls;
|
||||||
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.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;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.IconFont
|
namespace GeekDesk.Control.UserControls.IconFont
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,9 +6,11 @@
|
|||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
|
xmlns:cst="clr-namespace:GeekDesk.Constant"
|
||||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
>
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
|
|
||||||
<!--左侧栏样式动画-->
|
<!--左侧栏样式动画-->
|
||||||
@@ -17,11 +19,18 @@
|
|||||||
<Setter Property="Margin" Value="0,0,0,1"/>
|
<Setter Property="Margin" Value="0,0,0,1"/>
|
||||||
<Setter Property="Background">
|
<Setter Property="Background">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<SolidColorBrush Opacity="0"/>
|
<SolidColorBrush Color="Black" Opacity="0.01"/>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
<Setter Property="AllowDrop" Value="True"/>
|
||||||
|
<EventSetter Event="Drop" Handler="Menu_Drop"/>
|
||||||
|
<EventSetter Event="PreviewDragEnter" Handler="Menu_PreviewDragEnter"/>
|
||||||
|
<EventSetter Event="PreviewDragLeave" Handler="Menu_PreviewDragLeave"/>
|
||||||
|
<EventSetter Event="MouseLeave" Handler="Menu_MouseLeave"/>
|
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
<EventSetter Event="MouseEnter" Handler="Menu_MouseEnter"/>
|
<EventSetter Event="MouseEnter" Handler="Menu_MouseEnter"/>
|
||||||
|
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_MouseDown"/>
|
||||||
|
<EventSetter Event="PreviewMouseRightButtonDown" Handler="ListBoxItem_PreviewMouseRightButtonDown"/>
|
||||||
<!--<EventSetter Event="Unselected" Handler="Lbi_Unselected"/>-->
|
<!--<EventSetter Event="Unselected" Handler="Lbi_Unselected"/>-->
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<MultiTrigger>
|
<MultiTrigger>
|
||||||
@@ -44,7 +53,11 @@
|
|||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</MultiTrigger.ExitActions>
|
</MultiTrigger.ExitActions>
|
||||||
<MultiTrigger.Setters>
|
<MultiTrigger.Setters>
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background">
|
||||||
|
<Setter.Value>
|
||||||
|
<SolidColorBrush Color="Black" Opacity="0.01"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
</MultiTrigger.Setters>
|
</MultiTrigger.Setters>
|
||||||
</MultiTrigger>
|
</MultiTrigger>
|
||||||
@@ -65,109 +78,149 @@
|
|||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
</Trigger>-->
|
</Trigger>-->
|
||||||
<Trigger Property="IsMouseOver" Value="False">
|
<Trigger Property="IsMouseOver" Value="False">
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="#00FFFFFF"/>
|
||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
|
|
||||||
|
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</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>
|
||||||
|
|
||||||
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
|
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<!--左侧栏-->
|
<Grid Background="Transparent">
|
||||||
<hc:Card x:Name="MyCard"
|
<Popup Name="MyPoptip" FlowDirection="LeftToRight"
|
||||||
BorderThickness="1"
|
PopupAnimation="None" Placement="Mouse" IsOpen="False"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
AllowsTransparency="True"
|
||||||
Margin="5,0,0,5"
|
>
|
||||||
MouseDown="MyCard_MouseDown"
|
<Grid Background="Transparent">
|
||||||
>
|
<Border Style="{StaticResource MyPoptipStyle}">
|
||||||
<hc:Card.Background>
|
<TextBlock Name="MyPoptipContent" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" Text="Test" FontSize="14"/>
|
||||||
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Popup>
|
||||||
|
|
||||||
</SolidColorBrush>
|
<!--左侧栏-->
|
||||||
</hc:Card.Background>
|
<hc:Card x:Name="MyCard"
|
||||||
<hc:Card.BorderBrush>
|
BorderThickness="1"
|
||||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
</hc:Card.BorderBrush>
|
Margin="5,0,0,5"
|
||||||
<hc:Card.ContextMenu>
|
MouseDown="MyCard_MouseDown"
|
||||||
<ContextMenu Width="200">
|
PreviewMouseRightButtonDown="MyCard_PreviewMouseRightButtonDown"
|
||||||
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
>
|
||||||
</ContextMenu>
|
<hc:Card.Background>
|
||||||
</hc:Card.ContextMenu>
|
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
||||||
<WrapPanel Orientation="Horizontal">
|
|
||||||
<ListBox x:Name="MenuListBox"
|
|
||||||
Padding="2,3,0,2"
|
|
||||||
ItemsSource="{Binding MenuList}"
|
|
||||||
Tag="{Binding AppConfig.MenuCardWidth}"
|
|
||||||
BorderThickness="0" Foreground="{x:Null}"
|
|
||||||
SelectedIndex="{Binding AppConfig.SelectedMenuIndex}"
|
|
||||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
|
||||||
SelectionChanged="Menu_SelectionChanged"
|
|
||||||
>
|
|
||||||
<ListBox.Resources>
|
|
||||||
<ContextMenu x:Key="MenuDialog" Width="200">
|
|
||||||
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
|
||||||
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
|
|
||||||
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
|
|
||||||
<MenuItem Header="删除" Click="DeleteMenu" Tag="{Binding}"/>
|
|
||||||
</ContextMenu>
|
|
||||||
</ListBox.Resources>
|
|
||||||
|
|
||||||
<ListBox.ItemContainerStyle>
|
</SolidColorBrush>
|
||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MenuStyle}">
|
</hc:Card.Background>
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource MenuDialog}"/>
|
<hc:Card.BorderBrush>
|
||||||
</Style>
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||||
</ListBox.ItemContainerStyle>
|
</hc:Card.BorderBrush>
|
||||||
<ListBox.Background>
|
<hc:Card.ContextMenu>
|
||||||
<SolidColorBrush Color="AliceBlue" Opacity="0"/>
|
<ContextMenu Width="200">
|
||||||
</ListBox.Background>
|
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
||||||
|
<MenuItem x:Name="AlterPW1" Header="修改密码" Click="AlterPassword"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</hc:Card.ContextMenu>
|
||||||
|
|
||||||
<ListBox.ItemsPanel>
|
<WrapPanel Orientation="Horizontal">
|
||||||
<ItemsPanelTemplate>
|
<ListBox x:Name="MenuListBox"
|
||||||
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="33" ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=10}" HorizontalAlignment="Center" VerticalAlignment="Top" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
Padding="2,3,0,2"
|
||||||
</ItemsPanelTemplate>
|
ItemsSource="{Binding MenuList}"
|
||||||
</ListBox.ItemsPanel>
|
Tag="{Binding AppConfig.MenuCardWidth}"
|
||||||
|
BorderThickness="0" Foreground="{x:Null}"
|
||||||
|
SelectedIndex="{Binding AppConfig.SelectedMenuIndex}"
|
||||||
|
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
|
SelectionChanged="Menu_SelectionChanged"
|
||||||
|
PreviewMouseWheel="Menu_MouseWheel"
|
||||||
|
PreviewMouseRightButtonDown="MyCard_PreviewMouseRightButtonDown"
|
||||||
|
>
|
||||||
|
<ListBox.Resources>
|
||||||
|
<ContextMenu x:Key="MenuDialog" Width="200">
|
||||||
|
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
||||||
|
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
|
||||||
|
<MenuItem Header="加密此列表" Click="EncryptMenu" Tag="{Binding}"/>
|
||||||
|
<MenuItem x:Name="AlterPW2" Header="修改密码" Click="AlterPassword"/>
|
||||||
|
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
|
||||||
|
<MenuItem Header="删除" Click="DeleteMenu" Tag="{Binding}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.Resources>
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemContainerStyle>
|
||||||
<DataTemplate>
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MenuStyle}">
|
||||||
<StackPanel Tag="{Binding}" MouseDown="ListBoxItem_MouseDown">
|
<Setter Property="ContextMenu" Value="{StaticResource MenuDialog}"/>
|
||||||
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
</Style>
|
||||||
HorizontalAlignment="Left"
|
</ListBox.ItemContainerStyle>
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
<ListBox.Background>
|
||||||
FontSize="16"
|
<SolidColorBrush Color="AliceBlue" Opacity="0"/>
|
||||||
Height="28"
|
</ListBox.Background>
|
||||||
VerticalAlignment="Center"
|
|
||||||
TextAlignment="Left"
|
<ListBox.ItemsPanel>
|
||||||
LostFocus="LostFocusOrEnterDown"
|
<ItemsPanelTemplate>
|
||||||
KeyDown="LostFocusOrEnterDown"
|
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="33" ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=10}" HorizontalAlignment="Center" VerticalAlignment="Top" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
||||||
Tag="{Binding}"
|
</ItemsPanelTemplate>
|
||||||
Padding="2"
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel Tag="{Binding}">
|
||||||
|
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
||||||
|
FontSize="16"
|
||||||
|
Height="28"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
TextAlignment="Left"
|
||||||
|
LostFocus="LostFocusOrEnterDown"
|
||||||
|
KeyDown="LostFocusOrEnterDown"
|
||||||
|
Tag="{Binding}"
|
||||||
|
Padding="2"
|
||||||
|
BorderThickness="0"
|
||||||
|
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
||||||
|
Visibility="{Binding MenuEdit}"/>
|
||||||
|
<StackPanel Orientation="Horizontal"
|
||||||
|
IsVisibleChanged="MenuWhenVisibilityChanged"
|
||||||
|
Visibility="{Binding NotMenuEdit}">
|
||||||
|
<Button Background="Transparent"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
hc:IconElement.Geometry="{Binding MenuGeometry}"
|
||||||
Visibility="{Binding MenuEdit}"/>
|
hc:IconElement.Height="18"
|
||||||
<StackPanel Orientation="Horizontal"
|
hc:IconElement.Width="18"
|
||||||
IsVisibleChanged="MenuWhenVisibilityChanged"
|
IsEnabled="False"
|
||||||
Visibility="{Binding NotMenuEdit}">
|
Opacity="1"
|
||||||
<Button Background="Transparent"
|
Foreground="{Binding GeometryColor}"
|
||||||
BorderThickness="0"
|
/>
|
||||||
hc:IconElement.Geometry="{Binding MenuGeometry}"
|
<TextBlock Text="{Binding MenuName}"
|
||||||
hc:IconElement.Height="18"
|
HorizontalAlignment="Center"
|
||||||
hc:IconElement.Width="18"
|
TextAlignment="Center"
|
||||||
IsEnabled="False"
|
VerticalAlignment="Center"
|
||||||
Opacity="1"
|
|
||||||
Foreground="{Binding GeometryColor}"
|
|
||||||
/>
|
/>
|
||||||
<TextBlock Text="{Binding MenuName}"
|
</StackPanel>
|
||||||
HorizontalAlignment="Center"
|
|
||||||
TextAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</DataTemplate>
|
||||||
</DataTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox>
|
||||||
</ListBox>
|
</WrapPanel>
|
||||||
</WrapPanel>
|
</hc:Card>
|
||||||
</hc:Card>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using DraggAnimatedPanelExample;
|
using DraggAnimatedPanelExample;
|
||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Control.Other;
|
||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Control.Windows;
|
||||||
using GeekDesk.MyThread;
|
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
@@ -10,10 +10,8 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Threading;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.PannelCard
|
namespace GeekDesk.Control.UserControls.PannelCard
|
||||||
{
|
{
|
||||||
@@ -27,13 +25,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
|
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
|
||||||
|
|
||||||
|
|
||||||
//是否正在修改菜单
|
|
||||||
private static bool IS_EDIT = false;
|
|
||||||
|
|
||||||
public LeftCardControl()
|
public LeftCardControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
this.Loaded += (s, e) =>
|
this.Loaded += (s, e) =>
|
||||||
{
|
{
|
||||||
@@ -44,7 +39,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
|
|
||||||
|
|
||||||
private void SetMenuListBoxItemEvent()
|
private void SetMenuListBoxItemEvent()
|
||||||
{
|
{
|
||||||
int size = MenuListBox.Items.Count;
|
int size = MenuListBox.Items.Count;
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
@@ -87,7 +82,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateCommand<int[]> _swap;
|
DelegateCommand<int[]> _swap;
|
||||||
|
|
||||||
public DelegateCommand<int[]> SwapCommand
|
public DelegateCommand<int[]> SwapCommand
|
||||||
{
|
{
|
||||||
@@ -166,13 +161,17 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
|
|
||||||
private void Lbi_Selected(object sender, RoutedEventArgs e)
|
private void Lbi_Selected(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ListBoxItem lbi = sender as ListBoxItem;
|
try
|
||||||
|
{
|
||||||
|
ListBoxItem lbi = sender as ListBoxItem;
|
||||||
|
|
||||||
SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
|
SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
|
||||||
|
|
||||||
lbi.MouseLeave -= Lbi_MouseLeave;
|
lbi.MouseLeave -= Lbi_MouseLeave;
|
||||||
lbi.Background = bac;
|
lbi.Background = bac;
|
||||||
lbi.Foreground = fontColor;
|
lbi.Foreground = fontColor;
|
||||||
|
} catch { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Lbi_MouseLeave(object sender, MouseEventArgs e)
|
private void Lbi_MouseLeave(object sender, MouseEventArgs e)
|
||||||
@@ -208,9 +207,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void RenameMenu(object sender, RoutedEventArgs e)
|
private void RenameMenu(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
RunTimeStatus.IS_MENU_EDIT = true;
|
||||||
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
||||||
menuInfo.MenuEdit = (int)Visibility.Visible;
|
menuInfo.MenuEdit = (int)Visibility.Visible;
|
||||||
IS_EDIT = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -278,7 +277,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
menuInfo.MenuName = text;
|
menuInfo.MenuName = text;
|
||||||
menuInfo.MenuEdit = Visibility.Collapsed;
|
menuInfo.MenuEdit = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
IS_EDIT = false;
|
RunTimeStatus.IS_MENU_EDIT = false;
|
||||||
|
//为了解决无法修改菜单的问题
|
||||||
|
MainWindow.mainWindow.SearchBox.Focus();
|
||||||
MenuListBox.SelectedIndex = menuSelectIndexTemp;
|
MenuListBox.SelectedIndex = menuSelectIndexTemp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,6 +313,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
|
|
||||||
private void Menu_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void Menu_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (RunTimeStatus.IS_MENU_EDIT) return;
|
||||||
|
|
||||||
|
if (appData.AppConfig.ItemSpradeAnimation)
|
||||||
|
{
|
||||||
|
//是否启用列表展开动画
|
||||||
|
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
//设置对应菜单的图标列表
|
//设置对应菜单的图标列表
|
||||||
if (MenuListBox.SelectedIndex == -1)
|
if (MenuListBox.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
@@ -319,8 +328,21 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
|
if (appData.MenuList[MenuListBox.SelectedIndex].IsEncrypt)
|
||||||
|
{
|
||||||
|
appData.AppConfig.SelectedMenuIcons = null;
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入密码";
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Collapsed;
|
||||||
|
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Visible;
|
||||||
|
//App.DoEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -331,9 +353,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void Menu_MouseEnter(object sender, MouseEventArgs e)
|
private void Menu_MouseEnter(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.HoverMenu && !IS_EDIT)
|
if (appData.AppConfig.HoverMenu && !RunTimeStatus.IS_MENU_EDIT)
|
||||||
{
|
{
|
||||||
new Thread(() =>
|
Thread t = new Thread(() =>
|
||||||
{
|
{
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
this.Dispatcher.Invoke(() =>
|
this.Dispatcher.Invoke(() =>
|
||||||
@@ -345,7 +367,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
MenuListBox.SelectedIndex = index;
|
MenuListBox.SelectedIndex = index;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).Start();
|
});
|
||||||
|
t.IsBackground = true;
|
||||||
|
t.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,11 +380,35 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ListBoxItem_MouseDown(object sender, MouseButtonEventArgs e)
|
private void ListBoxItem_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (RunTimeStatus.SEARCH_BOX_SHOW) {
|
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||||
|
{
|
||||||
MainWindow.mainWindow.HidedSearchBox();
|
MainWindow.mainWindow.HidedSearchBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListBoxItem lbi = sender as ListBoxItem;
|
||||||
|
MenuInfo mi = lbi.DataContext as MenuInfo;
|
||||||
|
int index = MenuListBox.Items.IndexOf(mi);
|
||||||
|
MenuListBox.SelectedIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 点击菜单后 隐藏搜索框
|
||||||
|
///// </summary>
|
||||||
|
///// <param name="sender"></param>
|
||||||
|
///// <param name="e"></param>
|
||||||
|
//private void ListBoxItemPanel_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
//{
|
||||||
|
// if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||||
|
// {
|
||||||
|
// MainWindow.mainWindow.HidedSearchBox();
|
||||||
|
// }
|
||||||
|
// MenuInfo mi = (sender as StackPanel).Tag as MenuInfo;
|
||||||
|
// int index = MenuListBox.Items.IndexOf(mi);
|
||||||
|
// MenuListBox.SelectedIndex = index;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 隐藏搜索框
|
/// 隐藏搜索框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -373,5 +421,177 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
MainWindow.mainWindow.HidedSearchBox();
|
MainWindow.mainWindow.HidedSearchBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
MenuListBox.SelectedIndex = index;
|
||||||
|
}
|
||||||
|
} else if (e.Delta > 0)
|
||||||
|
{
|
||||||
|
if (ScrollUtil.IsTopScrollView(scrollViewer))
|
||||||
|
{
|
||||||
|
int index = MenuListBox.SelectedIndex;
|
||||||
|
if (index > 0)
|
||||||
|
{
|
||||||
|
index--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = MenuListBox.Items.Count - 1;
|
||||||
|
}
|
||||||
|
MenuListBox.SelectedIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//滚动到选中项
|
||||||
|
MenuListBox.ScrollIntoView(MenuListBox.SelectedItem);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Menu_PreviewDragLeave(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
MyPoptip.IsOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Menu_PreviewDragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
MenuInfo mi = (sender as ListBoxItem).DataContext as MenuInfo;
|
||||||
|
MyPoptipContent.Text = "移动至:" + mi.MenuName;
|
||||||
|
MyPoptip.VerticalOffset = 30;
|
||||||
|
MyPoptip.IsOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Menu_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
MyPoptip.IsOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
appData.MenuList[MenuListBox.SelectedIndex].IconList.Remove(iconInfo);
|
||||||
|
appData.MenuList[MenuListBox.Items.IndexOf(mi)].IconList.Add(iconInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EncryptMenu(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
||||||
|
if (menuInfo.IsEncrypt)
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.menuInfo = menuInfo;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入密码";
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.CANCEL;
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||||
|
//单独设置焦点
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.SetFocus();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.menuInfo = menuInfo;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "设置新密码";
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.CREATE;
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menuInfo.IsEncrypt = true;
|
||||||
|
HandyControl.Controls.Growl.Success(menuInfo.MenuName + " 已加密!", "MainWindowGrowl");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AlterPassword(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入旧密码";
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.ALTER;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||||
|
//单独设置焦点
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 右键点击进行处理
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void MyCard_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
RunTimeStatus.SHOW_RIGHT_BTN_MENU = true;
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
Thread.Sleep(50);
|
||||||
|
RunTimeStatus.SHOW_RIGHT_BTN_MENU = false;
|
||||||
|
}).Start();
|
||||||
|
|
||||||
|
//在没有设置密码的情况下不弹出修改密码菜单
|
||||||
|
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
|
||||||
|
{
|
||||||
|
AlterPW1.Visibility = Visibility.Collapsed;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
AlterPW1.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ListBoxItem_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ListBoxItem lbi = sender as ListBoxItem;
|
||||||
|
MenuInfo info = lbi.DataContext as MenuInfo;
|
||||||
|
|
||||||
|
ItemCollection ics = lbi.ContextMenu.Items;
|
||||||
|
|
||||||
|
foreach (object obj in ics)
|
||||||
|
{
|
||||||
|
MenuItem mi = (MenuItem)obj;
|
||||||
|
if (mi.Header.Equals("修改密码"))
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
|
||||||
|
{
|
||||||
|
mi.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mi.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mi.Header.Equals("加密此列表") || mi.Header.Equals("取消加密此列表"))
|
||||||
|
{
|
||||||
|
if (info.IsEncrypt)
|
||||||
|
{
|
||||||
|
mi.Header = "取消加密此列表";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
mi.Header = "加密此列表";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
|
xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
|
xmlns:cst="clr-namespace:GeekDesk.Constant"
|
||||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||||
|
xmlns:ot="clr-namespace:GeekDesk.Control.Other"
|
||||||
|
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
>
|
>
|
||||||
@@ -19,15 +23,6 @@
|
|||||||
</Trigger>
|
</Trigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>-->
|
</Style>-->
|
||||||
|
|
||||||
<Storyboard x:Key="Custom1Transition" x:Shared="False">
|
|
||||||
<DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
|
|
||||||
<DoubleAnimation.EasingFunction>
|
|
||||||
<ElasticEase Oscillations="1"/>
|
|
||||||
</DoubleAnimation.EasingFunction>
|
|
||||||
</DoubleAnimation>
|
|
||||||
</Storyboard>
|
|
||||||
|
|
||||||
<Style x:Key="ImageStyle" TargetType="Image">
|
<Style x:Key="ImageStyle" TargetType="Image">
|
||||||
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
||||||
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||||
@@ -46,19 +41,96 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<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="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>
|
||||||
|
<ElasticEase Oscillations="1"/>
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
|
</Storyboard>
|
||||||
|
<Storyboard x:Key="Custom2Transition2" x:Shared="False">
|
||||||
|
<DoubleAnimation From="10" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
|
||||||
|
<DoubleAnimation.EasingFunction>
|
||||||
|
<ElasticEase Oscillations="1"/>
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
|
</Storyboard>
|
||||||
|
|
||||||
|
<Storyboard x:Key="Custom3Transition3" x:Shared="False">
|
||||||
|
<DoubleAnimation From=".8" To="1" Duration="0:0:0.4">
|
||||||
|
<DoubleAnimation.EasingFunction>
|
||||||
|
<ElasticEase Oscillations="1"/>
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
|
</Storyboard>
|
||||||
|
|
||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
<cvt:SearchResWidth x:Key="SearchResWidth"/>
|
<cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
|
||||||
<temp:SearchIconList x:Key="SearchIconList"/>
|
<temp:SearchIconList x:Key="SearchIconList"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<!--右侧栏-->
|
<!--右侧栏-->
|
||||||
<Grid>
|
<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"
|
<hc:Card AllowDrop="True"
|
||||||
x:Name="WrapCard"
|
x:Name="WrapCard"
|
||||||
Visibility="Visible"
|
Visibility="Visible"
|
||||||
Drop="Wrap_Drop"
|
Drop="Wrap_Drop"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
Margin="5,0,5,5" Grid.ColumnSpan="2">
|
Margin="5,0,5,5" Grid.ColumnSpan="2"
|
||||||
|
PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown"
|
||||||
|
hc:Dialog.Token="RightWrapCardDialog"
|
||||||
|
MouseWheel="IconListBox_MouseWheel"
|
||||||
|
>
|
||||||
<hc:Card.Background>
|
<hc:Card.Background>
|
||||||
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||||
</hc:Card.Background>
|
</hc:Card.Background>
|
||||||
@@ -69,89 +141,127 @@
|
|||||||
<ContextMenu Width="200">
|
<ContextMenu Width="200">
|
||||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||||
|
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</hc:Card.ContextMenu>
|
</hc:Card.ContextMenu>
|
||||||
<Grid>
|
<hc:DialogContainer>
|
||||||
<StackPanel Panel.ZIndex="1" Margin="0,-10,-300,0" hc:Growl.GrowlParent="True" hc:Growl.Token="MainWindowGrowl"/>
|
<Grid>
|
||||||
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
<ot:PasswordDialog xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility, Duration=50, Delay=0}"
|
||||||
VirtualizingPanel.IsVirtualizing="True"
|
x:Name="PDDialog"
|
||||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
Panel.ZIndex="99"
|
||||||
>
|
IsVisibleChanged="PDDialog_IsVisibleChanged"
|
||||||
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
Margin="0,-100,0,0"/>
|
||||||
BorderThickness="0"
|
<StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
|
||||||
Padding="0,10,0,0"
|
|
||||||
>
|
<WrapPanel Orientation="Horizontal"
|
||||||
<ListBox.Background>
|
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
<SolidColorBrush Opacity="0"/>
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
</ListBox.Background>
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
<ListBox.ItemsPanel>
|
>
|
||||||
<ItemsPanelTemplate>
|
<UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
|
||||||
<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
|
<!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
|
||||||
ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
<ListBox x:Name="IconListBox"
|
||||||
ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
||||||
HorizontalAlignment="Center"
|
BorderThickness="0"
|
||||||
SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
Padding="0,10,0,0"
|
||||||
</ItemsPanelTemplate>
|
ScrollViewer.CanContentScroll ="False"
|
||||||
</ListBox.ItemsPanel>
|
>
|
||||||
|
<ListBox.Template>
|
||||||
|
<ControlTemplate TargetType="ListBox">
|
||||||
|
<hc:ScrollViewer x:Name="WrapScroll"
|
||||||
|
Orientation="Vertical"
|
||||||
|
HorizontalScrollBarVisibility="Hidden"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
IsInertiaEnabled="True"
|
||||||
|
CanContentScroll="True"
|
||||||
|
PreviewMouseWheel="IconListBox_MouseWheel"
|
||||||
|
>
|
||||||
|
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
|
||||||
|
<ItemsPresenter/>
|
||||||
|
|
||||||
<ListBox.Resources>
|
</Border>
|
||||||
<ContextMenu x:Key="IconDialog" Width="200">
|
</hc:ScrollViewer>
|
||||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
</ControlTemplate>
|
||||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
</ListBox.Template>
|
||||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
<ListBox.Background>
|
||||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
<SolidColorBrush Color="#00FFFFFF" />
|
||||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
</ListBox.Background>
|
||||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
<ListBox.ItemsPanel>
|
||||||
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
|
<ItemsPanelTemplate>
|
||||||
</ContextMenu>
|
<!--<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
|
||||||
</ListBox.Resources>
|
ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||||
|
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}}}"/>-->
|
||||||
|
|
||||||
<ListBox.ItemContainerStyle>
|
<WrapPanel Background="#00FFFFFF"
|
||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
Converter={StaticResource GetWidthByWWConvert},
|
||||||
</Style>
|
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
|
||||||
</ListBox.ItemContainerStyle>
|
/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.Resources>
|
||||||
<DataTemplate>
|
<ContextMenu x:Key="IconDialog" Width="200">
|
||||||
<hc:SimpleStackPanel Tag="{Binding}"
|
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||||
HorizontalAlignment="Center"
|
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||||
hc:Poptip.Content="{Binding Content}"
|
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||||
hc:Poptip.Placement="BottomLeft"
|
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||||
Background="#00FFFFFF"
|
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
|
||||||
MouseEnter="StackPanel_MouseEnter"
|
</ContextMenu>
|
||||||
MouseLeave="StackPanel_MouseLeave"
|
</ListBox.Resources>
|
||||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
|
||||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
|
||||||
>
|
|
||||||
<!--<StackPanel Background="#00FFFFFF"
|
|
||||||
MouseEnter="CursorPanel_MouseEnter"
|
|
||||||
MouseLeave="CursorPanel_MouseLeave"
|
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
|
|
||||||
<Image Style="{StaticResource ImageStyle}"
|
|
||||||
RenderOptions.BitmapScalingMode="HighQuality"/>
|
|
||||||
<TextBlock MaxWidth="80"
|
|
||||||
Margin="0,5,0,0"
|
|
||||||
MaxHeight="40"
|
|
||||||
FontSize="13"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
TextTrimming="WordEllipsis"
|
|
||||||
TextAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
|
||||||
Text="{Binding Name}"/>
|
|
||||||
<!--</StackPanel>-->
|
|
||||||
|
|
||||||
</hc:SimpleStackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListBox.ItemTemplate>
|
|
||||||
</ListBox>
|
|
||||||
|
|
||||||
</WrapPanel>
|
<ListBox.ItemContainerStyle>
|
||||||
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
||||||
|
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||||
|
</Style>
|
||||||
|
</ListBox.ItemContainerStyle>
|
||||||
|
|
||||||
</Grid>
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
|
||||||
|
<hc:SimpleStackPanel Tag="{Binding}"
|
||||||
|
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"
|
||||||
|
Background="#00FFFFFF"
|
||||||
|
MouseEnter="MenuIcon_MouseEnter"
|
||||||
|
MouseLeave="MenuIcon_MouseLeave"
|
||||||
|
MouseMove="MenuIcon_MouseMove"
|
||||||
|
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||||
|
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||||
|
>
|
||||||
|
<!--<StackPanel Background="#00FFFFFF"
|
||||||
|
MouseEnter="CursorPanel_MouseEnter"
|
||||||
|
MouseLeave="CursorPanel_MouseLeave"
|
||||||
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
|
||||||
|
<Image Style="{StaticResource ImageStyle}"
|
||||||
|
RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
|
<TextBlock MaxWidth="80"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
MaxHeight="40"
|
||||||
|
FontSize="13"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
TextTrimming="WordEllipsis"
|
||||||
|
TextAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||||
|
Text="{Binding Name}"/>
|
||||||
|
<!--</StackPanel>-->
|
||||||
|
|
||||||
|
</hc:SimpleStackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
<!--</hc:TransitioningContentControl>-->
|
||||||
|
</UniformGrid>
|
||||||
|
</WrapPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</hc:DialogContainer>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
|
|
||||||
<hc:Card x:Name="VerticalCard"
|
<hc:Card x:Name="VerticalCard"
|
||||||
@@ -170,78 +280,119 @@
|
|||||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||||
</hc:Card.BorderBrush>
|
</hc:Card.BorderBrush>
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Panel.ZIndex="1" Margin="0,-10,-300,0" hc:Growl.GrowlParent="True" hc:Growl.Token="MainWindowGrowl"/>
|
|
||||||
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
VirtualizingPanel.IsVirtualizing="True"
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
>
|
>
|
||||||
<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom1Transition}">
|
<UniformGrid x:Name="VerticalUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, OffsetY= -10, Event=Visibility}">
|
||||||
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
|
||||||
BorderThickness="0"
|
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
||||||
Padding="0,10,0,0"
|
BorderThickness="0"
|
||||||
>
|
Padding="0,10,0,0"
|
||||||
|
x:Name="SearchListBox"
|
||||||
|
SelectionChanged="SearchListBox_SelectionChanged"
|
||||||
|
>
|
||||||
|
<ListBox.Template>
|
||||||
|
<ControlTemplate TargetType="ListBox">
|
||||||
|
<hc:ScrollViewer Orientation="Vertical"
|
||||||
|
HorizontalScrollBarVisibility="Hidden"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
IsInertiaEnabled="True"
|
||||||
|
CanContentScroll="True"
|
||||||
|
PreviewMouseWheel="VerticalIconList_PreviewMouseWheel"
|
||||||
|
>
|
||||||
|
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
|
||||||
|
<ItemsPresenter/>
|
||||||
|
</Border>
|
||||||
|
</hc:ScrollViewer>
|
||||||
|
</ControlTemplate>
|
||||||
|
</ListBox.Template>
|
||||||
|
|
||||||
<ListBox.Background>
|
<ListBox.Background>
|
||||||
<SolidColorBrush Opacity="0"/>
|
<SolidColorBrush Opacity="0"/>
|
||||||
</ListBox.Background>
|
</ListBox.Background>
|
||||||
|
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<ContextMenu x:Key="IconDialog" Width="200">
|
<ContextMenu x:Key="IconDialog" Width="200">
|
||||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</ListBox.Resources>
|
</ListBox.Resources>
|
||||||
|
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource SearchListBoxItemStyle}">
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
|
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<StackPanel Background="#00FFFFFF"
|
<StackPanel Background="#00FFFFFF"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=1}"
|
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>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<WrapPanel Tag="{Binding}"
|
<Border CornerRadius="8">
|
||||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
|
<Border.Style>
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=2}"
|
<Style TargetType="Border">
|
||||||
HorizontalAlignment="Left"
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
hc:Poptip.HitMode="None"
|
<Style.Triggers>
|
||||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem }}}"
|
||||||
hc:Poptip.Content="{Binding Content}"
|
Value="True">
|
||||||
hc:Poptip.Placement="BottomLeft"
|
<Setter Property="Background">
|
||||||
Background="#00FFFFFF"
|
<Setter.Value>
|
||||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
<SolidColorBrush Color="White" Opacity="0.68"/>
|
||||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
</Setter.Value>
|
||||||
Margin="25,20,0,0"
|
</Setter>
|
||||||
>
|
</DataTrigger>
|
||||||
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
</Style.Triggers>
|
||||||
<TextBlock
|
</Style>
|
||||||
Margin="10,5,0,0"
|
</Border.Style>
|
||||||
MaxHeight="40"
|
<WrapPanel Tag="{Binding}"
|
||||||
FontSize="13"
|
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
|
||||||
TextWrapping="Wrap"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
|
||||||
TextTrimming="WordEllipsis"
|
Converter={StaticResource GetWidthByWWConvert},
|
||||||
TextAlignment="Left"
|
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF}}"
|
||||||
VerticalAlignment="Center"
|
HorizontalAlignment="Left"
|
||||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding Name}"/>
|
hc:Poptip.HitMode="None"
|
||||||
</WrapPanel>
|
hc:Poptip.Placement="BottomLeft"
|
||||||
</DataTemplate>
|
Background="#00FFFFFF"
|
||||||
</ListBox.ItemTemplate>
|
MouseEnter="SearchIcon_MouseEnter"
|
||||||
</ListBox>
|
MouseLeave="SearchIcon_MouseLeave"
|
||||||
</hc:TransitioningContentControl>
|
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||||
|
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||||
|
MouseMove="SearchIcon_MouseMove"
|
||||||
|
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>
|
</WrapPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -9,13 +9,14 @@ using System;
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.PannelCard
|
namespace GeekDesk.Control.UserControls.PannelCard
|
||||||
{
|
{
|
||||||
@@ -26,68 +27,76 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
private AppData appData = MainWindow.appData;
|
private AppData appData = MainWindow.appData;
|
||||||
|
|
||||||
private volatile static bool DROP_ICON = false;
|
ListBoxDragDropManager<IconInfo> dragMgr;
|
||||||
private Thread dropCheckThread = null;
|
|
||||||
|
//private Thread dropCheckThread = null;
|
||||||
|
|
||||||
public RightCardControl()
|
public RightCardControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.Loaded += RightCardControl_Loaded;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RightCardControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
#region 图标拖动
|
|
||||||
DelegateCommand<int[]> _swap;
|
|
||||||
public DelegateCommand<int[]> SwapCommand
|
|
||||||
{
|
{
|
||||||
get
|
this.dragMgr = new ListBoxDragDropManager<IconInfo>(this.IconListBox);
|
||||||
{
|
|
||||||
if (_swap == null)
|
|
||||||
_swap = new DelegateCommand<int[]>(
|
|
||||||
(indexes) =>
|
|
||||||
{
|
|
||||||
DROP_ICON = true;
|
|
||||||
if (appData.AppConfig.IconSortType != SortType.CUSTOM
|
|
||||||
&& (dropCheckThread == null || !dropCheckThread.IsAlive))
|
|
||||||
{
|
|
||||||
dropCheckThread = new Thread(() =>
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
DROP_ICON = false;
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
} while (DROP_ICON);
|
|
||||||
|
|
||||||
MainWindow.appData.AppConfig.IconSortType = SortType.CUSTOM;
|
|
||||||
App.Current.Dispatcher.Invoke(() =>
|
|
||||||
{
|
|
||||||
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
|
|
||||||
|| MainWindow.mainWindow.Opacity != 1)
|
|
||||||
{
|
|
||||||
Growl.WarningGlobal("已将图标排序规则重置为自定义!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Growl.Warning("已将图标排序规则重置为自定义!", "MainWindowGrowl");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
dropCheckThread.Start();
|
|
||||||
}
|
|
||||||
int fromS = indexes[0];
|
|
||||||
int to = indexes[1];
|
|
||||||
ObservableCollection<IconInfo> iconList = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
|
||||||
var elementSource = iconList[to];
|
|
||||||
var dragged = iconList[fromS];
|
|
||||||
|
|
||||||
iconList.Remove(dragged);
|
|
||||||
iconList.Insert(to, dragged);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return _swap;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion 图标拖动
|
|
||||||
|
//#region 图标拖动
|
||||||
|
//DelegateCommand<int[]> _swap;
|
||||||
|
//public DelegateCommand<int[]> SwapCommand
|
||||||
|
//{
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// if (_swap == null)
|
||||||
|
// _swap = new DelegateCommand<int[]>(
|
||||||
|
// (indexes) =>
|
||||||
|
// {
|
||||||
|
// DROP_ICON = true;
|
||||||
|
// if (appData.AppConfig.IconSortType != SortType.CUSTOM
|
||||||
|
// && (dropCheckThread == null || !dropCheckThread.IsAlive))
|
||||||
|
// {
|
||||||
|
// dropCheckThread = new Thread(() =>
|
||||||
|
// {
|
||||||
|
// do
|
||||||
|
// {
|
||||||
|
// DROP_ICON = false;
|
||||||
|
// Thread.Sleep(1000);
|
||||||
|
// } while (DROP_ICON);
|
||||||
|
|
||||||
|
// MainWindow.appData.AppConfig.IconSortType = SortType.CUSTOM;
|
||||||
|
// App.Current.Dispatcher.Invoke(() =>
|
||||||
|
// {
|
||||||
|
// if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
|
||||||
|
// || MainWindow.mainWindow.Opacity != 1)
|
||||||
|
// {
|
||||||
|
// Growl.WarningGlobal("已将图标排序规则重置为自定义!");
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// Growl.Warning("已将图标排序规则重置为自定义!", "MainWindowGrowl");
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// dropCheckThread.Start();
|
||||||
|
// }
|
||||||
|
// int fromS = indexes[0];
|
||||||
|
// int to = indexes[1];
|
||||||
|
// ObservableCollection<IconInfo> iconList = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
||||||
|
// var elementSource = iconList[to];
|
||||||
|
// var dragged = iconList[fromS];
|
||||||
|
|
||||||
|
// iconList.Remove(dragged);
|
||||||
|
// iconList.Insert(to, dragged);
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// return _swap;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//#endregion 图标拖动
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -164,47 +173,68 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
|
StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartIconApp(IconInfo icon, IconStartType type)
|
private void StartIconApp(IconInfo icon, IconStartType type, bool useRelativePath = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Process p = new Process())
|
Process p = new Process();
|
||||||
{
|
//using ()
|
||||||
string startArg = icon.StartArg;
|
//{
|
||||||
|
p.StartInfo.UseShellExecute = false;
|
||||||
|
p.StartInfo.RedirectStandardInput = true;
|
||||||
|
p.StartInfo.RedirectStandardOutput = true;
|
||||||
|
p.StartInfo.RedirectStandardError = true;
|
||||||
|
p.StartInfo.CreateNoWindow = true;
|
||||||
|
|
||||||
|
string startArg = icon.StartArg;
|
||||||
|
|
||||||
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
|
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
|
||||||
{
|
{
|
||||||
StartSystemApp(startArg, type);
|
StartSystemApp(startArg, type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.StartInfo.FileName = icon.Path;
|
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))
|
if (!StringUtil.IsEmpty(startArg))
|
||||||
{
|
{
|
||||||
p.StartInfo.Arguments = startArg;
|
p.StartInfo.Arguments = startArg;
|
||||||
}
|
}
|
||||||
if (icon.IconType == IconType.OTHER)
|
if (icon.IconType == IconType.OTHER)
|
||||||
{
|
{
|
||||||
if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
|
if (!File.Exists(path) && !Directory.Exists(path))
|
||||||
{
|
{
|
||||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
//如果没有使用相对路径 那么使用相对路径启动一次
|
||||||
return;
|
if (!useRelativePath)
|
||||||
|
{
|
||||||
|
StartIconApp(icon, type, true);
|
||||||
|
return;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p.StartInfo.WorkingDirectory = icon.Path.Substring(0, icon.Path.LastIndexOf("\\"));
|
p.StartInfo.WorkingDirectory = path.Substring(0, path.LastIndexOf("\\"));
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case IconStartType.ADMIN_STARTUP:
|
case IconStartType.ADMIN_STARTUP:
|
||||||
//p.StartInfo.Arguments = "1";//启动参数
|
|
||||||
p.StartInfo.Verb = "runas";
|
p.StartInfo.Verb = "runas";
|
||||||
//p.StartInfo.CreateNoWindow = false; //设置显示窗口
|
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||||
p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
|
|
||||||
//p.StartInfo.ErrorDialog = false;
|
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
|
||||||
{
|
{
|
||||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
if (appData.AppConfig.MarginHide)
|
if (appData.AppConfig.MarginHide)
|
||||||
{
|
{
|
||||||
if (!MarginHide.IS_HIDE)
|
if (!MarginHide.IsMargin())
|
||||||
{
|
{
|
||||||
MainWindow.HideApp();
|
MainWindow.HideApp();
|
||||||
}
|
}
|
||||||
@@ -216,13 +246,13 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;// c#好像不能case穿透
|
break;// c#好像不能case穿透
|
||||||
case IconStartType.DEFAULT_STARTUP:
|
case IconStartType.DEFAULT_STARTUP:
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||||
{
|
{
|
||||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
if (appData.AppConfig.MarginHide)
|
if (appData.AppConfig.MarginHide)
|
||||||
{
|
{
|
||||||
if (!MarginHide.IS_HIDE)
|
if (!MarginHide.IsMargin())
|
||||||
{
|
{
|
||||||
MainWindow.HideApp();
|
MainWindow.HideApp();
|
||||||
}
|
}
|
||||||
@@ -241,7 +271,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
|
||||||
{
|
{
|
||||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
if (appData.AppConfig.MarginHide)
|
if (appData.AppConfig.MarginHide)
|
||||||
@@ -258,8 +288,15 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.Start();
|
p.Start();
|
||||||
|
p.Close();
|
||||||
|
p.Dispose();
|
||||||
|
if (useRelativePath)
|
||||||
|
{
|
||||||
|
//如果使用相对路径启动成功 那么重新设置程序绝对路径
|
||||||
|
icon.Path = path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
icon.Count++;
|
icon.Count++;
|
||||||
|
|
||||||
//隐藏搜索框
|
//隐藏搜索框
|
||||||
@@ -270,9 +307,16 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(不支持的启动方式)!");
|
if (!useRelativePath)
|
||||||
LogUtil.WriteErrorLog(e, "程序启动失败:path=" + icon.Path + ",type=" + type);
|
{
|
||||||
}
|
StartIconApp(icon, type, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(可能为不支持的启动方式)!");
|
||||||
|
LogUtil.WriteErrorLog(e, "程序启动失败:path=" + icon.Path + ",type=" + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -369,7 +413,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
|
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
|
||||||
}
|
}
|
||||||
CommonCode.SortIconList();
|
CommonCode.SortIconList();
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -406,28 +450,64 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
case IconType.URL:
|
case IconType.URL:
|
||||||
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog(info);
|
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog(info);
|
||||||
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "IconInfoDialog");
|
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "MainWindowDialog");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
IconInfoDialog dialog = new IconInfoDialog(info);
|
IconInfoDialog dialog = new IconInfoDialog(info);
|
||||||
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "IconInfoDialog");
|
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "MainWindowDialog");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 width = appData.AppConfig.ImageWidth;
|
||||||
double height = appData.AppConfig.ImageHeight;
|
double height = appData.AppConfig.ImageHeight;
|
||||||
width += width * 0.15;
|
width += width * 0.15;
|
||||||
height += height * 0.15;
|
height += height * 0.15;
|
||||||
ImgStoryBoard(sender, (int)width, (int)height, 1, true);
|
|
||||||
|
ThreadPool.QueueUserWorkItem(state =>
|
||||||
|
{
|
||||||
|
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
ImgStoryBoard(sender, (int)width, (int)height, 1, true);
|
||||||
|
}));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
|
private void MenuIcon_MouseLeave(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 220);
|
RunTimeStatus.MOUSE_ENTER_ICON = false;
|
||||||
|
MyPoptip.IsOpen = false;
|
||||||
|
|
||||||
|
ThreadPool.QueueUserWorkItem(state =>
|
||||||
|
{
|
||||||
|
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 260);
|
||||||
|
}));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -436,6 +516,59 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
|
|
||||||
if (appData.AppConfig.PMModel) return;
|
if (appData.AppConfig.PMModel) return;
|
||||||
|
|
||||||
|
//int count = 0;
|
||||||
|
//Panel sp = sender as Panel;
|
||||||
|
//Image img = sp.Children[0] as Image;
|
||||||
|
|
||||||
|
|
||||||
|
//int nowH = (int)img.Height;
|
||||||
|
|
||||||
|
//bool isSmall = nowH > height;
|
||||||
|
|
||||||
|
//if (!isSmall)
|
||||||
|
//{
|
||||||
|
// img.Height = height;
|
||||||
|
// img.Width = width;
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
//double subLen = (double)Math.Abs(nowH - height) / (double)milliseconds;
|
||||||
|
|
||||||
|
//new Thread(() =>
|
||||||
|
//{
|
||||||
|
// this.Dispatcher.Invoke(() =>
|
||||||
|
// {
|
||||||
|
// while (count < milliseconds)
|
||||||
|
// {
|
||||||
|
// if (!isSmall)
|
||||||
|
// {
|
||||||
|
// img.Height += subLen;
|
||||||
|
// img.Width += subLen;
|
||||||
|
// } else
|
||||||
|
// {
|
||||||
|
// //if (img.Height > 1)
|
||||||
|
// //{
|
||||||
|
// // img.Height -= 1;
|
||||||
|
// // img.Width -= 1;
|
||||||
|
// //}
|
||||||
|
// Application.Current.Dispatcher.Invoke(DispatcherPriority.Background,
|
||||||
|
// new Action(delegate {
|
||||||
|
// img.Height -= subLen;
|
||||||
|
// img.Width -= subLen;
|
||||||
|
// }));
|
||||||
|
// //img.Height -= subLen;
|
||||||
|
// //img.Width -= subLen;
|
||||||
|
// }
|
||||||
|
// count++;
|
||||||
|
// Thread.Sleep(1);
|
||||||
|
// }
|
||||||
|
// img.Height = height;
|
||||||
|
// img.Width = width;
|
||||||
|
// });
|
||||||
|
//}).Start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Panel sp = sender as Panel;
|
Panel sp = sender as Panel;
|
||||||
|
|
||||||
DependencyObject dos = sp.Parent;
|
DependencyObject dos = sp.Parent;
|
||||||
@@ -491,6 +624,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
ThreadStart ts = new ThreadStart(crs.Remove);
|
ThreadStart ts = new ThreadStart(crs.Remove);
|
||||||
System.Threading.Thread t = new System.Threading.Thread(ts);
|
System.Threading.Thread t = new System.Threading.Thread(ts);
|
||||||
|
t.IsBackground = true;
|
||||||
t.Start();
|
t.Start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -501,10 +635,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
};
|
};
|
||||||
img.BeginAnimation(WidthProperty, widthAnimation);
|
img.BeginAnimation(WidthProperty, widthAnimation);
|
||||||
img.BeginAnimation(HeightProperty, heightAnimation);
|
img.BeginAnimation(HeightProperty, heightAnimation);
|
||||||
|
//###################################################################
|
||||||
//myStoryboard.Completed += (s, e) =>
|
//myStoryboard.Completed += (s, e) =>
|
||||||
//{
|
//{
|
||||||
// if (checkRmStoryboard || true)
|
// if (checkRmStoryboard)
|
||||||
// {
|
// {
|
||||||
// ThreadStart ts = new ThreadStart(crs.Remove);
|
// ThreadStart ts = new ThreadStart(crs.Remove);
|
||||||
// System.Threading.Thread t = new System.Threading.Thread(ts);
|
// System.Threading.Thread t = new System.Threading.Thread(ts);
|
||||||
@@ -564,7 +698,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
private void AddUrlIcon(object sender, RoutedEventArgs e)
|
private void AddUrlIcon(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog();
|
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog();
|
||||||
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "IconInfoDialog");
|
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "MainWindowDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -623,5 +757,296 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
this.Cursor = Cursors.Arrow;
|
this.Cursor = Cursors.Arrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 锁定/解锁主面板
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LockAppPanel(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
RunTimeStatus.LOCK_APP_PANEL = !RunTimeStatus.LOCK_APP_PANEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WrapCard_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (RunTimeStatus.LOCK_APP_PANEL)
|
||||||
|
{
|
||||||
|
CardLockCM.Header = "解锁主面板";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
CardLockCM.Header = "锁定主面板";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SearchListBoxIndexAdd()
|
||||||
|
{
|
||||||
|
//控制移动后 鼠标即使在图标上也不显示popup
|
||||||
|
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
|
||||||
|
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;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (PDDialog.Visibility == Visibility.Visible)
|
||||||
|
{
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||||
|
PDDialog.ClearVal();
|
||||||
|
PDDialog.ErrorMsg.Visibility = Visibility.Collapsed;
|
||||||
|
PDDialog.PasswordGrid.Visibility = Visibility.Visible;
|
||||||
|
PDDialog.HintGrid.Visibility = Visibility.Collapsed;
|
||||||
|
PDDialog.count = 0;
|
||||||
|
PDDialog.SetFocus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = false;
|
||||||
|
PDDialog.ClearVal();
|
||||||
|
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>
|
||||||
|
/// 搜索结果icon 列表鼠标滚轮预处理时间
|
||||||
|
/// 主要使用自定义popup解决卡顿问题解决卡顿问题
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void VerticalIconList_PreviewMouseWheel(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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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;
|
||||||
|
MyPoptipContent.Text = info.Content;
|
||||||
|
MyPoptip.VerticalOffset = 30;
|
||||||
|
Thread.Sleep(100);
|
||||||
|
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL && RunTimeStatus.MOUSE_MOVE_COUNT > 1)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
MyPoptip.IsOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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;
|
||||||
|
MyPoptipContent.Text = info.Content;
|
||||||
|
MyPoptip.VerticalOffset = 30;
|
||||||
|
|
||||||
|
if (RunTimeStatus.MOUSE_MOVE_COUNT > 1 && !RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||||
|
{
|
||||||
|
MyPoptip.IsOpen = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,8 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
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.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.SystemItem
|
namespace GeekDesk.Control.UserControls.SystemItem
|
||||||
{
|
{
|
||||||
@@ -47,13 +35,14 @@ namespace GeekDesk.Control.UserControls.SystemItem
|
|||||||
};
|
};
|
||||||
iconInfo.Content_NoWrite = iconInfo.Name_NoWrite
|
iconInfo.Content_NoWrite = iconInfo.Name_NoWrite
|
||||||
+ "\n使用次数:" + iconInfo.Count;
|
+ "\n使用次数:" + iconInfo.Count;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
//startupMenu or Store
|
//startupMenu or Store
|
||||||
iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite);
|
iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite);
|
||||||
}
|
}
|
||||||
menuInfo.IconList.Add(iconInfo);
|
menuInfo.IconList.Add(iconInfo);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,22 +9,54 @@
|
|||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<!--<cst:Count2VisibleConvert x:Key="Count2VisibleConvert"/>
|
||||||
|
<cst:CountGreZero2BoolConvert x:Key="CountGreZero2BoolConvert"/>
|
||||||
|
<Style x:Key="NoDataStyle" TargetType="TextBlock">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ElementName=BacklogList, Path=Items.Count, Converter={StaticResource CountGreZero2BoolConvert}}" Value="False">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding ElementName=BacklogList, Path=Items.Count, Converter={StaticResource CountGreZero2BoolConvert}}" Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="ToDoStyle" TargetType="DataGrid">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ElementName=BacklogList, Path=Items.Count, Converter={StaticResource CountGreZero2BoolConvert}}" Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding ElementName=BacklogList, Path=Items.Count, Converter={StaticResource CountGreZero2BoolConvert}}" Value="False">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>-->
|
||||||
|
</UserControl.Resources>
|
||||||
<hc:SimplePanel Margin="20" Background="Transparent">
|
<hc:SimplePanel Margin="20" Background="Transparent">
|
||||||
<Grid Background="Transparent">
|
<Grid Background="Transparent">
|
||||||
|
<TextBlock x:Name="IsNewToDo" Visibility="Collapsed" />
|
||||||
|
<TextBlock x:Name="NoData"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
TextAlignment="Center"
|
||||||
|
Text="暂无数据!"
|
||||||
|
/>
|
||||||
|
|
||||||
<DataGrid x:Name="BacklogList"
|
<DataGrid x:Name="BacklogList"
|
||||||
HeadersVisibility="All"
|
HeadersVisibility="All"
|
||||||
AutoGenerateColumns="False"
|
AutoGenerateColumns="False"
|
||||||
ItemsSource="{Binding}"
|
ItemsSource="{Binding}"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Initialized="DataGridMenu_Initialized"
|
Initialized="DataGridMenu_Initialized"
|
||||||
>
|
>
|
||||||
<DataGrid.ContextMenu>
|
<DataGrid.ContextMenu>
|
||||||
<ContextMenu x:Name="Menu" Width="120">
|
<ContextMenu x:Name="Menu" Width="120">
|
||||||
<MenuItem Header="详情" Click="DetailMenu_Click"/>
|
<MenuItem Header="详情" Click="DetailMenu_Click"/>
|
||||||
<MenuItem Header="删除" Click="DeleteMenu_Click"/>
|
<MenuItem Header="删除" Click="DeleteMenu_Click"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</DataGrid.ContextMenu>
|
</DataGrid.ContextMenu>
|
||||||
<DataGrid.RowStyle>
|
<!--<DataGrid.RowStyle>
|
||||||
<Style TargetType="DataGridRow" BasedOn="{StaticResource DataGridRowStyle}">
|
<Style TargetType="DataGridRow" BasedOn="{StaticResource DataGridRowStyle}">
|
||||||
<EventSetter Event="MouseRightButtonDown" Handler="DataGridRow_MouseRightButtonDown" />
|
<EventSetter Event="MouseRightButtonDown" Handler="DataGridRow_MouseRightButtonDown" />
|
||||||
<Setter Property="Background" Value="White"/>
|
<Setter Property="Background" Value="White"/>
|
||||||
@@ -37,8 +69,59 @@
|
|||||||
</Trigger>
|
</Trigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
</DataGrid.RowStyle>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<Style.Setters>
|
||||||
|
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
||||||
|
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
|
<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.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<SelectiveScrollingGrid>
|
||||||
|
<SelectiveScrollingGrid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</SelectiveScrollingGrid.ColumnDefinitions>
|
||||||
|
<SelectiveScrollingGrid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</SelectiveScrollingGrid.RowDefinitions>
|
||||||
|
<DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||||
|
<Path Name="Cross" Grid.ColumnSpan="2" Visibility="Collapsed" Margin="10,0,10,0" Data="M0,0.5 L1,0.5" Stretch="Fill" Stroke="Gray" StrokeThickness="1" Opacity="0.5" />
|
||||||
|
</SelectiveScrollingGrid>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ElementName=IsNewToDo, Path=Text}" Value="N">
|
||||||
|
<Setter TargetName="Cross" Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding ElementName=IsNewToDo, Path=Text}" Value="Y">
|
||||||
|
<Setter TargetName="Cross" Property="Visibility" Value="Collapsed"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style.Setters>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="#E5E5E2" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
</DataGrid.RowStyle>
|
</DataGrid.RowStyle>
|
||||||
|
|
||||||
|
|
||||||
<DataGrid.CellStyle>
|
<DataGrid.CellStyle>
|
||||||
<Style TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle}">
|
<Style TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle}">
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||||
|
|||||||
@@ -1,21 +1,13 @@
|
|||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Control.Windows;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.Backlog
|
namespace GeekDesk.Control.UserControls.Backlog
|
||||||
{
|
{
|
||||||
@@ -51,7 +43,7 @@ namespace GeekDesk.Control.UserControls.Backlog
|
|||||||
{
|
{
|
||||||
MainWindow.appData.HiToDoList.Remove(info);
|
MainWindow.appData.HiToDoList.Remove(info);
|
||||||
}
|
}
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}, "DeleteConfirm");
|
}, "DeleteConfirm");
|
||||||
@@ -80,7 +72,17 @@ namespace GeekDesk.Control.UserControls.Backlog
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void DataGridRow_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
private void DataGridRow_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
BacklogList.SelectedIndex = ((DataGridRow)sender).GetIndex();
|
int index;
|
||||||
|
ToDoInfo info = ((Border)sender).DataContext as ToDoInfo;
|
||||||
|
if (type == ToDoType.NEW)
|
||||||
|
{
|
||||||
|
index = MainWindow.appData.ToDoList.IndexOf(info);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = MainWindow.appData.HiToDoList.IndexOf(info);
|
||||||
|
}
|
||||||
|
BacklogList.SelectedIndex = index;
|
||||||
Menu.IsOpen = true;
|
Menu.IsOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
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"
|
||||||
Title="Setting"
|
Title="Setting"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
@@ -24,30 +25,32 @@
|
|||||||
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
|
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
|
||||||
RenderingBias="Quality" ShadowDepth="2"/>
|
RenderingBias="Quality" ShadowDepth="2"/>
|
||||||
</Grid.Effect>
|
</Grid.Effect>
|
||||||
<Border Style="{StaticResource BorderBG}">
|
<Grid hc:Dialog.Token="ConfigWindowDialog">
|
||||||
<Grid Background="Transparent">
|
<hc:DialogContainer Margin="10">
|
||||||
<Grid.RowDefinitions>
|
<Border Style="{StaticResource BorderBG}">
|
||||||
<RowDefinition Height="*"/>
|
<Grid Background="Transparent">
|
||||||
</Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<RowDefinition Height="*"/>
|
||||||
<ColumnDefinition Width="140"/>
|
</Grid.RowDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<Grid.ColumnDefinitions>
|
||||||
</Grid.ColumnDefinitions>
|
<ColumnDefinition Width="140"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<hc:Card Grid.Row="0" Grid.Column="0" Background="Transparent" BorderThickness="0">
|
<hc:Card Grid.Row="0" Grid.Column="0" Background="Transparent" BorderThickness="0">
|
||||||
|
|
||||||
<hc:SideMenu AutoSelect="True" Background="Transparent" Margin="1,7,0,3">
|
<hc:SideMenu AutoSelect="True" Background="Transparent" Margin="1,7,0,3">
|
||||||
<hc:SideMenu.ItemContainerStyle>
|
<hc:SideMenu.ItemContainerStyle>
|
||||||
<Style TargetType="hc:SideMenuItem" BasedOn="{StaticResource MyMenuStyle}"/>
|
<Style TargetType="hc:SideMenuItem" BasedOn="{StaticResource MyMenuStyle}"/>
|
||||||
</hc:SideMenu.ItemContainerStyle>
|
</hc:SideMenu.ItemContainerStyle>
|
||||||
|
|
||||||
<hc:SideMenuItem Header="关于"
|
<hc:SideMenuItem Header="关于"
|
||||||
IsSelected="True"
|
IsSelected="True"
|
||||||
Selected="MemuClick"
|
Selected="MemuClick"
|
||||||
Tag="About"
|
Tag="About"
|
||||||
>
|
>
|
||||||
<hc:SideMenuItem.Icon>
|
<hc:SideMenuItem.Icon>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Opacity="0.9"
|
Opacity="0.9"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
@@ -56,13 +59,13 @@
|
|||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
/>
|
/>
|
||||||
</hc:SideMenuItem.Icon>
|
</hc:SideMenuItem.Icon>
|
||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
<hc:SideMenuItem Header="显示设置"
|
<hc:SideMenuItem Header="显示设置"
|
||||||
Tag="Theme"
|
Tag="Theme"
|
||||||
Selected="MemuClick">
|
Selected="MemuClick">
|
||||||
<hc:SideMenuItem.Icon>
|
<hc:SideMenuItem.Icon>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Opacity="1"
|
Opacity="1"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
@@ -71,14 +74,14 @@
|
|||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
/>
|
/>
|
||||||
</hc:SideMenuItem.Icon>
|
</hc:SideMenuItem.Icon>
|
||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
|
|
||||||
<hc:SideMenuItem Header="动作"
|
<hc:SideMenuItem Header="动作"
|
||||||
Tag="Motion"
|
Tag="Motion"
|
||||||
Selected="MemuClick">
|
Selected="MemuClick">
|
||||||
<hc:SideMenuItem.Icon>
|
<hc:SideMenuItem.Icon>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Opacity="1"
|
Opacity="1"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
@@ -87,13 +90,13 @@
|
|||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
/>
|
/>
|
||||||
</hc:SideMenuItem.Icon>
|
</hc:SideMenuItem.Icon>
|
||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
<hc:SideMenuItem Header="其它"
|
<hc:SideMenuItem Header="其它"
|
||||||
Tag="Other"
|
Tag="Other"
|
||||||
Selected="MemuClick">
|
Selected="MemuClick">
|
||||||
<hc:SideMenuItem.Icon>
|
<hc:SideMenuItem.Icon>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Opacity="1"
|
Opacity="1"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
@@ -102,21 +105,28 @@
|
|||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
/>
|
/>
|
||||||
</hc:SideMenuItem.Icon>
|
</hc:SideMenuItem.Icon>
|
||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
</hc:SideMenu>
|
</hc:SideMenu>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
<hc:ScrollViewer Grid.Row="0" Grid.Column="1" BorderThickness="0" Margin="0,5,1,5">
|
<hc:ScrollViewer Grid.Row="0" Grid.Column="1" BorderThickness="0" Margin="0,5,1,5">
|
||||||
<hc:Card x:Name="RightCard" Height="480" BorderThickness="0" MouseDown="DragMove">
|
<UniformGrid x:Name="UFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, Event=Visibility, Delay=0}">
|
||||||
<hc:Card.Background>
|
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
|
||||||
<SolidColorBrush Opacity="0"/>
|
<hc:Card x:Name="RightCard" BorderThickness="0" MouseDown="DragMove">
|
||||||
</hc:Card.Background>
|
<hc:Card.Background>
|
||||||
</hc:Card>
|
<SolidColorBrush Opacity="0"/>
|
||||||
</hc:ScrollViewer>
|
</hc:Card.Background>
|
||||||
|
</hc:Card>
|
||||||
|
<!--</hc:TransitioningContentControl>-->
|
||||||
|
</UniformGrid>
|
||||||
|
</hc:ScrollViewer>
|
||||||
|
|
||||||
<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 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"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
</hc:DialogContainer>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</hc:Window>
|
</hc:Window>
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
|
using GeekDesk.Control.UserControls.Config;
|
||||||
using GeekDesk.Constant;
|
|
||||||
using GeekDesk.Control.UserControls;
|
|
||||||
using GeekDesk.Control.UserControls.Config;
|
|
||||||
using GeekDesk.Interface;
|
using GeekDesk.Interface;
|
||||||
using GeekDesk.Util;
|
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using HandyControl.Data;
|
using System.Collections.Generic;
|
||||||
using System;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace GeekDesk.Control.Windows
|
namespace GeekDesk.Control.Windows
|
||||||
@@ -22,6 +18,14 @@ namespace GeekDesk.Control.Windows
|
|||||||
private static readonly ThemeControl theme = new ThemeControl();
|
private static readonly ThemeControl theme = new ThemeControl();
|
||||||
private static readonly MotionControl motion = new MotionControl();
|
private static readonly MotionControl motion = new MotionControl();
|
||||||
private static readonly OtherControl other = new OtherControl();
|
private static readonly OtherControl other = new OtherControl();
|
||||||
|
private static List<UserControl> ucList = new List<UserControl>();
|
||||||
|
static ConfigWindow()
|
||||||
|
{
|
||||||
|
ucList.Add(about);
|
||||||
|
ucList.Add(theme);
|
||||||
|
ucList.Add(motion);
|
||||||
|
ucList.Add(other);
|
||||||
|
}
|
||||||
public MainWindow mainWindow;
|
public MainWindow mainWindow;
|
||||||
|
|
||||||
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
|
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
|
||||||
@@ -32,10 +36,12 @@ namespace GeekDesk.Control.Windows
|
|||||||
RightCard.Content = about;
|
RightCard.Content = about;
|
||||||
this.Topmost = true;
|
this.Topmost = true;
|
||||||
this.mainWindow = mainWindow;
|
this.mainWindow = mainWindow;
|
||||||
|
UFG.Visibility = Visibility.Collapsed;
|
||||||
|
UFG.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 点击关闭按钮
|
/// 点击关闭按钮
|
||||||
@@ -53,16 +59,24 @@ namespace GeekDesk.Control.Windows
|
|||||||
switch (smi.Tag.ToString())
|
switch (smi.Tag.ToString())
|
||||||
{
|
{
|
||||||
case "Motion":
|
case "Motion":
|
||||||
|
UFG.Visibility = Visibility.Collapsed;
|
||||||
RightCard.Content = motion;
|
RightCard.Content = motion;
|
||||||
|
UFG.Visibility = Visibility.Visible;
|
||||||
break;
|
break;
|
||||||
case "Theme":
|
case "Theme":
|
||||||
|
UFG.Visibility = Visibility.Collapsed;
|
||||||
RightCard.Content = theme;
|
RightCard.Content = theme;
|
||||||
|
UFG.Visibility = Visibility.Visible;
|
||||||
break;
|
break;
|
||||||
case "Other":
|
case "Other":
|
||||||
|
UFG.Visibility = Visibility.Collapsed;
|
||||||
RightCard.Content = other;
|
RightCard.Content = other;
|
||||||
|
UFG.Visibility = Visibility.Visible;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
UFG.Visibility = Visibility.Collapsed;
|
||||||
RightCard.Content = about;
|
RightCard.Content = about;
|
||||||
|
UFG.Visibility = Visibility.Visible;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
49
Control/Windows/GlobalColorPickerWindow.xaml
Normal file
49
Control/Windows/GlobalColorPickerWindow.xaml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<Window x:Class="GeekDesk.Control.Windows.GlobalColorPickerWindow"
|
||||||
|
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:local="clr-namespace:GeekDesk.Control.Windows"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
WindowStyle="None"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="Transparent"
|
||||||
|
KeyDown="OnKeyDown"
|
||||||
|
>
|
||||||
|
<Border CornerRadius="8"
|
||||||
|
Background="White"
|
||||||
|
Height="385"
|
||||||
|
Width="228">
|
||||||
|
<StackPanel>
|
||||||
|
|
||||||
|
<Border MouseDown="DragMove"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
CornerRadius="8,8,0,0"
|
||||||
|
Height="20"
|
||||||
|
Background="White"
|
||||||
|
>
|
||||||
|
<Button Width="18" Height="18"
|
||||||
|
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"
|
||||||
|
Padding="0"
|
||||||
|
Background="Transparent"
|
||||||
|
Opacity="0.6"
|
||||||
|
Margin="0,0,5,0"
|
||||||
|
Click="Button_Click"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
MouseEnter="Button_MouseEnter"
|
||||||
|
MouseLeave="Button_MouseLeave"
|
||||||
|
VerticalAlignment="Center">
|
||||||
|
|
||||||
|
</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>
|
||||||
|
</Border>
|
||||||
|
</Window>
|
||||||
152
Control/Windows/GlobalColorPickerWindow.xaml.cs
Normal file
152
Control/Windows/GlobalColorPickerWindow.xaml.cs
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
using GeekDesk.Interface;
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace GeekDesk.Control.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// GlobalColorPickerWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class GlobalColorPickerWindow : IWindowCommon
|
||||||
|
{
|
||||||
|
PixelColorPickerWindow colorPickerWindow = null;
|
||||||
|
public GlobalColorPickerWindow()
|
||||||
|
{
|
||||||
|
this.Topmost = true;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
this.DataContext = null;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 取消按钮事件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void MyColorPicker_Canceled(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MyColorPickerClose();
|
||||||
|
}
|
||||||
|
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移动窗口
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
|
{
|
||||||
|
this.DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void MyColorPicker_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Hide();
|
||||||
|
if (colorPickerWindow == null || !colorPickerWindow.Activate())
|
||||||
|
{
|
||||||
|
colorPickerWindow = new PixelColorPickerWindow(MyColorPicker);
|
||||||
|
}
|
||||||
|
colorPickerWindow.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyColorPickerClose()
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static System.Windows.Window window = null;
|
||||||
|
|
||||||
|
public static void CreateNoShow()
|
||||||
|
{
|
||||||
|
if (window == null || !window.Activate())
|
||||||
|
{
|
||||||
|
window = new GlobalColorPickerWindow();
|
||||||
|
window.Opacity = 0;
|
||||||
|
App.DoEvents();
|
||||||
|
window.Show();
|
||||||
|
}
|
||||||
|
window.Hide();
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
Thread.Sleep(200);
|
||||||
|
App.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
GlobalColorPickerWindow thisWindow = (GlobalColorPickerWindow)window;
|
||||||
|
if (thisWindow.colorPickerWindow == null || !thisWindow.colorPickerWindow.Activate())
|
||||||
|
{
|
||||||
|
thisWindow.colorPickerWindow = new PixelColorPickerWindow(thisWindow.MyColorPicker);
|
||||||
|
}
|
||||||
|
thisWindow.colorPickerWindow.Show();
|
||||||
|
});
|
||||||
|
}).Start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Show()
|
||||||
|
{
|
||||||
|
if (window == null || !window.Activate())
|
||||||
|
{
|
||||||
|
window = new GlobalColorPickerWindow();
|
||||||
|
}
|
||||||
|
window.Opacity = 1;
|
||||||
|
window.Show();
|
||||||
|
Keyboard.Focus(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ShowOrHide()
|
||||||
|
{
|
||||||
|
if (window == null || !window.Activate())
|
||||||
|
{
|
||||||
|
window = new GlobalColorPickerWindow();
|
||||||
|
window.Show();
|
||||||
|
Keyboard.Focus(window);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||||
|
{
|
||||||
|
Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_MouseEnter(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
Button btn = sender as Button;
|
||||||
|
btn.Opacity = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
Button btn = sender as Button;
|
||||||
|
btn.Opacity = 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -138,7 +138,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
}
|
}
|
||||||
window.Show();
|
window.Show();
|
||||||
Keyboard.Focus(window);
|
Keyboard.Focus(window);
|
||||||
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0, false);
|
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CustomButton_Click(object sender, RoutedEventArgs e)
|
private void CustomButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
90
Control/Windows/PixelColorPickerWindow.xaml
Normal file
90
Control/Windows/PixelColorPickerWindow.xaml
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<Window
|
||||||
|
x:Class="GeekDesk.Control.Windows.PixelColorPickerWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xml:lang="zh-CN"
|
||||||
|
WindowStyle="None"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="Black"
|
||||||
|
PreviewMouseMove="Window_PreviewMouseMove"
|
||||||
|
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||||
|
MouseRightButtonDown="Window_MouseRightButtonDown"
|
||||||
|
MouseWheel="Window_MouseWheel"
|
||||||
|
>
|
||||||
|
<Window.Resources>
|
||||||
|
<Style x:Key="TextKey" TargetType="TextBlock">
|
||||||
|
<Setter Property="FontSize" Value="12"/>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="TextValue" TargetType="TextBlock">
|
||||||
|
<Setter Property="FontSize" Value="12"/>
|
||||||
|
<Setter Property="Margin" Value="10,0,0,0"/>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Image x:Name="DesktopBG" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
|
|
||||||
|
<Canvas HorizontalAlignment="Left" VerticalAlignment="Top" Background="Transparent">
|
||||||
|
<Canvas x:Name="ColorCanvas"
|
||||||
|
Width="185"
|
||||||
|
Height="160">
|
||||||
|
<Border Background="White"
|
||||||
|
CornerRadius="5"
|
||||||
|
>
|
||||||
|
<Grid>
|
||||||
|
<WrapPanel HorizontalAlignment="Center" Height="70" Margin="0,5,0,80">
|
||||||
|
<Border Width="70" Height="70"
|
||||||
|
BorderBrush="Black"
|
||||||
|
BorderThickness="1">
|
||||||
|
<Rectangle x:Name="PixelColor" StrokeThickness="0">
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<SolidColorBrush />
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
|
</Border>
|
||||||
|
<Border x:Name="Pixel"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Width="70"
|
||||||
|
Height="70"
|
||||||
|
Background="Black"
|
||||||
|
BorderBrush="Black"
|
||||||
|
BorderThickness="1"
|
||||||
|
Margin="20,0,0,0"
|
||||||
|
>
|
||||||
|
<Grid>
|
||||||
|
<Rectangle x:Name="PixelBG" StrokeThickness="0">
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<VisualBrush ViewboxUnits="Absolute" Viewbox="0,0,20,20"
|
||||||
|
ViewportUnits="RelativeToBoundingBox" Viewport="0,0,1,1">
|
||||||
|
</VisualBrush>
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
|
<Border HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Width="6" Height="6"
|
||||||
|
BorderBrush="White" BorderThickness="0.6">
|
||||||
|
|
||||||
|
<Border Width="4.5" Height="4.5" BorderBrush="Black" BorderThickness="0.6"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</WrapPanel>
|
||||||
|
<WrapPanel HorizontalAlignment="Center" Height="80" Margin="0,85,0,5">
|
||||||
|
<StackPanel Width="100" Height="80">
|
||||||
|
<TextBlock Text="RGB:" Style="{StaticResource TextKey}"/>
|
||||||
|
<TextBlock x:Name="PixelColor_RGB" Style="{StaticResource TextValue}"/>
|
||||||
|
|
||||||
|
<TextBlock Text="HTML:" Margin="0,5,0,0" Style="{StaticResource TextKey}"/>
|
||||||
|
<TextBlock x:Name="PixelColor_HTML" Style="{StaticResource TextValue}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Width="65" Height="80" Margin="10,0,0,0">
|
||||||
|
<TextBlock x:Name="Pixel_XY" TextAlignment="Right"/>
|
||||||
|
</StackPanel>
|
||||||
|
</WrapPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Canvas>
|
||||||
|
</Canvas>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
221
Control/Windows/PixelColorPickerWindow.xaml.cs
Normal file
221
Control/Windows/PixelColorPickerWindow.xaml.cs
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
using GeekDesk.Interface;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ColorPickerWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class PixelColorPickerWindow : IWindowCommon
|
||||||
|
{
|
||||||
|
private static int PIXEL_REC_LENGTH = 20;
|
||||||
|
|
||||||
|
private static readonly int MIN_LENGTH = 10;
|
||||||
|
private static readonly int MAX_LENGTH = 50;
|
||||||
|
|
||||||
|
private static System.Drawing.Bitmap bgBitmap;
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ColorPickerWindow_Init()
|
||||||
|
{
|
||||||
|
|
||||||
|
this.WindowState = WindowState.Normal;//还原窗口(非最小化和最大化)
|
||||||
|
|
||||||
|
this.Width = SystemParameters.VirtualScreenWidth;
|
||||||
|
this.Height = SystemParameters.VirtualScreenHeight;
|
||||||
|
|
||||||
|
this.Left = SystemParameters.VirtualScreenLeft;
|
||||||
|
this.Top = SystemParameters.VirtualScreenTop;
|
||||||
|
|
||||||
|
DesktopBG.Width = this.Width;
|
||||||
|
DesktopBG.Height = this.Height;
|
||||||
|
this.Topmost = true;
|
||||||
|
|
||||||
|
//获取缩放比例
|
||||||
|
double scale = ScreenUtil.GetScreenScalingFactor();
|
||||||
|
|
||||||
|
bgBitmap = new System.Drawing.Bitmap(
|
||||||
|
(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,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
bgBitmap.Size
|
||||||
|
);
|
||||||
|
}
|
||||||
|
BitmapSource bs = Imaging.CreateBitmapSourceFromHBitmap(
|
||||||
|
bgBitmap.GetHbitmap(),
|
||||||
|
IntPtr.Zero,
|
||||||
|
Int32Rect.Empty,
|
||||||
|
BitmapSizeOptions.FromEmptyOptions()
|
||||||
|
);
|
||||||
|
DesktopBG.Source = bs;
|
||||||
|
VisualBrush b = (VisualBrush)PixelBG.Fill;
|
||||||
|
b.Visual = DesktopBG;
|
||||||
|
Mouse.OverrideCursor = Cursors.Cross;
|
||||||
|
SetPixelAbout(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
this.DataContext = null;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
|
Point pos = e.MouseDevice.GetPosition(DesktopBG);
|
||||||
|
System.Drawing.Color colorD = bgBitmap.GetPixel((int)pos.X, (int)pos.Y);
|
||||||
|
colorPicker.SelectedBrush = new SolidColorBrush(Color.FromArgb(colorD.A, colorD.R, colorD.G, colorD.B));
|
||||||
|
DeleteObject(bgBitmap.GetHbitmap());
|
||||||
|
this.Close();
|
||||||
|
ClickColorPickerToggleButton(colorPicker);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClickColorPickerToggleButton(ColorPicker colorPicker)
|
||||||
|
{
|
||||||
|
const BindingFlags InstanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
||||||
|
Type type = colorPicker.GetType();
|
||||||
|
FieldInfo fi = type.GetField("_toggleButtonDropper", InstanceBindFlags);
|
||||||
|
|
||||||
|
ToggleButton tb = (ToggleButton)fi.GetValue(colorPicker);
|
||||||
|
if (tb != null && tb.IsChecked == true)
|
||||||
|
{
|
||||||
|
tb.IsChecked = false;
|
||||||
|
MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags);
|
||||||
|
mi.Invoke(colorPicker, new object[] { null, null });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_PreviewMouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
SetPixelAbout(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
|
||||||
|
public static extern bool DeleteObject(IntPtr onj);
|
||||||
|
|
||||||
|
private void SetPixelAbout(MouseEventArgs e)
|
||||||
|
{
|
||||||
|
VisualBrush b = (VisualBrush)PixelBG.Fill;
|
||||||
|
|
||||||
|
Point pos;
|
||||||
|
if (e == null)
|
||||||
|
{
|
||||||
|
pos = MouseUtil.GetMousePosition();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos = e.MouseDevice.GetPosition(DesktopBG);
|
||||||
|
}
|
||||||
|
Rect viewBox = b.Viewbox;
|
||||||
|
|
||||||
|
viewBox.Width = PIXEL_REC_LENGTH;
|
||||||
|
viewBox.Height = PIXEL_REC_LENGTH;
|
||||||
|
|
||||||
|
viewBox.X = pos.X - PIXEL_REC_LENGTH / 2;
|
||||||
|
viewBox.Y = pos.Y - PIXEL_REC_LENGTH / 2;
|
||||||
|
b.Viewbox = viewBox;
|
||||||
|
|
||||||
|
double x = pos.X + 10;
|
||||||
|
double y = pos.Y + 10;
|
||||||
|
if (x + ColorCanvas.Width > SystemParameters.VirtualScreenWidth)
|
||||||
|
{
|
||||||
|
x = pos.X - ColorCanvas.Width - 10;
|
||||||
|
}
|
||||||
|
if (y + ColorCanvas.Height > SystemParameters.VirtualScreenHeight)
|
||||||
|
{
|
||||||
|
y = pos.Y - ColorCanvas.Height - 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
Canvas.SetLeft(ColorCanvas, x);
|
||||||
|
Canvas.SetTop(ColorCanvas, y);
|
||||||
|
|
||||||
|
|
||||||
|
System.Drawing.Color dColor = bgBitmap.GetPixel((int)pos.X, (int)pos.Y);
|
||||||
|
|
||||||
|
PixelColor_HTML.Text = "#" + dColor.Name.ToUpper();
|
||||||
|
PixelColor_RGB.Text = dColor.R + "," + dColor.G + "," + dColor.B;
|
||||||
|
Pixel_XY.Text = pos.X + "*" + pos.Y;
|
||||||
|
|
||||||
|
SolidColorBrush scb = (SolidColorBrush)PixelColor.Fill;
|
||||||
|
scb.Color = Color.FromArgb(dColor.A, dColor.R, dColor.G, dColor.B);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 滚轮控制缩放区域
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Window_MouseWheel(object sender, MouseWheelEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (e.Delta < 0 && PIXEL_REC_LENGTH < MAX_LENGTH)
|
||||||
|
{
|
||||||
|
//缩小
|
||||||
|
PIXEL_REC_LENGTH += 5;
|
||||||
|
}
|
||||||
|
else if (e.Delta > 0 && PIXEL_REC_LENGTH > MIN_LENGTH)
|
||||||
|
{
|
||||||
|
//放大
|
||||||
|
PIXEL_REC_LENGTH -= 5;
|
||||||
|
}
|
||||||
|
SetPixelAbout(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 右键按下
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Window_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
GlobalColorPickerWindow.ShowOrHide();
|
||||||
|
//关闭
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.Control.Other;
|
|
||||||
using GeekDesk.Interface;
|
using GeekDesk.Interface;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
@@ -8,13 +7,10 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Resources;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using static GeekDesk.Util.ShowWindowFollowMouse;
|
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||||
@@ -85,7 +81,8 @@ namespace GeekDesk.Control.Windows
|
|||||||
IsBackground = true
|
IsBackground = true
|
||||||
};
|
};
|
||||||
t.Start();
|
t.Start();
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
StartMenuLoading.Visibility = Visibility.Collapsed;
|
StartMenuLoading.Visibility = Visibility.Collapsed;
|
||||||
vm.IconInfos = startMenuIcons;
|
vm.IconInfos = startMenuIcons;
|
||||||
@@ -109,7 +106,8 @@ namespace GeekDesk.Control.Windows
|
|||||||
vm.IconInfos = null;
|
vm.IconInfos = null;
|
||||||
systemIcons = GetSysteIconInfos();
|
systemIcons = GetSysteIconInfos();
|
||||||
vm.IconInfos = systemIcons;
|
vm.IconInfos = systemIcons;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
vm.IconInfos = systemIcons;
|
vm.IconInfos = systemIcons;
|
||||||
}
|
}
|
||||||
@@ -142,7 +140,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
}
|
}
|
||||||
StartMenuLoading.Visibility = Visibility.Collapsed;
|
StartMenuLoading.Visibility = Visibility.Collapsed;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -161,7 +159,8 @@ namespace GeekDesk.Control.Windows
|
|||||||
if (filePaths == null || filePaths.Length == 0)
|
if (filePaths == null || filePaths.Length == 0)
|
||||||
{
|
{
|
||||||
dirPaths.CopyTo(paths, 0);
|
dirPaths.CopyTo(paths, 0);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
dirPaths.CopyTo(paths, filePaths.Length - 1);
|
dirPaths.CopyTo(paths, filePaths.Length - 1);
|
||||||
}
|
}
|
||||||
@@ -195,7 +194,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
//foreach(FileSystemInfo fi in fileInfoArr)
|
//foreach(FileSystemInfo fi in fileInfoArr)
|
||||||
//{
|
//{
|
||||||
// string path = fi.FullName;
|
// string path = fi.FullName;
|
||||||
|
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +280,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
}
|
}
|
||||||
window.Show();
|
window.Show();
|
||||||
Keyboard.Focus(window);
|
Keyboard.Focus(window);
|
||||||
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0, false);
|
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,18 +5,9 @@ using GeekDesk.ViewModel;
|
|||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.Windows
|
namespace GeekDesk.Control.Windows
|
||||||
{
|
{
|
||||||
@@ -42,7 +33,8 @@ namespace GeekDesk.Control.Windows
|
|||||||
DateTime time = DateTime.Now.AddMinutes(10);
|
DateTime time = DateTime.Now.AddMinutes(10);
|
||||||
ExeTime.SelectedDateTime = time;
|
ExeTime.SelectedDateTime = time;
|
||||||
SetTimePanel.Visibility = Visibility.Visible;
|
SetTimePanel.Visibility = Visibility.Visible;
|
||||||
this.DataContext = new ToDoInfo {
|
this.DataContext = new ToDoInfo
|
||||||
|
{
|
||||||
ExeTime = time.ToString("yyyy-MM-dd HH:mm:ss")
|
ExeTime = time.ToString("yyyy-MM-dd HH:mm:ss")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -97,7 +89,8 @@ namespace GeekDesk.Control.Windows
|
|||||||
{
|
{
|
||||||
Growl.Warning("任务标题不能为空!");
|
Growl.Warning("任务标题不能为空!");
|
||||||
return;
|
return;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (SetTimePanel.Visibility == Visibility.Visible)
|
if (SetTimePanel.Visibility == Visibility.Visible)
|
||||||
{
|
{
|
||||||
@@ -117,7 +110,9 @@ namespace GeekDesk.Control.Windows
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
execTime = ExeTime.Text;
|
execTime = ExeTime.Text;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
execType = TodoTaskExecType.CRON;
|
execType = TodoTaskExecType.CRON;
|
||||||
if (Cron.Text.Trim() == "")
|
if (Cron.Text.Trim() == "")
|
||||||
{
|
{
|
||||||
@@ -128,7 +123,8 @@ namespace GeekDesk.Control.Windows
|
|||||||
{
|
{
|
||||||
bool isValid = CronExpression.IsValidExpression(Cron.Text);
|
bool isValid = CronExpression.IsValidExpression(Cron.Text);
|
||||||
if (!isValid) throw new Exception();
|
if (!isValid) throw new Exception();
|
||||||
} catch (Exception)
|
}
|
||||||
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Growl.Warning("请输入正确的Cron表达式!");
|
Growl.Warning("请输入正确的Cron表达式!");
|
||||||
return;
|
return;
|
||||||
@@ -155,7 +151,8 @@ namespace GeekDesk.Control.Windows
|
|||||||
if (appData.HiToDoList.Contains(tdi))
|
if (appData.HiToDoList.Contains(tdi))
|
||||||
{
|
{
|
||||||
appData.HiToDoList.Remove(tdi);
|
appData.HiToDoList.Remove(tdi);
|
||||||
} else if (appData.ToDoList.Contains(tdi))
|
}
|
||||||
|
else if (appData.ToDoList.Contains(tdi))
|
||||||
{
|
{
|
||||||
appData.ToDoList.Remove(tdi);
|
appData.ToDoList.Remove(tdi);
|
||||||
}
|
}
|
||||||
@@ -175,12 +172,13 @@ namespace GeekDesk.Control.Windows
|
|||||||
int h = minutes / 60;
|
int h = minutes / 60;
|
||||||
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + h + " 小时零 " + m + " 分钟后提醒您!");
|
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + h + " 小时零 " + m + " 分钟后提醒您!");
|
||||||
|
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + minutes + " 分钟后提醒您!");
|
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + minutes + " 分钟后提醒您!");
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +200,8 @@ namespace GeekDesk.Control.Windows
|
|||||||
{
|
{
|
||||||
window = new ToDoInfoWindow();
|
window = new ToDoInfoWindow();
|
||||||
window.Show();
|
window.Show();
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
window.Close();
|
window.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,8 +78,12 @@
|
|||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
</hc:SideMenu>
|
</hc:SideMenu>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
<hc:Card Grid.Row="0" MouseDown="DragMove" Background="Transparent" BorderThickness="0" Grid.Column="1" x:Name="RightCard" Height="450">
|
<UniformGrid x:Name="UFG" Grid.Column="1" Grid.Row="0">
|
||||||
</hc:Card>
|
<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">
|
||||||
|
<hc:Card x:Name="RightCard" VerticalAlignment="Top" MouseDown="DragMove" Background="Transparent" BorderThickness="0" Height="410"/>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
</UniformGrid>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<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 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"/>
|
||||||
@@ -87,8 +91,8 @@
|
|||||||
Panel.ZIndex="1"
|
Panel.ZIndex="1"
|
||||||
Style="{StaticResource Btn1}"
|
Style="{StaticResource Btn1}"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="590.01,29,10,384"
|
Margin="669,400,0,0"
|
||||||
Click="CreateBacklog_BtnClick"/>
|
Click="CreateBacklog_BtnClick" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -2,20 +2,8 @@
|
|||||||
using GeekDesk.Interface;
|
using GeekDesk.Interface;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.Windows
|
namespace GeekDesk.Control.Windows
|
||||||
{
|
{
|
||||||
@@ -31,7 +19,18 @@ namespace GeekDesk.Control.Windows
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
RightCard.Content = backlog;
|
RightCard.Content = backlog;
|
||||||
backlog.BacklogList.ItemsSource = appData.ToDoList;
|
backlog.BacklogList.ItemsSource = appData.ToDoList;
|
||||||
|
backlog.type = ToDoType.NEW;
|
||||||
this.Topmost = true;
|
this.Topmost = true;
|
||||||
|
if (backlog.BacklogList.Items.Count > 0)
|
||||||
|
{
|
||||||
|
backlog.NoData.Visibility = Visibility.Collapsed;
|
||||||
|
backlog.BacklogList.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
backlog.NoData.Visibility = Visibility.Visible;
|
||||||
|
backlog.BacklogList.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -64,12 +63,37 @@ namespace GeekDesk.Control.Windows
|
|||||||
switch (smi.Tag.ToString())
|
switch (smi.Tag.ToString())
|
||||||
{
|
{
|
||||||
case "History":
|
case "History":
|
||||||
|
UFG.Visibility = Visibility.Collapsed;
|
||||||
backlog.BacklogList.ItemsSource = appData.HiToDoList;
|
backlog.BacklogList.ItemsSource = appData.HiToDoList;
|
||||||
|
if (backlog.BacklogList.Items.Count > 0)
|
||||||
|
{
|
||||||
|
backlog.NoData.Visibility = Visibility.Collapsed;
|
||||||
|
backlog.BacklogList.Visibility = Visibility.Visible;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
backlog.NoData.Visibility = Visibility.Visible;
|
||||||
|
backlog.BacklogList.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
backlog.type = ToDoType.HISTORY;
|
backlog.type = ToDoType.HISTORY;
|
||||||
|
backlog.IsNewToDo.Text = "N";
|
||||||
|
UFG.Visibility = Visibility.Visible;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
UFG.Visibility = Visibility.Collapsed;
|
||||||
backlog.BacklogList.ItemsSource = appData.ToDoList;
|
backlog.BacklogList.ItemsSource = appData.ToDoList;
|
||||||
|
if (backlog.BacklogList.Items.Count > 0)
|
||||||
|
{
|
||||||
|
backlog.NoData.Visibility = Visibility.Collapsed;
|
||||||
|
backlog.BacklogList.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
backlog.NoData.Visibility = Visibility.Visible;
|
||||||
|
backlog.BacklogList.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
backlog.type = ToDoType.NEW;
|
backlog.type = ToDoType.NEW;
|
||||||
|
backlog.IsNewToDo.Text = "Y";
|
||||||
|
UFG.Visibility = Visibility.Visible;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,6 +122,21 @@ namespace GeekDesk.Control.Windows
|
|||||||
Keyboard.Focus(window);
|
Keyboard.Focus(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ShowOrHide()
|
||||||
|
{
|
||||||
|
if (window == null || !window.Activate())
|
||||||
|
{
|
||||||
|
window = new ToDoWindow();
|
||||||
|
window.Show();
|
||||||
|
Keyboard.Focus(window);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Key == Key.Escape)
|
if (e.Key == Key.Escape)
|
||||||
|
|||||||
@@ -22,16 +22,24 @@
|
|||||||
<StackPanel HorizontalAlignment="Center">
|
<StackPanel HorizontalAlignment="Center">
|
||||||
<hc:Card BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="20,20,20,0">
|
<hc:Card BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="20,20,20,0">
|
||||||
<!--Card 的内容部分-->
|
<!--Card 的内容部分-->
|
||||||
<Border CornerRadius="4,4,0,0" Height="260">
|
<Border CornerRadius="4,4,0,0">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
|
<hc:SimplePanel VerticalAlignment="Center">
|
||||||
<StackPanel x:Name="MsgPanel">
|
<TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
|
||||||
<hc:ScrollViewer x:Name="MsgBar" HorizontalScrollBarVisibility="Visible" IsInertiaEnabled="True" Margin="10" Width="430">
|
<Button HorizontalAlignment="Right" Margin="0,0,10,0"
|
||||||
<TextBlock Width="430" FontSize="15" LineHeight="22" x:Name="Msg" TextWrapping="Wrap" VerticalAlignment="Center" Text="测试"/>
|
Content="去点个Star" Click="StarBtnClick"
|
||||||
|
Style="{StaticResource Btn1}"
|
||||||
|
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>
|
||||||
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Margin="20,0,20,0"/>
|
||||||
|
<hc:ScrollViewer BorderThickness="0" Margin="0,5,1,5" Height="225">
|
||||||
|
<StackPanel x:Name="MsgPanel">
|
||||||
|
<TextBlock Width="430" FontSize="15" LineHeight="25" x:Name="Msg" TextWrapping="Wrap" VerticalAlignment="Center" Text="测试"/>
|
||||||
|
</StackPanel>
|
||||||
</hc:ScrollViewer>
|
</hc:ScrollViewer>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</Border>
|
||||||
</Border>
|
|
||||||
<!--Card 的尾部部分-->
|
<!--Card 的尾部部分-->
|
||||||
<hc:Card.Footer>
|
<hc:Card.Footer>
|
||||||
<StackPanel Margin="10" Width="520">
|
<StackPanel Margin="10" Width="520">
|
||||||
@@ -47,7 +55,7 @@
|
|||||||
</hc:Card.Footer>
|
</hc:Card.Footer>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
<hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
|
<hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
|
||||||
<Button Content="暂不更新" Click="Close_Click" />
|
<Button Content="暂不更新" Click="Close_Click" Style="{StaticResource Btn1}"/>
|
||||||
<Button Content="前往更新" Click="Confirm_Click" Style="{StaticResource Btn1}"/>
|
<Button Content="前往更新" Click="Confirm_Click" Style="{StaticResource Btn1}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -4,20 +4,11 @@ using GeekDesk.Util;
|
|||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Net;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.Windows
|
namespace GeekDesk.Control.Windows
|
||||||
{
|
{
|
||||||
@@ -42,7 +33,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -68,7 +59,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
githubUrl = StringUtil.IsEmpty(jo["githubUrl"]) ? ConfigurationManager.AppSettings["GitHubUrl"] : jo["githubUrl"].ToString();
|
githubUrl = StringUtil.IsEmpty(jo["githubUrl"]) ? ConfigurationManager.AppSettings["GitHubUrl"] : jo["githubUrl"].ToString();
|
||||||
giteeUrl = StringUtil.IsEmpty(jo["giteeUrl"]) ? ConfigurationManager.AppSettings["GiteeUrl"] : jo["giteeUrl"].ToString();
|
giteeUrl = StringUtil.IsEmpty(jo["giteeUrl"]) ? ConfigurationManager.AppSettings["GiteeUrl"] : jo["giteeUrl"].ToString();
|
||||||
string msg = "";
|
string msg = "";
|
||||||
for (int i=0; i<ja.Count; i++)
|
for (int i = 0; i < ja.Count; i++)
|
||||||
{
|
{
|
||||||
msg += "• " + ja[i].ToString() + "\n";
|
msg += "• " + ja[i].ToString() + "\n";
|
||||||
}
|
}
|
||||||
@@ -92,7 +83,11 @@ namespace GeekDesk.Control.Windows
|
|||||||
packageUrl = giteeUrl;
|
packageUrl = giteeUrl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Process.Start(packageUrl);
|
Process.Start(new ProcessStartInfo("cmd", $"/c start {packageUrl}")
|
||||||
|
{
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true
|
||||||
|
});
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +99,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
window = new UpdateWindow(jo);
|
window = new UpdateWindow(jo);
|
||||||
}
|
}
|
||||||
window.Show();
|
window.Show();
|
||||||
|
window.Activate();
|
||||||
Keyboard.Focus(window);
|
Keyboard.Focus(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,5 +111,59 @@ namespace GeekDesk.Control.Windows
|
|||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void StarBtnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
string githubUrl = ConfigurationManager.AppSettings["GitHubUrl"];
|
||||||
|
string giteeUrl = ConfigurationManager.AppSettings["GiteeUrl"];
|
||||||
|
|
||||||
|
if(!ReqGitUrl(githubUrl))
|
||||||
|
{
|
||||||
|
if (!ReqGitUrl(giteeUrl))
|
||||||
|
{
|
||||||
|
OpenLinkUrl(githubUrl);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
OpenLinkUrl(giteeUrl);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
OpenLinkUrl(githubUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private bool ReqGitUrl(String url)
|
||||||
|
{
|
||||||
|
HttpWebResponse myResponse = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ServicePointManager.Expect100Continue = true;
|
||||||
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||||
|
//创建Web访问对 象
|
||||||
|
WebRequest myRequest = WebRequest.Create(url);
|
||||||
|
|
||||||
|
myRequest.ContentType = "text/plain; charset=utf-8";
|
||||||
|
//通过Web访问对象获取响应内容
|
||||||
|
myResponse = (HttpWebResponse)myRequest.GetResponse();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return myResponse != null && myResponse.StatusCode == HttpStatusCode.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OpenLinkUrl(String url)
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo("cmd", $"/c start {url}")
|
||||||
|
{
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
25
Converts/BGStyleConvert.cs
Normal file
25
Converts/BGStyleConvert.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
class BGStyleConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return (BGStyle)value == (BGStyle)int.Parse(parameter.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
bool isChecked = (bool)value;
|
||||||
|
if (!isChecked)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (BGStyle)int.Parse(parameter.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
43
Converts/Count2VisibleConvert.cs
Normal file
43
Converts/Count2VisibleConvert.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
public class Count2VisibleConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null) return Visibility.Collapsed;
|
||||||
|
int count = (int)value;
|
||||||
|
|
||||||
|
if (parameter == null || "Y".Equals(parameter.ToString()))
|
||||||
|
{
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
Converts/CountGreZero2BoolConvert.cs
Normal file
28
Converts/CountGreZero2BoolConvert.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
public class CountGreZero2BoolConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null) return false;
|
||||||
|
int count = (int)value;
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
|||||||
40
Converts/GetWidthByWWConvert.cs
Normal file
40
Converts/GetWidthByWWConvert.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
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) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return config.WindowWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,11 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace GeekDesk.Converts
|
namespace GeekDesk.Converts
|
||||||
{
|
{
|
||||||
public class HideTypeConvert : IValueConverter
|
public class HideTypeConvert : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
@@ -14,12 +10,21 @@ namespace GeekDesk.Converts
|
|||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
int val = int.Parse(value.ToString());
|
int val = int.Parse(value.ToString());
|
||||||
|
var param = 0;
|
||||||
|
if (parameter != null)
|
||||||
|
{
|
||||||
|
param = int.Parse(parameter.ToString());
|
||||||
|
}
|
||||||
|
if (val + param > 0)
|
||||||
|
{
|
||||||
|
val += param;
|
||||||
|
}
|
||||||
return new CornerRadius(val);
|
return new CornerRadius(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
using GeekDesk.Constant;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace GeekDesk.Converts
|
namespace GeekDesk.Converts
|
||||||
{
|
{
|
||||||
public class MenuInfoConvert : IValueConverter
|
public class MenuInfoConvert : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
@@ -17,7 +12,8 @@ namespace GeekDesk.Converts
|
|||||||
if (menuIndex == -1)
|
if (menuIndex == -1)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
string type = parameter.ToString();
|
string type = parameter.ToString();
|
||||||
if ("1".Equals(type))
|
if ("1".Equals(type))
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace GeekDesk.Converts
|
namespace GeekDesk.Converts
|
||||||
|
|||||||
22
Converts/ReverseBoolConvert.cs
Normal file
22
Converts/ReverseBoolConvert.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
internal class ReverseBoolConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null) return null;
|
||||||
|
bool val = (bool)value;
|
||||||
|
return !val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Data;
|
|
||||||
|
|
||||||
namespace GeekDesk.Converts
|
|
||||||
{
|
|
||||||
class SearchResWidth : IValueConverter
|
|
||||||
{
|
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
string param = parameter as string;
|
|
||||||
if ("1".Equals(param))
|
|
||||||
{
|
|
||||||
double menuLeftWidth = double.Parse(value.ToString());
|
|
||||||
return MainWindow.mainWindow.Width - menuLeftWidth;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
double menuLeftWidth = double.Parse(value.ToString());
|
|
||||||
return (MainWindow.mainWindow.Width - menuLeftWidth) / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
25
Converts/SearchTypeConvert.cs
Normal file
25
Converts/SearchTypeConvert.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
public class SearchTypeConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return (SearchType)value == (SearchType)int.Parse(parameter.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
bool isChecked = (bool)value;
|
||||||
|
if (!isChecked)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (SearchType)int.Parse(parameter.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace GeekDesk.Converts
|
namespace GeekDesk.Converts
|
||||||
|
|||||||
39
Converts/StringAppendConvert.cs
Normal file
39
Converts/StringAppendConvert.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
class StringAppendConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
|
if (parameter == null)
|
||||||
|
{
|
||||||
|
return value.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string val = value.ToString();
|
||||||
|
if (string.IsNullOrEmpty(val))
|
||||||
|
{
|
||||||
|
return parameter.ToString()
|
||||||
|
.Replace("\\n", "")
|
||||||
|
.Replace("{}", "");
|
||||||
|
}
|
||||||
|
string param = parameter.ToString();
|
||||||
|
param = param.Replace("\\n", "\n");
|
||||||
|
return param.Replace("{}", val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,11 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace GeekDesk.Converts
|
namespace GeekDesk.Converts
|
||||||
{
|
{
|
||||||
public class TodoTaskExecConvert : IValueConverter
|
public class TodoTaskExecConvert : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace GeekDesk.Converts
|
namespace GeekDesk.Converts
|
||||||
|
|||||||
34
Converts/Visibility2BooleanConverter.cs
Normal file
34
Converts/Visibility2BooleanConverter.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
internal class Visibility2BooleanConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if ((Visibility)value == Visibility.Visible)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if ((bool)value)
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@ namespace DraggAnimatedPanel
|
|||||||
#endregion
|
#endregion
|
||||||
static DraggAnimatedPanel()
|
static DraggAnimatedPanel()
|
||||||
{
|
{
|
||||||
|
|
||||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(DraggAnimatedPanel), new FrameworkPropertyMetadata(typeof(DraggAnimatedPanel)));
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DraggAnimatedPanel), new FrameworkPropertyMetadata(typeof(DraggAnimatedPanel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
175
GeekDesk.csproj
175
GeekDesk.csproj
@@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props" Condition="Exists('packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props')" />
|
||||||
|
<Import Project="packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props" Condition="Exists('packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props')" />
|
||||||
|
<Import Project="packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props" Condition="Exists('packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -15,6 +18,23 @@
|
|||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
<PublishUrl>publish\</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -29,17 +49,20 @@
|
|||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>bin\GeekDesk\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<StartupObject>GeekDesk.App</StartupObject>
|
<StartupObject>
|
||||||
|
</StartupObject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SignManifests>false</SignManifests>
|
<SignManifests>false</SignManifests>
|
||||||
@@ -53,6 +76,9 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GenerateManifests>false</GenerateManifests>
|
<GenerateManifests>false</GenerateManifests>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="CommonServiceLocator, Version=2.0.6.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
<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>
|
<HintPath>packages\CommonServiceLocator.2.0.6\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||||
@@ -63,9 +89,6 @@
|
|||||||
<Reference Include="HandyControl, Version=3.3.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
|
<Reference Include="HandyControl, Version=3.3.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\HandyControl.3.3.0\lib\net472\HandyControl.dll</HintPath>
|
<HintPath>packages\HandyControl.3.3.0\lib\net472\HandyControl.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="KeyMouseHook, Version=1.0.6.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>packages\KeyMouseHook.1.0.6\lib\net40\KeyMouseHook.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -91,6 +114,7 @@
|
|||||||
<Reference Include="System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<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>
|
<HintPath>packages\System.Drawing.Common.6.0.0-preview.6.21352.12\lib\net461\System.Drawing.Common.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Management" />
|
||||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<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>
|
<HintPath>packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -98,12 +122,19 @@
|
|||||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive, Version=5.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Reactive.5.0.0\lib\net472\System.Reactive.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Runtime.Remoting" />
|
<Reference Include="System.Runtime.Remoting" />
|
||||||
|
<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>
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Web.Extensions" />
|
<Reference Include="System.Web.Extensions" />
|
||||||
|
<Reference Include="System.Windows" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@@ -117,6 +148,9 @@
|
|||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="XamlFlair.WPF, Version=1.2.13.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\XamlFlair.WPF.1.2.13\lib\net472\XamlFlair.WPF.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ApplicationDefinition Include="App.xaml">
|
<ApplicationDefinition Include="App.xaml">
|
||||||
@@ -127,19 +161,36 @@
|
|||||||
<Compile Include="Command\DelegateCommandBase.cs" />
|
<Compile Include="Command\DelegateCommandBase.cs" />
|
||||||
<Compile Include="Constant\AppHideType.cs" />
|
<Compile Include="Constant\AppHideType.cs" />
|
||||||
<Compile Include="Constant\Constants.cs" />
|
<Compile Include="Constant\Constants.cs" />
|
||||||
|
<Compile Include="Constant\HotKeyType.cs" />
|
||||||
<Compile Include="Constant\IconType.cs" />
|
<Compile Include="Constant\IconType.cs" />
|
||||||
<Compile Include="Constant\CommonEnum.cs" />
|
<Compile Include="Constant\CommonEnum.cs" />
|
||||||
<Compile Include="Constant\IconStartType.cs" />
|
<Compile Include="Constant\IconStartType.cs" />
|
||||||
|
<Compile Include="Constant\PasswordType.cs" />
|
||||||
<Compile Include="Constant\RunTimeStatus.cs" />
|
<Compile Include="Constant\RunTimeStatus.cs" />
|
||||||
|
<Compile Include="Constant\SearchType.cs" />
|
||||||
<Compile Include="Constant\SortType.cs" />
|
<Compile Include="Constant\SortType.cs" />
|
||||||
<Compile Include="Constant\TodoTaskExecType.cs" />
|
<Compile Include="Constant\TodoTaskExecType.cs" />
|
||||||
|
<Compile Include="Constant\BGStyle.cs" />
|
||||||
<Compile Include="Constant\UpdateType.cs" />
|
<Compile Include="Constant\UpdateType.cs" />
|
||||||
|
<Compile Include="Constant\WidthTypeEnum.cs" />
|
||||||
|
<Compile Include="Control\Other\GlobalMsgNotification.xaml.cs">
|
||||||
|
<DependentUpon>GlobalMsgNotification.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Control\Other\BacklogNotificatin.xaml.cs">
|
<Compile Include="Control\Other\BacklogNotificatin.xaml.cs">
|
||||||
<DependentUpon>BacklogNotificatin.xaml</DependentUpon>
|
<DependentUpon>BacklogNotificatin.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Control\Other\CustomIconUrlDialog.xaml.cs">
|
<Compile Include="Control\Other\CustomIconUrlDialog.xaml.cs">
|
||||||
<DependentUpon>CustomIconUrlDialog.xaml</DependentUpon>
|
<DependentUpon>CustomIconUrlDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Control\Other\GradientBGDialog.xaml.cs">
|
||||||
|
<DependentUpon>GradientBGDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Control\Other\PasswordDialog.xaml.cs">
|
||||||
|
<DependentUpon>PasswordDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Control\Other\MyColorPickerDialog.xaml.cs">
|
||||||
|
<DependentUpon>MyColorPickerDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Control\Other\IconInfoUrlDialog.xaml.cs">
|
<Compile Include="Control\Other\IconInfoUrlDialog.xaml.cs">
|
||||||
<DependentUpon>IconInfoUrlDialog.xaml</DependentUpon>
|
<DependentUpon>IconInfoUrlDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -155,6 +206,12 @@
|
|||||||
<Compile Include="Control\UserControls\IconFont\IconPannel.xaml.cs">
|
<Compile Include="Control\UserControls\IconFont\IconPannel.xaml.cs">
|
||||||
<DependentUpon>IconPannel.xaml</DependentUpon>
|
<DependentUpon>IconPannel.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Control\Windows\GlobalColorPickerWindow.xaml.cs">
|
||||||
|
<DependentUpon>GlobalColorPickerWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Control\Windows\PixelColorPickerWindow.xaml.cs">
|
||||||
|
<DependentUpon>PixelColorPickerWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Control\Windows\SystemItemWindow.xaml.cs">
|
<Compile Include="Control\Windows\SystemItemWindow.xaml.cs">
|
||||||
<DependentUpon>SystemItemWindow.xaml</DependentUpon>
|
<DependentUpon>SystemItemWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -191,45 +248,78 @@
|
|||||||
<Compile Include="Control\Windows\UpdateWindow.xaml.cs">
|
<Compile Include="Control\Windows\UpdateWindow.xaml.cs">
|
||||||
<DependentUpon>UpdateWindow.xaml</DependentUpon>
|
<DependentUpon>UpdateWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Converts\CountGreZero2BoolConvert.cs" />
|
||||||
|
<Compile Include="Converts\Count2VisibleConvert.cs" />
|
||||||
|
<Compile Include="Converts\SearchTypeConvert.cs" />
|
||||||
|
<Compile Include="Converts\StringAppendConvert.cs" />
|
||||||
<Compile Include="Converts\DoubleToGridLength.cs" />
|
<Compile Include="Converts\DoubleToGridLength.cs" />
|
||||||
<Compile Include="Converts\MenuInfoConvert.cs" />
|
<Compile Include="Converts\MenuInfoConvert.cs" />
|
||||||
<Compile Include="Converts\SearchResWidth.cs" />
|
<Compile Include="Converts\GetWidthByWWConvert.cs" />
|
||||||
<Compile Include="Converts\SortTypeConvert.cs" />
|
<Compile Include="Converts\SortTypeConvert.cs" />
|
||||||
<Compile Include="Converts\TodoTaskExecConvert.cs" />
|
<Compile Include="Converts\TodoTaskExecConvert.cs" />
|
||||||
<Compile Include="Converts\IntToCornerRadius.cs" />
|
<Compile Include="Converts\IntToCornerRadius.cs" />
|
||||||
<Compile Include="Converts\OpcityConvert.cs" />
|
<Compile Include="Converts\OpcityConvert.cs" />
|
||||||
|
<Compile Include="Converts\BGStyleConvert.cs" />
|
||||||
<Compile Include="Converts\UpdateTypeConvert.cs" />
|
<Compile Include="Converts\UpdateTypeConvert.cs" />
|
||||||
|
<Compile Include="Converts\ReverseBoolConvert.cs" />
|
||||||
|
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
|
||||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
||||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
||||||
<Compile Include="Converts\HideTypeConvert.cs" />
|
<Compile Include="Converts\HideTypeConvert.cs" />
|
||||||
<Compile Include="Interface\IWindowCommon.cs" />
|
<Compile Include="Interface\IWindowCommon.cs" />
|
||||||
|
<Compile Include="MyThread\RelativePathThread.cs" />
|
||||||
|
<Compile Include="Plugins\ShowSeconds\ViewModel\SecondsDataContext.cs" />
|
||||||
|
<Compile Include="Plugins\ShowSeconds\SecondsWindow.xaml.cs">
|
||||||
|
<DependentUpon>SecondsWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Task\ToDoTask.cs" />
|
<Compile Include="Task\ToDoTask.cs" />
|
||||||
<Compile Include="MyThread\MouseHookThread.cs" />
|
<Compile Include="MyThread\MouseHookThread.cs" />
|
||||||
<Compile Include="MyThread\DispatcherBuild.cs" />
|
<Compile Include="MyThread\DispatcherBuild.cs" />
|
||||||
<Compile Include="MyThread\UpdateThread.cs" />
|
<Compile Include="MyThread\UpdateThread.cs" />
|
||||||
<Compile Include="Util\AeroGlassHelper.cs" />
|
<Compile Include="Util\AeroGlassHelper.cs" />
|
||||||
|
<Compile Include="Util\BGSettingUtil.cs" />
|
||||||
|
<Compile Include="Util\BlurGlassUtil.cs" />
|
||||||
|
<Compile Include="Util\ColorUtil.cs" />
|
||||||
|
<Compile Include="Util\DragAdorner.cs" />
|
||||||
<Compile Include="Util\GlobalHotKey.cs" />
|
<Compile Include="Util\GlobalHotKey.cs" />
|
||||||
<Compile Include="Util\CommonCode.cs" />
|
<Compile Include="Util\CommonCode.cs" />
|
||||||
<Compile Include="Util\FileIcon.cs" />
|
<Compile Include="Util\FileIcon.cs" />
|
||||||
<Compile Include="Util\FileUtil.cs" />
|
<Compile Include="Util\FileUtil.cs" />
|
||||||
|
<Compile Include="Util\HideWindowUtil.cs" />
|
||||||
|
<Compile Include="Util\KeyUtil.cs" />
|
||||||
|
<Compile Include="Util\ListBoxDragDropManager.cs" />
|
||||||
<Compile Include="Util\LogUtil.cs" />
|
<Compile Include="Util\LogUtil.cs" />
|
||||||
<Compile Include="Util\MarginHide.cs" />
|
<Compile Include="Util\MarginHide.cs" />
|
||||||
<Compile Include="Util\HttpUtil.cs" />
|
<Compile Include="Util\HttpUtil.cs" />
|
||||||
<Compile Include="Util\ImageUtil.cs" />
|
<Compile Include="Util\ImageUtil.cs" />
|
||||||
<Compile Include="Converts\MenuWidthConvert.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\MouseUtil.cs" />
|
||||||
<Compile Include="Util\RegisterUtil.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\ShellContextMenu.cs" />
|
||||||
<Compile Include="Util\ShowWindowFollowMouse.cs" />
|
<Compile Include="Util\ShowWindowFollowMouse.cs" />
|
||||||
<Compile Include="Util\StringUtil.cs" />
|
<Compile Include="Util\StringUtil.cs" />
|
||||||
<Compile Include="Util\SvgToGeometry.cs" />
|
<Compile Include="Util\SvgToGeometry.cs" />
|
||||||
|
<Compile Include="Util\UserActivityHook.cs" />
|
||||||
<Compile Include="ViewModel\AppConfig.cs" />
|
<Compile Include="ViewModel\AppConfig.cs" />
|
||||||
<Compile Include="ViewModel\AppData.cs" />
|
<Compile Include="ViewModel\AppData.cs" />
|
||||||
|
<Compile Include="ViewModel\GradientBGParam.cs" />
|
||||||
|
<Compile Include="ViewModel\CPDataContext.cs" />
|
||||||
|
<Compile Include="ViewModel\Temp\GradientBGParamList.cs" />
|
||||||
<Compile Include="ViewModel\Temp\SearchIconList.cs" />
|
<Compile Include="ViewModel\Temp\SearchIconList.cs" />
|
||||||
<Compile Include="ViewModel\ToDoInfo.cs" />
|
<Compile Include="ViewModel\ToDoInfo.cs" />
|
||||||
<Compile Include="ViewModel\IconfontInfo.cs" />
|
<Compile Include="ViewModel\IconfontInfo.cs" />
|
||||||
<Compile Include="ViewModel\IconInfo.cs" />
|
<Compile Include="ViewModel\IconInfo.cs" />
|
||||||
<Compile Include="ViewModel\MenuInfo.cs" />
|
<Compile Include="ViewModel\MenuInfo.cs" />
|
||||||
|
<Page Include="Control\Other\GlobalMsgNotification.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Control\Other\BacklogNotificatin.xaml">
|
<Page Include="Control\Other\BacklogNotificatin.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -238,6 +328,18 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Control\Other\GradientBGDialog.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Control\Other\PasswordDialog.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Control\Other\MyColorPickerDialog.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Control\Other\IconInfoUrlDialog.xaml">
|
<Page Include="Control\Other\IconInfoUrlDialog.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@@ -258,6 +360,14 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Control\Windows\GlobalColorPickerWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Control\Windows\PixelColorPickerWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Control\Windows\SystemItemWindow.xaml">
|
<Page Include="Control\Windows\SystemItemWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@@ -318,6 +428,10 @@
|
|||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Page Include="Plugins\ShowSeconds\SecondsWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Resource\Dictionary\Geometry.xaml">
|
<Page Include="Resource\Dictionary\Geometry.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -326,6 +440,11 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Resource\Dictionary\XamlFlairSettings.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
@@ -346,6 +465,7 @@
|
|||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<Resource Include="Resource\Iconfont\iconfont.json" />
|
<Resource Include="Resource\Iconfont\iconfont.json" />
|
||||||
|
<None Include="app.manifest" />
|
||||||
<None Include="Properties\app.manifest" />
|
<None Include="Properties\app.manifest" />
|
||||||
<None Include="Update.json" />
|
<None Include="Update.json" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
@@ -402,5 +522,46 @@
|
|||||||
<Resource Include="Resource\Image\SystemIcon\RecycleBin.png" />
|
<Resource Include="Resource\Image\SystemIcon\RecycleBin.png" />
|
||||||
<Resource Include="Resource\Image\SystemIcon\Registry.png" />
|
<Resource Include="Resource\Image\SystemIcon\Registry.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<ProjectExtensions>
|
||||||
|
<VisualStudio>
|
||||||
|
<UserProperties update_1json__JsonSchema="https://beaujs.com/schema.json" />
|
||||||
|
</VisualStudio>
|
||||||
|
</ProjectExtensions>
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props'))" />
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets'))" />
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props'))" />
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets'))" />
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props'))" />
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets" Condition="Exists('packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets')" />
|
||||||
|
<Import Project="packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets" Condition="Exists('packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets')" />
|
||||||
|
<Import Project="packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets" Condition="Exists('packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
</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
|
||||||
|
if %25errorlevel%25 leq 4 exit 0 else exit %25errorlevel%25</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Blend for Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.30907.101
|
VisualStudioVersion = 17.1.32319.34
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeekDesk", "GeekDesk.csproj", "{B4983CEC-2281-413C-8ECF-92EE0E40A713}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeekDesk", "GeekDesk.csproj", "{B4983CEC-2281-413C-8ECF-92EE0E40A713}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
using System;
|
using System.Windows.Input;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
namespace GeekDesk.Interface
|
namespace GeekDesk.Interface
|
||||||
{
|
{
|
||||||
public interface IWindowCommon
|
public interface IWindowCommon
|
||||||
{
|
{
|
||||||
void OnKeyDown(object sender, KeyEventArgs e);
|
void OnKeyDown(object sender, KeyEventArgs e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
|
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
|
||||||
- 商用需联系作者
|
- 商用需联系作者
|
||||||
|
|||||||
158
MainWindow.xaml
158
MainWindow.xaml
@@ -4,73 +4,71 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
|
xmlns:cn="clr-namespace:GeekDesk.Constant"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||||
|
xmlns:local="clr-namespace:GeekDesk"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
x:Name="window"
|
x:Name="AppWindow"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
|
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
|
||||||
Title="GeekDesk"
|
d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
|
||||||
|
Title="GeekDesk_Main_8400A17AEEF7C029"
|
||||||
MinWidth="600"
|
MinWidth="600"
|
||||||
MinHeight="400"
|
MinHeight="400"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
Opacity="0"
|
Opacity="1"
|
||||||
Deactivated="App_LostFocus"
|
Deactivated="AppWindow_Deactivated"
|
||||||
SizeChanged="Window_SizeChanged"
|
SizeChanged="Window_SizeChanged"
|
||||||
KeyDown="OnKeyDown"
|
PreviewKeyDown="OnKeyDown"
|
||||||
Focusable="True"
|
Focusable="True"
|
||||||
MouseDown="MainWindow_MouseDown"
|
MouseDown="MainWindow_MouseDown"
|
||||||
MouseEnter="MainWindow_MouseEnter"
|
MouseEnter="MainWindow_MouseEnter"
|
||||||
|
GotFocus="Window_GotFocus"
|
||||||
|
Loaded="Window_Loaded"
|
||||||
>
|
>
|
||||||
<WindowChrome.WindowChrome>
|
|
||||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
|
|
||||||
</WindowChrome.WindowChrome>
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<RoutedUICommand x:Key="SearchItem" Text="SearchItem"/>
|
<RoutedUICommand x:Key="SearchHotKeyDown" Text="SearchHotKeyDown"/>
|
||||||
|
|
||||||
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
|
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
|
||||||
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
||||||
|
<cvt:ReverseBoolConvert x:Key="ReverseBoolConvert"/>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
|
||||||
|
<WindowChrome.WindowChrome>
|
||||||
|
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="15"/>
|
||||||
|
</WindowChrome.WindowChrome>
|
||||||
|
|
||||||
<Window.InputBindings>
|
<Window.InputBindings>
|
||||||
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchItem}"/>
|
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchHotKeyDown}"/>
|
||||||
</Window.InputBindings>
|
</Window.InputBindings>
|
||||||
<Window.CommandBindings>
|
<Window.CommandBindings>
|
||||||
<CommandBinding Command="{StaticResource SearchItem}" CanExecute="SearchItem"/>
|
<CommandBinding Command="{StaticResource SearchHotKeyDown}" CanExecute="SearchHotKeyDown"/>
|
||||||
</Window.CommandBindings>
|
</Window.CommandBindings>
|
||||||
|
|
||||||
<Window.Effect>
|
<!--Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"-->
|
||||||
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
|
||||||
RenderingBias="Quality" ShadowDepth="2"/>
|
BorderThickness="0"
|
||||||
</Window.Effect>
|
|
||||||
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
|
|
||||||
Background="AliceBlue"
|
|
||||||
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
|
|
||||||
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True"
|
|
||||||
hc:Dialog.Token="IconInfoDialog"
|
|
||||||
Focusable="True"
|
Focusable="True"
|
||||||
|
x:Name="BGBorder"
|
||||||
|
hc:Dialog.Token="MainWindowDialog"
|
||||||
|
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=None}"
|
||||||
|
xf:Animations.PrimaryBinding="{Binding AppConfig.IsShow, Mode=OneWay}"
|
||||||
|
xf:Animations.Secondary="{xf:Animate BasedOn={StaticResource FadeOut}, Event=None}"
|
||||||
|
xf:Animations.SecondaryBinding="{Binding AppConfig.IsShow, Mode=OneWay, Converter={StaticResource ReverseBoolConvert}}"
|
||||||
|
xf:Animations.SecondaryCompletionCommand="{Binding HideCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
|
||||||
|
xf:Animations.AllowOpacityReset="False"
|
||||||
>
|
>
|
||||||
<hc:DialogContainer Focusable="True">
|
<Border.Effect>
|
||||||
|
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||||
<Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0">
|
RenderingBias="Quality" ShadowDepth="2"/>
|
||||||
<!--背景图片-->
|
</Border.Effect>
|
||||||
<Border.Background>
|
<hc:DialogContainer Focusable="True">
|
||||||
<VisualBrush>
|
|
||||||
<VisualBrush.Visual>
|
|
||||||
<Grid ClipToBounds="True">
|
|
||||||
<Image Source="{Binding AppConfig.BitmapImage}" Margin="-30" Opacity="{Binding AppConfig.BgOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
|
||||||
<Image.Effect>
|
|
||||||
<BlurEffect Radius="{Binding AppConfig.BlurValue}"/>
|
|
||||||
</Image.Effect>
|
|
||||||
</Image>
|
|
||||||
</Grid>
|
|
||||||
</VisualBrush.Visual>
|
|
||||||
</VisualBrush>
|
|
||||||
</Border.Background>
|
|
||||||
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
||||||
@@ -81,15 +79,16 @@
|
|||||||
<ColumnDefinition x:Name="RightColumn" Width="*"></ColumnDefinition>
|
<ColumnDefinition x:Name="RightColumn" Width="*"></ColumnDefinition>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<!--获取焦点用-->
|
<CheckBox x:Name="ShowBox" Visibility="Hidden" Panel.ZIndex="2"/>
|
||||||
<TextBox x:Name="EmptyTextBox" Width="0"/>
|
<CheckBox 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"/>
|
||||||
|
|
||||||
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
||||||
<DockPanel.Background>
|
<DockPanel.Background>
|
||||||
<SolidColorBrush Opacity="0.01"/>
|
<SolidColorBrush Opacity="0.01"/>
|
||||||
</DockPanel.Background>
|
</DockPanel.Background>
|
||||||
<Image 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" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
|
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
|
||||||
@@ -98,38 +97,39 @@
|
|||||||
</DockPanel.Background>
|
</DockPanel.Background>
|
||||||
<hc:UniformSpacingPanel Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
|
<hc:UniformSpacingPanel Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
BorderThickness="0"
|
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"
|
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"
|
||||||
hc:IconElement.Height="18"
|
hc:IconElement.Height="18"
|
||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Click="ConfigButtonClick"
|
Click="ConfigButtonClick"
|
||||||
Initialized="SettingButton_Initialized"
|
Initialized="SettingButton_Initialized"
|
||||||
x:Name="SettingButton"
|
PreviewMouseLeftButtonDown="AppButton_PreviewMouseLeftButtonDown"
|
||||||
FocusVisualStyle="{x:Null}"
|
x:Name="SettingButton"
|
||||||
>
|
FocusVisualStyle="{x:Null}"
|
||||||
<Button.ContextMenu>
|
>
|
||||||
<ContextMenu x:Name="SettingMenus" Width="130">
|
<Button.ContextMenu>
|
||||||
<MenuItem Header="设置" Click="ConfigMenuClick"/>
|
<ContextMenu x:Name="SettingMenus" Width="130">
|
||||||
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
<MenuItem Header="设置" Click="ConfigMenuClick"/>
|
||||||
</ContextMenu>
|
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
||||||
</Button.ContextMenu>
|
</ContextMenu>
|
||||||
|
</Button.ContextMenu>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
hc:IconElement.Geometry="M828.770654 148.714771C641.293737-20.89959 354.184117-19.590868 168.245698 152.630946c-212.062907 196.418185-212.062907 522.329912 0 718.748098 185.93842 172.221815 473.048039 173.520546 660.524956 3.916176 219.435707-198.536117 219.435707-528.054322 0-726.580449z m-121.880976 569.643707c-11.708566 11.708566-30.680039 11.708566-42.388605 0L502.729054 556.586459c-0.659356-0.659356-1.728312-0.659356-2.397659 0L338.609327 718.318517c-11.708566 11.708566-30.680039 11.708566-42.388605 0l-0.039961-0.039961c-11.708566-11.708566-11.708566-30.680039 0-42.388605l161.732059-161.732058c0.659356-0.659356 0.659356-1.728312 0-2.397659L296.1408 350.008195c-11.708566-11.708566-11.708566-30.680039 0-42.388605l0.039961-0.039961c11.708566-11.708566 30.680039-11.708566 42.388605 0l161.772019 161.77202c0.659356 0.659356 1.728312 0.659356 2.397659 0L664.551024 307.539668c11.708566-11.708566 30.680039-11.708566 42.388605 0l0.039961 0.039961c11.708566 11.708566 11.708566 30.680039 0 42.388605L545.15762 511.770224c-0.659356 0.659356-0.659356 1.728312 0 2.397659L706.919649 675.939902c11.708566 11.708566 11.708566 30.680039 0 42.388605l-0.029971 0.029971z"
|
hc:IconElement.Geometry="M828.770654 148.714771C641.293737-20.89959 354.184117-19.590868 168.245698 152.630946c-212.062907 196.418185-212.062907 522.329912 0 718.748098 185.93842 172.221815 473.048039 173.520546 660.524956 3.916176 219.435707-198.536117 219.435707-528.054322 0-726.580449z m-121.880976 569.643707c-11.708566 11.708566-30.680039 11.708566-42.388605 0L502.729054 556.586459c-0.659356-0.659356-1.728312-0.659356-2.397659 0L338.609327 718.318517c-11.708566 11.708566-30.680039 11.708566-42.388605 0l-0.039961-0.039961c-11.708566-11.708566-11.708566-30.680039 0-42.388605l161.732059-161.732058c0.659356-0.659356 0.659356-1.728312 0-2.397659L296.1408 350.008195c-11.708566-11.708566-11.708566-30.680039 0-42.388605l0.039961-0.039961c11.708566-11.708566 30.680039-11.708566 42.388605 0l161.772019 161.77202c0.659356 0.659356 1.728312 0.659356 2.397659 0L664.551024 307.539668c11.708566-11.708566 30.680039-11.708566 42.388605 0l0.039961 0.039961c11.708566 11.708566 11.708566 30.680039 0 42.388605L545.15762 511.770224c-0.659356 0.659356-0.659356 1.728312 0 2.397659L706.919649 675.939902c11.708566 11.708566 11.708566 30.680039 0 42.388605l-0.029971 0.029971z"
|
||||||
hc:IconElement.Height="18"
|
hc:IconElement.Height="18"
|
||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Click="CloseButtonClick"
|
Click="CloseButtonClick"
|
||||||
FocusVisualStyle="{x:Null}"
|
PreviewMouseLeftButtonDown="AppButton_PreviewMouseLeftButtonDown"
|
||||||
/>
|
FocusVisualStyle="{x:Null}"
|
||||||
|
/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
|
|
||||||
<uc:LeftCardControl Grid.Row="1" Grid.Column="0"/>
|
<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="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
|
||||||
@@ -137,23 +137,22 @@
|
|||||||
<!--搜索输入框-->
|
<!--搜索输入框-->
|
||||||
<TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
|
<TextBox Panel.ZIndex="2" Grid.Row="0" Grid.Column="1"
|
||||||
x:Name="SearchBox"
|
x:Name="SearchBox"
|
||||||
Visibility="Collapsed"
|
Width="0"
|
||||||
Margin="-100,5,0,0"
|
Margin="-100,5,0,0"
|
||||||
Height="32"
|
Height="32"
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
Width="400"
|
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
TextChanged="SearchBox_TextChanged"
|
TextChanged="SearchBox_TextChanged"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
<uc:RightCardControl x:Name="RightCard" Grid.Row="1" Grid.Column="1"/>
|
<hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
|
||||||
|
Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">
|
||||||
<hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
|
|
||||||
Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">
|
|
||||||
<hc:NotifyIcon.ContextMenu>
|
<hc:NotifyIcon.ContextMenu>
|
||||||
<ContextMenu Width="130">
|
<ContextMenu Width="130" x:Name="TaskbarContextMenu">
|
||||||
<MenuItem Header="打开面板" Click="ShowApp"/>
|
<MenuItem Header="打开面板" Click="ShowApp"/>
|
||||||
|
<MenuItem Header="拾色器" Click="ColorPicker"/>
|
||||||
|
<MenuItem Header="备份" Click="BakDataFile"/>
|
||||||
<MenuItem Header="隐藏图标" Click="CloseBarIcon"/>
|
<MenuItem Header="隐藏图标" Click="CloseBarIcon"/>
|
||||||
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
||||||
<MenuItem Header="程序目录" Click="OpenThisDir"/>
|
<MenuItem Header="程序目录" Click="OpenThisDir"/>
|
||||||
@@ -162,12 +161,13 @@
|
|||||||
<MenuItem Header="退出" Click="ExitApp"/>
|
<MenuItem Header="退出" Click="ExitApp"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</hc:NotifyIcon.ContextMenu>
|
</hc:NotifyIcon.ContextMenu>
|
||||||
|
|
||||||
</hc:NotifyIcon>
|
</hc:NotifyIcon>
|
||||||
|
|
||||||
|
<uc:RightCardControl x:Name="RightCard" Grid.Row="1" Grid.Column="1"/>
|
||||||
|
|
||||||
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</hc:DialogContainer>
|
||||||
</hc:DialogContainer>
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,23 +1,27 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.Control.UserControls.Config;
|
using GeekDesk.Control.UserControls.Config;
|
||||||
|
using GeekDesk.Control.UserControls.PannelCard;
|
||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Control.Windows;
|
||||||
using GeekDesk.Interface;
|
using GeekDesk.Interface;
|
||||||
using GeekDesk.Task;
|
|
||||||
using GeekDesk.MyThread;
|
using GeekDesk.MyThread;
|
||||||
|
using GeekDesk.Task;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
using GeekDesk.ViewModel.Temp;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using NPinyin;
|
||||||
|
using ShowSeconds;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Windows.Threading;
|
||||||
using static GeekDesk.Util.ShowWindowFollowMouse;
|
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using NPinyin;
|
|
||||||
using GeekDesk.ViewModel.Temp;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace GeekDesk
|
namespace GeekDesk
|
||||||
{
|
{
|
||||||
@@ -32,17 +36,22 @@ namespace GeekDesk
|
|||||||
public static ToDoInfoWindow toDoInfoWindow;
|
public static ToDoInfoWindow toDoInfoWindow;
|
||||||
public static int hotKeyId = -1;
|
public static int hotKeyId = -1;
|
||||||
public static int toDoHotKeyId = -1;
|
public static int toDoHotKeyId = -1;
|
||||||
|
public static int colorPickerHotKeyId = -1;
|
||||||
public static MainWindow mainWindow;
|
public static MainWindow mainWindow;
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
|
//加载数据
|
||||||
LoadData();
|
LoadData();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
mainWindow = this;
|
|
||||||
this.Topmost = true;
|
|
||||||
this.Loaded += Window_Loaded;
|
|
||||||
this.SizeChanged += MainWindow_Resize;
|
|
||||||
ToDoTask.BackLogCheck();
|
|
||||||
|
|
||||||
|
//用于其他类访问
|
||||||
|
mainWindow = this;
|
||||||
|
|
||||||
|
//置于顶层
|
||||||
|
this.Topmost = true;
|
||||||
|
|
||||||
|
//执行待办提醒
|
||||||
|
ToDoTask.BackLogCheck();
|
||||||
|
|
||||||
////实例化隐藏 Hide类,进行时间timer设置
|
////实例化隐藏 Hide类,进行时间timer设置
|
||||||
MarginHide.ReadyHide(this);
|
MarginHide.ReadyHide(this);
|
||||||
@@ -50,18 +59,33 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
MarginHide.StartHide();
|
MarginHide.StartHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 搜索快捷键按下
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void SearchHotKeyDown(object sender, CanExecuteRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (appData.AppConfig.SearchType == SearchType.HOT_KEY)
|
||||||
|
{
|
||||||
|
ShowSearchBox();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示搜索框
|
/// 显示搜索框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
private void ShowSearchBox()
|
||||||
/// <param name="e"></param>
|
|
||||||
private void SearchItem(object sender, CanExecuteRoutedEventArgs e)
|
|
||||||
{
|
{
|
||||||
RunTimeStatus.SEARCH_BOX_SHOW = true;
|
RunTimeStatus.SEARCH_BOX_SHOW = true;
|
||||||
RightCard.VisibilitySearchCard(Visibility.Visible);
|
RightCard.VisibilitySearchCard(Visibility.Visible);
|
||||||
SearchBox.Visibility = Visibility.Visible;
|
SearchBox.Width = 400;
|
||||||
SearchBox.Focus();
|
SearchBox.Focus();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -71,7 +95,25 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
|
private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (!RunTimeStatus.SEARCH_BOX_SHOW
|
||||||
|
&& appData.AppConfig.SearchType != SearchType.KEY_DOWN
|
||||||
|
)
|
||||||
|
{
|
||||||
|
SearchBox.TextChanged -= SearchBox_TextChanged;
|
||||||
|
SearchBox.Clear();
|
||||||
|
SearchBox.TextChanged += SearchBox_TextChanged;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!RunTimeStatus.SEARCH_BOX_SHOW) ShowSearchBox();
|
||||||
|
|
||||||
|
//刷新搜索后 鼠标移动次数置为0
|
||||||
|
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
|
||||||
|
//隐藏popup
|
||||||
|
RightCard.MyPoptip.IsOpen = false;
|
||||||
|
|
||||||
string inputText = SearchBox.Text.ToLower();
|
string inputText = SearchBox.Text.ToLower();
|
||||||
|
RightCard.VerticalUFG.Visibility = Visibility.Collapsed;
|
||||||
if (!string.IsNullOrEmpty(inputText))
|
if (!string.IsNullOrEmpty(inputText))
|
||||||
{
|
{
|
||||||
SearchIconList.IconList.Clear();
|
SearchIconList.IconList.Clear();
|
||||||
@@ -93,15 +135,27 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
SearchIconList.IconList.Clear();
|
SearchIconList.IconList.Clear();
|
||||||
}
|
}
|
||||||
|
if (RightCard.SearchListBox.Items.Count > 0)
|
||||||
|
{
|
||||||
|
RightCard.SearchListBox.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
RightCard.VerticalUFG.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 隐藏搜索框
|
||||||
|
/// </summary>
|
||||||
public void HidedSearchBox()
|
public void HidedSearchBox()
|
||||||
{
|
{
|
||||||
RunTimeStatus.SEARCH_BOX_SHOW = false;
|
RunTimeStatus.SEARCH_BOX_SHOW = false;
|
||||||
SearchBox.Visibility = Visibility.Collapsed;
|
SearchBox.TextChanged -= SearchBox_TextChanged;
|
||||||
|
SearchBox.Clear();
|
||||||
|
SearchBox.TextChanged += SearchBox_TextChanged;
|
||||||
|
SearchBox.Width = 0;
|
||||||
SearchIconList.IconList.Clear();
|
SearchIconList.IconList.Clear();
|
||||||
RightCard.VisibilitySearchCard(Visibility.Collapsed);
|
RightCard.VisibilitySearchCard(Visibility.Collapsed);
|
||||||
SearchBox.Text = "";
|
Keyboard.Focus(SearchBox);
|
||||||
|
App.DoEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -110,7 +164,6 @@ namespace GeekDesk
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
GC.KeepAlive(appData); // 持活
|
|
||||||
this.DataContext = appData;
|
this.DataContext = appData;
|
||||||
if (appData.MenuList.Count == 0)
|
if (appData.MenuList.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -121,7 +174,6 @@ namespace GeekDesk
|
|||||||
this.Height = appData.AppConfig.WindowHeight;
|
this.Height = appData.AppConfig.WindowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 窗口加载完毕 执行方法
|
/// 窗口加载完毕 执行方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -129,28 +181,34 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
void Window_Loaded(object sender, RoutedEventArgs e)
|
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
SecondsWindow.ShowWindow();
|
||||||
|
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
if (!appData.AppConfig.StartedShowPanel)
|
if (!appData.AppConfig.StartedShowPanel)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.AppAnimation)
|
this.Visibility = Visibility.Collapsed;
|
||||||
{
|
|
||||||
this.Opacity = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.Visibility = Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowApp();
|
ShowApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
//给任务栏图标一个名字
|
//给任务栏图标一个名字
|
||||||
BarIcon.Text = Constants.MY_NAME;
|
BarIcon.Text = Constants.MY_NAME;
|
||||||
|
|
||||||
//注册热键
|
//注册热键
|
||||||
RegisterHotKey(true);
|
if (true == appData.AppConfig.EnableAppHotKey)
|
||||||
RegisterCreateToDoHotKey(true);
|
{
|
||||||
|
RegisterHotKey(true);
|
||||||
|
}
|
||||||
|
if (true == appData.AppConfig.EnableTodoHotKey)
|
||||||
|
{
|
||||||
|
RegisterCreateToDoHotKey(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (true == appData.AppConfig.EnableColorPickerHotKey)
|
||||||
|
{
|
||||||
|
RegisterColorPickerHotKey(true);
|
||||||
|
}
|
||||||
|
|
||||||
//注册自启动
|
//注册自启动
|
||||||
if (!appData.AppConfig.SelfStartUped && !Constants.DEV)
|
if (!appData.AppConfig.SelfStartUped && !Constants.DEV)
|
||||||
@@ -158,14 +216,23 @@ namespace GeekDesk
|
|||||||
RegisterUtil.SetSelfStarting(appData.AppConfig.SelfStartUp, Constants.MY_NAME);
|
RegisterUtil.SetSelfStarting(appData.AppConfig.SelfStartUp, Constants.MY_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
//注册鼠标中键监听事件
|
//注册鼠标监听事件
|
||||||
if (appData.AppConfig.MouseMiddleShow)
|
if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow==true)
|
||||||
{
|
{
|
||||||
MouseHookThread.MiddleHook();
|
MouseHookThread.Hook();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//更新线程开启 检测更新
|
//更新线程开启 检测更新
|
||||||
UpdateThread.Update();
|
UpdateThread.Update();
|
||||||
|
|
||||||
|
//建立相对路径
|
||||||
|
RelativePathThread.MakeRelativePath();
|
||||||
|
|
||||||
|
//毛玻璃 暂时未解决阴影问题
|
||||||
|
//BlurGlassUtil.EnableBlur(this);
|
||||||
|
|
||||||
|
MessageUtil.ChangeWindowMessageFilter(MessageUtil.WM_COPYDATA, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -175,9 +242,8 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.HotkeyModifiers != 0)
|
if (appData.AppConfig.HotkeyModifiers != GlobalHotKey.HotkeyModifiers.None)
|
||||||
{
|
{
|
||||||
|
|
||||||
hotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
|
hotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
|
||||||
{
|
{
|
||||||
if (MotionControl.hotkeyFinished)
|
if (MotionControl.hotkeyFinished)
|
||||||
@@ -192,10 +258,12 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
if (!first)
|
||||||
if (!first)
|
{
|
||||||
|
HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl");
|
||||||
|
}
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
@@ -222,21 +290,22 @@ namespace GeekDesk
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (appData.AppConfig.ToDoHotkeyModifiers != 0)
|
if (appData.AppConfig.HotkeyModifiers != GlobalHotKey.HotkeyModifiers.None)
|
||||||
{
|
{
|
||||||
//加载完毕注册热键
|
//加载完毕注册热键
|
||||||
toDoHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
|
toDoHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
|
||||||
{
|
{
|
||||||
if (MotionControl.hotkeyFinished)
|
if (MotionControl.hotkeyFinished)
|
||||||
{
|
{
|
||||||
ToDoInfoWindow.ShowOrHide();
|
ToDoWindow.ShowOrHide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (!first)
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.Success("新建待办任务快捷键注册成功(" + appData.AppConfig.ToDoHotkeyStr + ")!", "HotKeyGrowl");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!first)
|
|
||||||
{
|
|
||||||
HandyControl.Controls.Growl.Success("新建待办任务快捷键注册成功(" + appData.AppConfig.ToDoHotkeyStr + ")!", "HotKeyGrowl");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -251,24 +320,45 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置窗体大小 写入缓存
|
/// 注册新建待办的热键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
public static void RegisterColorPickerHotKey(bool first)
|
||||||
/// <param name="e"></param>
|
|
||||||
void MainWindow_Resize(object sender, System.EventArgs e)
|
|
||||||
{
|
{
|
||||||
if (this.DataContext != null)
|
try
|
||||||
{
|
{
|
||||||
AppData appData = this.DataContext as AppData;
|
if (appData.AppConfig.HotkeyModifiers != GlobalHotKey.HotkeyModifiers.None)
|
||||||
appData.AppConfig.WindowWidth = this.Width;
|
{
|
||||||
appData.AppConfig.WindowHeight = this.Height;
|
//加载完毕注册热键
|
||||||
|
colorPickerHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ColorPickerHotkeyModifiers, appData.AppConfig.ColorPickerHotkey, () =>
|
||||||
|
{
|
||||||
|
if (MotionControl.hotkeyFinished)
|
||||||
|
{
|
||||||
|
GlobalColorPickerWindow.CreateNoShow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!first)
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.Success("拾色器快捷键注册成功(" + appData.AppConfig.ColorPickerHotkeyStr + ")!", "HotKeyGrowl");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.WarningGlobal("拾色器快捷键已被其它程序占用(" + appData.AppConfig.ColorPickerHotkeyStr + ")!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.Warning("拾色器快捷键已被其它程序占用(" + appData.AppConfig.ColorPickerHotkeyStr + ")!", "HotKeyGrowl");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 程序窗体拖动
|
/// 程序窗体拖动
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -311,14 +401,7 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void CloseButtonClick(object sender, RoutedEventArgs e)
|
private void CloseButtonClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.AppAnimation)
|
HideApp();
|
||||||
{
|
|
||||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.Visibility = Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -352,9 +435,9 @@ namespace GeekDesk
|
|||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//修改贴边隐藏状态为未隐藏
|
|
||||||
if (MarginHide.ON_HIDE)
|
if (MarginHide.ON_HIDE)
|
||||||
{
|
{
|
||||||
|
//修改贴边隐藏状态为未隐藏
|
||||||
MarginHide.IS_HIDE = false;
|
MarginHide.IS_HIDE = false;
|
||||||
if (!CommonCode.MouseInWindow(mainWindow))
|
if (!CommonCode.MouseInWindow(mainWindow))
|
||||||
{
|
{
|
||||||
@@ -365,41 +448,72 @@ namespace GeekDesk
|
|||||||
|
|
||||||
if (appData.AppConfig.FollowMouse)
|
if (appData.AppConfig.FollowMouse)
|
||||||
{
|
{
|
||||||
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
|
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
MainWindow.mainWindow.Activate();
|
||||||
|
mainWindow.Show();
|
||||||
|
//mainWindow.Visibility = Visibility.Visible;
|
||||||
|
if (appData.AppConfig.AppAnimation)
|
||||||
|
{
|
||||||
|
appData.AppConfig.IsShow = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
appData.AppConfig.IsShow = null;
|
||||||
|
//防止永远不显示界面
|
||||||
|
if (mainWindow.Opacity < 1)
|
||||||
|
{
|
||||||
|
mainWindow.Opacity = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Keyboard.Focus(mainWindow.EmptyTextBox);
|
|
||||||
|
//FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
||||||
|
|
||||||
|
Keyboard.Focus(mainWindow);
|
||||||
|
if (RunTimeStatus.SHOW_MENU_PASSWORDBOX)
|
||||||
|
{
|
||||||
|
mainWindow.RightCard.PDDialog.SetFocus();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Keyboard.Focus(mainWindow.SearchBox);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void HideApp()
|
public static void HideApp()
|
||||||
{
|
{
|
||||||
if (!MarginHide.IS_HIDE)
|
if (appData.AppConfig.AppAnimation)
|
||||||
{
|
{
|
||||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
appData.AppConfig.IsShow = false;
|
||||||
{
|
}
|
||||||
mainWindow.HidedSearchBox();
|
else
|
||||||
new Thread(() =>
|
|
||||||
{
|
|
||||||
Thread.Sleep(100);
|
|
||||||
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
||||||
{
|
|
||||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
|
||||||
}));
|
|
||||||
}).Start();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
{
|
||||||
ShowApp();
|
appData.AppConfig.IsShow = null;
|
||||||
|
HideAppVis();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void HideAppVis()
|
||||||
|
{
|
||||||
|
//关闭锁定
|
||||||
|
RunTimeStatus.LOCK_APP_PANEL = false;
|
||||||
|
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||||
|
{
|
||||||
|
mainWindow.HidedSearchBox();
|
||||||
|
}
|
||||||
|
mainWindow.Visibility = Visibility.Collapsed;
|
||||||
|
//if (!MarginHide.IS_HIDE)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// ShowApp();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 淡入淡出效果
|
/// 淡入淡出效果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -529,10 +643,11 @@ namespace GeekDesk
|
|||||||
SettingButton.ContextMenu = null;
|
SettingButton.ContextMenu = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void App_LostFocus(object sender, EventArgs e)
|
|
||||||
|
private void AppWindowLostFocus()
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS
|
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS
|
||||||
&& this.Opacity == 1)
|
&& this.Opacity == 1 && !RunTimeStatus.LOCK_APP_PANEL)
|
||||||
{
|
{
|
||||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
if (!appData.AppConfig.MarginHide || (appData.AppConfig.MarginHide && !MarginHide.IS_HIDE))
|
if (!appData.AppConfig.MarginHide || (appData.AppConfig.MarginHide && !MarginHide.IS_HIDE))
|
||||||
@@ -542,6 +657,7 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.DataContext != null)
|
if (this.DataContext != null)
|
||||||
@@ -561,7 +677,7 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ExitApp(object sender, RoutedEventArgs e)
|
private void ExitApp(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.MouseMiddleShow)
|
if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow==true)
|
||||||
{
|
{
|
||||||
MouseHookThread.Dispose();
|
MouseHookThread.Dispose();
|
||||||
}
|
}
|
||||||
@@ -574,7 +690,7 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ReStartApp(object sender, RoutedEventArgs e)
|
private void ReStartApp(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.MouseMiddleShow)
|
if (appData.AppConfig.MouseMiddleShow || appData.AppConfig.SecondsWindow == true)
|
||||||
{
|
{
|
||||||
MouseHookThread.Dispose();
|
MouseHookThread.Dispose();
|
||||||
}
|
}
|
||||||
@@ -600,12 +716,34 @@ namespace GeekDesk
|
|||||||
|
|
||||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
//char c = (char)e.Key;
|
||||||
|
|
||||||
if (e.Key == Key.Escape)
|
if (e.Key == Key.Escape)
|
||||||
{
|
{
|
||||||
HideApp();
|
HideApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RunTimeStatus.SEARCH_BOX_SHOW && (e.Key == Key.Up
|
||||||
|
|| e.Key == Key.Down
|
||||||
|
|| e.Key == Key.Tab
|
||||||
|
|| e.Key == Key.Enter
|
||||||
|
))
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Down || e.Key == Key.Tab)
|
||||||
|
{
|
||||||
|
RightCard.SearchListBoxIndexAdd();
|
||||||
|
} else if (e.Key == Key.Up)
|
||||||
|
{
|
||||||
|
RightCard.SearchListBoxIndexSub();
|
||||||
|
} else if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
RightCard.StartupSelectionItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 为了让修改菜单的textBox失去焦点
|
/// 为了让修改菜单的textBox失去焦点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -613,7 +751,7 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void MainWindow_MouseDown(object sender, MouseButtonEventArgs e)
|
private void MainWindow_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
EmptyTextBox.Focus();
|
SearchBox.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -626,5 +764,119 @@ namespace GeekDesk
|
|||||||
//防止延迟贴边隐藏
|
//防止延迟贴边隐藏
|
||||||
RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = false;
|
RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打开屏幕拾色器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ColorPicker(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
TaskbarContextMenu.IsOpen = false;
|
||||||
|
GlobalColorPickerWindow.CreateNoShow();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 如果没有在修改菜单 并且不是右键点击了面板
|
||||||
|
if (!RunTimeStatus.IS_MENU_EDIT
|
||||||
|
&& !RunTimeStatus.SHOW_RIGHT_BTN_MENU
|
||||||
|
&& !RunTimeStatus.APP_BTN_IS_DOWN)
|
||||||
|
{
|
||||||
|
if (RunTimeStatus.SHOW_MENU_PASSWORDBOX)
|
||||||
|
{
|
||||||
|
//必须在其它文本框没有工作的时候才给密码框焦点
|
||||||
|
RightCard.PDDialog.SetFocus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//必须在其它文本框没有工作的时候才给搜索框焦点
|
||||||
|
Keyboard.Focus(SearchBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AppWindow_Deactivated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AppWindowLostFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备份数据文件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
[Obsolete]
|
||||||
|
private void BakDataFile(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Thread t = new Thread(() =>
|
||||||
|
{
|
||||||
|
CommonCode.BakAppData();
|
||||||
|
});
|
||||||
|
t.ApartmentState = ApartmentState.STA;
|
||||||
|
t.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AppButton_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
//点击了面板
|
||||||
|
RunTimeStatus.APP_BTN_IS_DOWN = true;
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
Thread.Sleep(50);
|
||||||
|
RunTimeStatus.APP_BTN_IS_DOWN = false;
|
||||||
|
}).Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ICommand _hideCommand;
|
||||||
|
public ICommand HideCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_hideCommand == null)
|
||||||
|
{
|
||||||
|
_hideCommand = new RelayCommand(
|
||||||
|
p =>
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
p =>
|
||||||
|
{
|
||||||
|
HideAppVis();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return _hideCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# BookerLiu
|
||||||
diff a/MainWindow.xaml b/MainWindow.xaml (rejected hunks)
|
diff a/MainWindow.xaml b/MainWindow.xaml (rejected hunks)
|
||||||
@@ -20,6 +20,7 @@
|
@@ -20,6 +20,7 @@
|
||||||
SizeChanged="Window_SizeChanged"
|
SizeChanged="Window_SizeChanged"
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using System.Threading;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace GeekDesk.MyThread
|
namespace GeekDesk.MyThread
|
||||||
@@ -25,6 +20,7 @@ namespace GeekDesk.MyThread
|
|||||||
manualResetEvent.Set();
|
manualResetEvent.Set();
|
||||||
Dispatcher.Run();
|
Dispatcher.Run();
|
||||||
});
|
});
|
||||||
|
thread.IsBackground = true;
|
||||||
thread.Start();
|
thread.Start();
|
||||||
manualResetEvent.WaitOne();
|
manualResetEvent.WaitOne();
|
||||||
manualResetEvent.Dispose();
|
manualResetEvent.Dispose();
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
using GeekDesk.Control.UserControls.Config;
|
using GeekDesk.Control.UserControls.Config;
|
||||||
|
using GeekDesk.Control.Windows;
|
||||||
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using Gma.System.MouseKeyHook;
|
using Gma.System.MouseKeyHook;
|
||||||
|
using ShowSeconds;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Drawing;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
@@ -14,27 +14,46 @@ namespace GeekDesk.MyThread
|
|||||||
{
|
{
|
||||||
public class MouseHookThread
|
public class MouseHookThread
|
||||||
{
|
{
|
||||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
private static readonly AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
private static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
|
public static Dispatcher dispatcher;
|
||||||
private static Dispatcher dispatcher;
|
private static UserActivityHook hook;
|
||||||
|
|
||||||
|
public static void Hook()
|
||||||
|
|
||||||
public static void MiddleHook()
|
|
||||||
{
|
{
|
||||||
//使用dispatcher来单独监听UI线程 防止程序卡顿
|
//使用dispatcher来单独监听UI线程 防止程序卡顿
|
||||||
dispatcher = DispatcherBuild.Build();
|
dispatcher = DispatcherBuild.Build();
|
||||||
dispatcher.Invoke((Action)(() =>
|
dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
|
||||||
{
|
{
|
||||||
m_GlobalHook.MouseUpExt += M_GlobalHook_MouseUpExt;
|
hook = new UserActivityHook();
|
||||||
|
|
||||||
|
if (appConfig.MouseMiddleShow)
|
||||||
|
{
|
||||||
|
hook.OnMouseWheelUp += OnMouseWheelUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (appConfig.SecondsWindow == true)
|
||||||
|
{
|
||||||
|
hook.OnMouseLeftDown += OnMouseLeftDown;
|
||||||
|
hook.OnMouseLeftUp += OnMouseLeftUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
SecondsWindow.SecondsBakColorFun(sender, e);
|
||||||
m_GlobalHook.Dispose();
|
}
|
||||||
dispatcher.InvokeShutdown();
|
|
||||||
|
private static void OnMouseLeftUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||||
|
{
|
||||||
|
SecondsWindow.SecondsHookSetFuc(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnMouseWheelUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||||
|
{
|
||||||
|
MouseWheelShowApp(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -42,26 +61,55 @@ namespace GeekDesk.MyThread
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></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.Invoke(DispatcherPriority.Normal, new Action(() =>
|
||||||
{
|
{
|
||||||
App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() =>
|
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
|
||||||
{
|
{
|
||||||
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
|
MainWindow.ShowApp();
|
||||||
{
|
}
|
||||||
MainWindow.ShowApp();
|
else
|
||||||
}
|
{
|
||||||
else
|
MainWindow.HideApp();
|
||||||
{
|
}
|
||||||
MainWindow.HideApp();
|
}));
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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出错");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
46
MyThread/RelativePathThread.cs
Normal file
46
MyThread/RelativePathThread.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace GeekDesk.MyThread
|
||||||
|
{
|
||||||
|
public class RelativePathThread
|
||||||
|
{
|
||||||
|
public static void MakeRelativePath()
|
||||||
|
{
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ObservableCollection<MenuInfo> menuList = MainWindow.appData.MenuList;
|
||||||
|
|
||||||
|
string myExePath = Constants.APP_DIR + "GeekDesk.exe";
|
||||||
|
foreach (MenuInfo mi in menuList)
|
||||||
|
{
|
||||||
|
ObservableCollection<IconInfo> iconList = mi.IconList;
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,13 +4,8 @@ using GeekDesk.Util;
|
|||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace GeekDesk.MyThread
|
namespace GeekDesk.MyThread
|
||||||
{
|
{
|
||||||
@@ -32,7 +27,13 @@ namespace GeekDesk.MyThread
|
|||||||
{
|
{
|
||||||
|
|
||||||
//等待1分钟后再检查更新 有的网络连接过慢
|
//等待1分钟后再检查更新 有的网络连接过慢
|
||||||
System.Threading.Thread.Sleep(60 * 1000);
|
int sleepTime = 60 * 1000;
|
||||||
|
if (Constants.DEV)
|
||||||
|
{
|
||||||
|
sleepTime = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.Threading.Thread.Sleep(sleepTime);
|
||||||
|
|
||||||
string updateUrl;
|
string updateUrl;
|
||||||
string nowVersion = ConfigurationManager.AppSettings["Version"];
|
string nowVersion = ConfigurationManager.AppSettings["Version"];
|
||||||
@@ -59,7 +60,8 @@ namespace GeekDesk.MyThread
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogUtil.WriteErrorLog(ex, "获取更新失败!");
|
LogUtil.WriteErrorLog(ex, "获取更新失败!");
|
||||||
}
|
}
|
||||||
|
|||||||
34
Plugins/ShowSeconds/SecondsWindow.xaml
Normal file
34
Plugins/ShowSeconds/SecondsWindow.xaml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<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="ShowSeconds_Main_8400A17AEEF7C029"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="Transparent"
|
||||||
|
ShowInTaskbar="False"
|
||||||
|
Focusable="True"
|
||||||
|
Loaded="Window_Loaded"
|
||||||
|
ShowActivated="False"
|
||||||
|
>
|
||||||
|
|
||||||
|
<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>
|
||||||
367
Plugins/ShowSeconds/SecondsWindow.xaml.cs
Normal file
367
Plugins/ShowSeconds/SecondsWindow.xaml.cs
Normal file
@@ -0,0 +1,367 @@
|
|||||||
|
using GeekDesk;
|
||||||
|
using GeekDesk.MyThread;
|
||||||
|
using GeekDesk.Util;
|
||||||
|
using ShowSeconds.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
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.Interop;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace ShowSeconds
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class SecondsWindow : Window
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Color beforeColor;
|
||||||
|
private static Color topBeforeColor;
|
||||||
|
|
||||||
|
//dark theam
|
||||||
|
private readonly static System.Windows.Media.SolidColorBrush darkBG
|
||||||
|
= new System.Windows.Media.SolidColorBrush
|
||||||
|
{
|
||||||
|
Color = System.Windows.Media.Color.FromRgb(46, 50, 54),
|
||||||
|
Opacity = 0.8
|
||||||
|
};
|
||||||
|
private readonly static System.Windows.Media.SolidColorBrush darkFont
|
||||||
|
= new System.Windows.Media.SolidColorBrush
|
||||||
|
{
|
||||||
|
Color = System.Windows.Media.Color.FromRgb(255, 255, 255)
|
||||||
|
};
|
||||||
|
|
||||||
|
//light theam
|
||||||
|
private readonly static System.Windows.Media.SolidColorBrush lightBG
|
||||||
|
= new System.Windows.Media.SolidColorBrush
|
||||||
|
{
|
||||||
|
Color = System.Windows.Media.Color.FromRgb(236, 244, 251),
|
||||||
|
Opacity = 1
|
||||||
|
};
|
||||||
|
private readonly static System.Windows.Media.SolidColorBrush lightFont
|
||||||
|
= new System.Windows.Media.SolidColorBrush
|
||||||
|
{
|
||||||
|
Color = System.Windows.Media.Color.FromRgb(65, 63, 61),
|
||||||
|
};
|
||||||
|
|
||||||
|
private static bool expandClock = true; //是否展开时钟
|
||||||
|
private static System.Windows.Forms.Timer timer;
|
||||||
|
private static double lProportion = 0.82;
|
||||||
|
private static double tProportion = 0.03;
|
||||||
|
private static int sleepTime = 800;
|
||||||
|
public SecondsWindow()
|
||||||
|
{
|
||||||
|
SecondsDataContext dc = new SecondsDataContext
|
||||||
|
{
|
||||||
|
Seconds = (DateTime.Now.Hour).ToString() + ":" +
|
||||||
|
FormatMS(DateTime.Now.Minute) + ":" +
|
||||||
|
FormatMS(DateTime.Now.Second)
|
||||||
|
};
|
||||||
|
|
||||||
|
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 = 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
this.DataContext = dc;
|
||||||
|
this.Topmost = true;
|
||||||
|
BGBorder.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
timer = new System.Windows.Forms.Timer();
|
||||||
|
timer.Interval = 1000;
|
||||||
|
timer.Tick += Timer_Tick;
|
||||||
|
HideWindowUtil.HideAltTab(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SecondsHookSetFuc(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||||
|
{
|
||||||
|
ThreadPool.QueueUserWorkItem(state =>
|
||||||
|
{
|
||||||
|
window.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
if (ScreenUtil.IsPrimaryFullScreen()) return;
|
||||||
|
|
||||||
|
App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() =>
|
||||||
|
{
|
||||||
|
int x = e.X;
|
||||||
|
int y = e.Y;
|
||||||
|
|
||||||
|
//获取实际坐标 windows可能会有缩放
|
||||||
|
IntPtr hdc = GetDC(IntPtr.Zero);
|
||||||
|
double scale = ScreenUtil.GetScreenScalingFactor();
|
||||||
|
|
||||||
|
x = (int)(x / scale);
|
||||||
|
y = (int)(y / scale);
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
//判断是否展开时钟
|
||||||
|
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 (!window.BGBorder.IsVisible)
|
||||||
|
{
|
||||||
|
Color theamColor = GetColor(1919, 1079);
|
||||||
|
if (CalculateLight(theamColor) > 255 / 2)
|
||||||
|
{
|
||||||
|
//light
|
||||||
|
window.BGBorder.Background = lightBG;
|
||||||
|
window.SecondsText.Foreground = lightFont;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// dark
|
||||||
|
window.BGBorder.Background = darkBG;
|
||||||
|
window.SecondsText.Foreground = darkFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
SecondsDataContext dc = window.DataContext as SecondsDataContext;
|
||||||
|
dc.Seconds = (DateTime.Now.Hour).ToString() + ":" +
|
||||||
|
FormatMS(DateTime.Now.Minute) + ":" +
|
||||||
|
FormatMS(DateTime.Now.Second);
|
||||||
|
|
||||||
|
int sx = (int)(width * lProportion);
|
||||||
|
int sMarginBottom = (int)(height * tProportion);
|
||||||
|
window.Left = sx - window.Width;
|
||||||
|
window.Top = SystemParameters.WorkArea.Height - window.Height;
|
||||||
|
window.BGBorder.Visibility = Visibility.Visible;
|
||||||
|
timer.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.BGBorder.Visibility = Visibility.Collapsed;
|
||||||
|
timer.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else 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)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
window.BGBorder.Visibility = Visibility.Collapsed;
|
||||||
|
timer.Stop();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SecondsBakColorFun(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||||
|
{
|
||||||
|
ThreadPool.QueueUserWorkItem(state =>
|
||||||
|
{
|
||||||
|
window.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
beforeColor = GetBottomBeforeColor();
|
||||||
|
topBeforeColor = GetTopBeforeColor();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
this.DataContext = null;
|
||||||
|
this.DataContext = dc;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string FormatMS(int ms)
|
||||||
|
{
|
||||||
|
if (ms < 10)
|
||||||
|
{
|
||||||
|
return "0" + ms;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ms.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Color GetBottomBeforeColor()
|
||||||
|
{
|
||||||
|
return GetColor(1760, 985);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Color GetTopBeforeColor()
|
||||||
|
{
|
||||||
|
return GetColor(1751, 693);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Color GetColor(int w2, int h2)
|
||||||
|
{
|
||||||
|
double w = 1920;
|
||||||
|
double h = 1080;
|
||||||
|
double width = SystemParameters.PrimaryScreenWidth;
|
||||||
|
double height = SystemParameters.PrimaryScreenHeight;
|
||||||
|
double scale = ScreenUtil.GetScreenScalingFactor();
|
||||||
|
|
||||||
|
System.Drawing.Point p = new System.Drawing.Point((int)(w2 / w * width * scale), (int)(h2 / h * height * scale));
|
||||||
|
return ScreenUtil.GetColorAt(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 ("Shutdown".Equals(cds.msg))
|
||||||
|
{
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hwnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static int CalculateLight(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SecondsWindow window = null;
|
||||||
|
public static void ShowWindow()
|
||||||
|
{
|
||||||
|
if (window == null || !window.Activate())
|
||||||
|
{
|
||||||
|
window = new SecondsWindow();
|
||||||
|
}
|
||||||
|
window.Show();
|
||||||
|
Keyboard.Focus(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//#######################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 该函数检索一指定窗口的客户区域或整个屏幕的显示设备上下文环境的句柄,
|
||||||
|
/// 以后可以在GDI函数中使用该句柄来在设备上下文环境中绘图。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hWnd">设备上下文环境被检索的窗口的句柄,如果该值为NULL,GetDC则检索整个屏幕的设备上下文环境。</param>
|
||||||
|
/// <returns>如果成功,返回指定窗口客户区的设备上下文环境;如果失败,返回值为Null。</returns>
|
||||||
|
[DllImport("user32")]
|
||||||
|
public static extern IntPtr GetDC(IntPtr hWnd);
|
||||||
|
/// <summary>
|
||||||
|
/// 该函数释放设备上下文环境(DC)供其他应用程序使用。函数的效果与设备上下文环境类型有关。
|
||||||
|
/// 它只释放公用的和设备上下文环境,对于类或私有的则无效。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hWnd">指向要释放的设备上下文环境所在的窗口的句柄。</param>
|
||||||
|
/// <param name="hDC">指向要释放的设备上下文环境的句柄。</param>
|
||||||
|
/// <returns>如果释放成功,则返回值为1;如果没有释放成功,则返回值为0。</returns>
|
||||||
|
[DllImport("user32")]
|
||||||
|
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||||
|
[DllImport("user32")]
|
||||||
|
public static extern bool GetCursorPos(out System.Drawing.Point pt);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Plugins/ShowSeconds/ViewModel/SecondsDataContext.cs
Normal file
25
Plugins/ShowSeconds/ViewModel/SecondsDataContext.cs
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,11 +4,11 @@ using System.Windows;
|
|||||||
|
|
||||||
// 有关程序集的一般信息由以下
|
// 有关程序集的一般信息由以下
|
||||||
// 控制。更改这些特性值可修改
|
// 控制。更改这些特性值可修改
|
||||||
// 与程序集关联的信息。
|
// 与程序集关联的信息。
|
||||||
[assembly: AssemblyTitle("GeekDesk")]
|
[assembly: AssemblyTitle("GeekDesk")]
|
||||||
[assembly: AssemblyDescription("小巧、美观的桌面快速启动工具")]
|
[assembly: AssemblyDescription("小巧、美观的桌面快速启动工具")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Demo-Liu")]
|
[assembly: AssemblyCompany("BookerLiu")]
|
||||||
[assembly: AssemblyProduct("GeekDesk")]
|
[assembly: AssemblyProduct("GeekDesk")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
@@ -49,5 +49,5 @@ using System.Windows;
|
|||||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
//通过使用 "*",如下所示:
|
//通过使用 "*",如下所示:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.4.1.4")]
|
[assembly: AssemblyVersion("2.5.1.0")]
|
||||||
[assembly: AssemblyFileVersion("2.4.1.4")]
|
[assembly: AssemblyFileVersion("2.5.1.0")]
|
||||||
|
|||||||
81
README.md
81
README.md
@@ -1,46 +1,77 @@
|
|||||||
# GeekDesk 极客桌面
|
# GeekDesk 极客桌面
|
||||||
小巧、**美观**的桌面快速启动管理工具
|
小巧、**美观**的桌面快速启动管理工具
|
||||||
|
|
||||||
谈一谈做GeekDesk的原因:
|
———— 大风, 雨夜...
|
||||||
|
「你来了」
|
||||||
|
「我来了」
|
||||||
|
|
||||||
目前的市场上也有一部分桌面图标管理工具, 但是**界面好点的收费**, **免费的界面差**
|
「你究竟想干什么!」
|
||||||
**windows11**都来了, 难道还要用界面停留在**win7时代**的软件吗
|
「我想做一款软件, 这个软件要Cool」
|
||||||
|
|
||||||
所以就萌生了做这款软件的想法, **免费 / 美观 / 高度定制化** 是从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)
|
|
||||||
|
|
||||||
## 全局热键 鼠标跟随 快速启动 随时随地
|
「什么软件?」
|
||||||
- 支持自定义热键
|
「从最常用的桌面开始吧」
|
||||||
- 支持鼠标跟随
|
|
||||||
<img src="https://z3.ax1x.com/2021/07/19/WJt4hQ.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
|
「哼!现在的软件多入牛毛, 会差你一个吗」
|
||||||
|
「我不知道, 但是我想做」
|
||||||
|
|
||||||
|
「你以为凭你一个人的力量能在这大海里掀起什么波浪吗」
|
||||||
|
「但只要我想就够了, 这是我的梦想!」
|
||||||
|
|
||||||
|
「梦想? 可笑, 这世界哪有什么梦想. 不过是一日三餐, 车子和房!」
|
||||||
|
「我想...就够了...」
|
||||||
|
|
||||||
|
「...」
|
||||||
|
———— 雨停, 狂风仍在呼啸...
|
||||||
|
|
||||||
|
<img src="https://s4.ax1x.com/2021/12/15/TSrwfU.png" a border="0" width="800px"/>
|
||||||
|
|
||||||
|
|
||||||
|
**免费 / 美观 / 高度定制化** 是从GeekDesk诞生开始就有的需求和方向, 未来也会向着这些方向发展
|
||||||
|
|
||||||
|
目前GeekDesk只有一个人在开发所以想法有限, 大家如果有好的建议也可以提Issue
|
||||||
|
|
||||||
|
另外如果你喜欢 GeekDesk的话, 或许可以为作者购买防脱洗发水
|
||||||
|
当然, 点个**Star**也是对作者的激励哦~ 😊😊😊
|
||||||
|
|
||||||
|
|
||||||
|
### 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"/>
|
||||||
|
|
||||||
[](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多个系统图标可供选择
|
- 80多个系统图标可供选择
|
||||||
- 另支持在线导入阿里巴巴icon图标
|
- 另支持在线导入阿里巴巴icon图标
|
||||||
- 篇幅原因,公众号内回复 **自定义图标** 可以查看教程
|
- ~~篇幅原因,公众号内回复 **自定义图标** 可以查看教程~~ 现在软件内已经贴上教程链接啦 也欢迎大家关注我的公众号:blush:
|
||||||
<img src="https://z3.ax1x.com/2021/07/19/WJ3fDU.png" alt="WJ3fDU.png" border="0" width="450px"/>
|
<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
|
||||||
|
[](https://starchart.cc/Demo-Liu/GeekDesk)
|
||||||
|
|||||||
7
Resource/Dictionary/XamlFlairSettings.xaml
Normal file
7
Resource/Dictionary/XamlFlairSettings.xaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF">
|
||||||
|
<!--组合动画-->
|
||||||
|
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
using GeekDesk.Control;
|
using GeekDesk.Control.Other;
|
||||||
using GeekDesk.Control.Other;
|
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using HandyControl.Data;
|
using HandyControl.Data;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
|
||||||
namespace GeekDesk.Task
|
namespace GeekDesk.Task
|
||||||
@@ -51,7 +46,7 @@ namespace GeekDesk.Task
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClearMemory();
|
//ClearMemory();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +60,7 @@ namespace GeekDesk.Task
|
|||||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||||
{
|
{
|
||||||
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
|
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 内存回收
|
#region 内存回收
|
||||||
|
|||||||
10
Update.json
10
Update.json
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"title": "GeekDesk版本更新",
|
"title": "GeekDesk版本更新",
|
||||||
"subTitle": "V2.4.14",
|
"subTitle": "V2.5.12",
|
||||||
"msgTitle": "本次更新内容如下",
|
"msgTitle": "本次更新内容如下",
|
||||||
"msg": "['这次更新间隔比较久, 一个是工作比较忙, 另一个是因为老毛病颈椎病犯了, 但新版本总归是来了','增加图标排序功能','增加鼠标悬停切换菜单','增加搜索功能,显示界面后按下Ctrl+F','其它已知问题修复','老规矩兄弟萌, 我用爱发电, 你们点免费Star']",
|
"msg": "['求Star,求Star', '集成Win11显秒插件', '崩溃问题修复', '现在在右侧栏(快捷图标区域)也可以鼠标滚轮切换菜单了', '缩放屏幕截图问题修复(感谢@1062406901提的PR)', '其它已知问题修复']",
|
||||||
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
|
"githubUrl": "https://github.com/BookerLiu/GeekDesk/releases",
|
||||||
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
|
"giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases",
|
||||||
"version": "2.4.14"
|
"version": "2.5.12"
|
||||||
}
|
}
|
||||||
69
Util/BGSettingUtil.cs
Normal file
69
Util/BGSettingUtil.cs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Effects;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class BGSettingUtil
|
||||||
|
{
|
||||||
|
private static readonly AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
|
public static void BGSetting()
|
||||||
|
{
|
||||||
|
if (appConfig.BGStyle == BGStyle.ImgBac || appConfig.BGStyle == 0)
|
||||||
|
{
|
||||||
|
Image image = new Image
|
||||||
|
{
|
||||||
|
Effect = new BlurEffect()
|
||||||
|
{
|
||||||
|
Radius = appConfig.BlurValue
|
||||||
|
},
|
||||||
|
Margin = new Thickness(-30),
|
||||||
|
Source = appConfig.BitmapImage,
|
||||||
|
Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2))
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
|
||||||
|
//image.SetBinding(Image.OpacityProperty, binding);
|
||||||
|
|
||||||
|
Grid grid = new Grid
|
||||||
|
{
|
||||||
|
ClipToBounds = true
|
||||||
|
};
|
||||||
|
grid.Children.Add(image);
|
||||||
|
|
||||||
|
VisualBrush vb = new VisualBrush
|
||||||
|
{
|
||||||
|
Visual = grid
|
||||||
|
};
|
||||||
|
MainWindow.mainWindow.BGBorder.Background = vb;
|
||||||
|
}
|
||||||
|
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),
|
||||||
|
Offset = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
lgb.GradientStops.Add(gs);
|
||||||
|
|
||||||
|
GradientStop gs2 = new GradientStop
|
||||||
|
{
|
||||||
|
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color2),
|
||||||
|
Offset = 1
|
||||||
|
};
|
||||||
|
lgb.GradientStops.Add(gs2);
|
||||||
|
MainWindow.mainWindow.BGBorder.Background = lgb;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
77
Util/BlurGlassUtil.cs
Normal file
77
Util/BlurGlassUtil.cs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
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 BlurGlassUtil
|
||||||
|
{
|
||||||
|
internal enum AccentState
|
||||||
|
{
|
||||||
|
ACCENT_DISABLED = 1,
|
||||||
|
ACCENT_ENABLE_GRADIENT = 0,
|
||||||
|
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
|
||||||
|
ACCENT_ENABLE_BLURBEHIND = 3,
|
||||||
|
ACCENT_INVALID_STATE = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct AccentPolicy
|
||||||
|
{
|
||||||
|
public AccentState AccentState;
|
||||||
|
public int AccentFlags;
|
||||||
|
public int GradientColor;
|
||||||
|
public int AnimationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct WindowCompositionAttributeData
|
||||||
|
{
|
||||||
|
public WindowCompositionAttribute Attribute;
|
||||||
|
public IntPtr Data;
|
||||||
|
public int SizeOfData;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal enum WindowCompositionAttribute
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
WCA_ACCENT_POLICY = 19
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
|
||||||
|
|
||||||
|
|
||||||
|
public static void EnableBlur(Window window)
|
||||||
|
{
|
||||||
|
WindowInteropHelper windowHelper = new WindowInteropHelper(window);
|
||||||
|
|
||||||
|
AccentPolicy accent = new AccentPolicy
|
||||||
|
{
|
||||||
|
AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND
|
||||||
|
};
|
||||||
|
|
||||||
|
int accentStructSize = Marshal.SizeOf(accent);
|
||||||
|
|
||||||
|
IntPtr accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||||
|
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||||
|
|
||||||
|
WindowCompositionAttributeData data = new WindowCompositionAttributeData
|
||||||
|
{
|
||||||
|
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
|
||||||
|
SizeOfData = accentStructSize,
|
||||||
|
Data = accentPtr
|
||||||
|
};
|
||||||
|
|
||||||
|
SetWindowCompositionAttribute(windowHelper.Handle, ref data);
|
||||||
|
|
||||||
|
Marshal.FreeHGlobal(accentPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Util/ColorUtil.cs
Normal file
15
Util/ColorUtil.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class ColorUtil
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Control.Other;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
using HandyControl.Data;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -8,6 +12,7 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using static GeekDesk.Control.Other.GlobalMsgNotification;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 提取一些代码
|
/// 提取一些代码
|
||||||
@@ -28,54 +33,117 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
using (FileStream fs = File.Create(Constants.DATA_FILE_PATH)) { }
|
using (FileStream fs = File.Create(Constants.DATA_FILE_PATH)) { }
|
||||||
appData = new AppData();
|
appData = new AppData();
|
||||||
SaveAppData(appData);
|
SaveAppData(appData, Constants.DATA_FILE_PATH);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using (FileStream fs = new FileStream(Constants.DATA_FILE_PATH, FileMode.Open))
|
try
|
||||||
{
|
{
|
||||||
BinaryFormatter bf = new BinaryFormatter();
|
using (FileStream fs = new FileStream(Constants.DATA_FILE_PATH, FileMode.Open))
|
||||||
appData = bf.Deserialize(fs) as AppData;
|
{
|
||||||
|
BinaryFormatter bf = new BinaryFormatter();
|
||||||
|
appData = bf.Deserialize(fs) as AppData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
if (File.Exists(Constants.DATA_FILE_BAK_PATH))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (FileStream fs = new FileStream(Constants.DATA_FILE_BAK_PATH, FileMode.Open))
|
||||||
|
{
|
||||||
|
BinaryFormatter bf = new BinaryFormatter();
|
||||||
|
appData = bf.Deserialize(fs) as AppData;
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogMsg msg = new DialogMsg();
|
||||||
|
msg.msg = "不幸的是, GeekDesk当前的数据文件已经损坏, " +
|
||||||
|
"现在已经启用系统自动备份的数据\n\n" +
|
||||||
|
"如果你有较新的备份, " +
|
||||||
|
"请退出GeekDesk, " +
|
||||||
|
"将备份文件重命名为:Data, " +
|
||||||
|
"然后将Data覆盖到GeekDesk的根目录即可\n\n" +
|
||||||
|
"系统上次备份时间: \n" + appData.AppConfig.SysBakTime +
|
||||||
|
"\n\n如果当前数据就是你想要的数据, 那么请不用管它";
|
||||||
|
GlobalMsgNotification gm = new GlobalMsgNotification(msg);
|
||||||
|
HandyControl.Controls.Notification ntf = HandyControl.Controls.Notification.Show(gm, ShowAnimation.Fade, true);
|
||||||
|
gm.ntf = ntf;
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return appData;
|
return appData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly static object _MyLock = new object();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存app 数据
|
/// 保存app 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appData"></param>
|
/// <param name="appData"></param>
|
||||||
public static void SaveAppData(AppData appData)
|
public static void SaveAppData(AppData appData, string filePath)
|
||||||
{
|
{
|
||||||
using (FileStream fs = new FileStream(Constants.DATA_FILE_PATH, FileMode.Create))
|
lock (_MyLock)
|
||||||
{
|
{
|
||||||
BinaryFormatter bf = new BinaryFormatter();
|
if (filePath.Equals(Constants.DATA_FILE_BAK_PATH))
|
||||||
bf.Serialize(fs, appData);
|
{
|
||||||
|
appData.AppConfig.SysBakTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
if (!Directory.Exists(filePath.Substring(0, filePath.LastIndexOf("\\"))))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(filePath.Substring(0, filePath.LastIndexOf("\\")));
|
||||||
|
}
|
||||||
|
using (FileStream fs = new FileStream(filePath, FileMode.Create))
|
||||||
|
{
|
||||||
|
BinaryFormatter bf = new BinaryFormatter();
|
||||||
|
bf.Serialize(fs, appData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void SavePassword(string password)
|
||||||
/// <summary>
|
|
||||||
/// 判断当前屏幕(鼠标最后活动屏幕)是否有全屏化应用
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsPrimaryFullScreen()
|
|
||||||
{
|
{
|
||||||
RECT rect = new RECT();
|
using (StreamWriter sw = new StreamWriter(Constants.PW_FILE_BAK_PATH))
|
||||||
GetWindowRect(new HandleRef(null, GetForegroundWindow()), ref rect);
|
|
||||||
|
|
||||||
int windowHeight = rect.bottom - rect.top;
|
|
||||||
int screenHeight = (int)SystemParameters.PrimaryScreenHeight;
|
|
||||||
|
|
||||||
if (windowHeight >= screenHeight)
|
|
||||||
{
|
{
|
||||||
return true;
|
sw.Write(password);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void BakAppData()
|
||||||
|
{
|
||||||
|
|
||||||
|
SaveFileDialog sfd = new SaveFileDialog
|
||||||
|
{
|
||||||
|
Title = "备份文件",
|
||||||
|
Filter = "bak文件(*.bak)|*.bak",
|
||||||
|
FileName = "Data-GD-" + DateTime.Now.ToString("yyMMdd") + ".bak",
|
||||||
|
};
|
||||||
|
if (sfd.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
using (FileStream fs = new FileStream(sfd.FileName, FileMode.Create))
|
||||||
|
{
|
||||||
|
BinaryFormatter bf = new BinaryFormatter();
|
||||||
|
bf.Serialize(fs, MainWindow.appData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据路径获取文件图标等信息
|
/// 根据路径获取文件图标等信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -92,7 +160,7 @@ namespace GeekDesk.Util
|
|||||||
// ext = System.IO.Path.GetExtension(path).ToLower();
|
// ext = System.IO.Path.GetExtension(path).ToLower();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
string iconPath = null;
|
string iconPath;
|
||||||
//if (".lnk".Equals(ext))
|
//if (".lnk".Equals(ext))
|
||||||
//{
|
//{
|
||||||
|
|
||||||
@@ -111,16 +179,21 @@ namespace GeekDesk.Util
|
|||||||
BitmapImage bi = ImageUtil.GetBitmapIconByPath(iconPath);
|
BitmapImage bi = ImageUtil.GetBitmapIconByPath(iconPath);
|
||||||
IconInfo iconInfo = new IconInfo
|
IconInfo iconInfo = new IconInfo
|
||||||
{
|
{
|
||||||
Path = path,
|
Path_NoWrite = path,
|
||||||
LnkPath = tempPath,
|
LnkPath_NoWrite = tempPath,
|
||||||
BitmapImage = bi,
|
BitmapImage_NoWrite = bi,
|
||||||
StartArg = FileUtil.GetArgByLnk(tempPath)
|
StartArg_NoWrite = FileUtil.GetArgByLnk(tempPath)
|
||||||
};
|
};
|
||||||
iconInfo.DefaultImage = iconInfo.ImageByteArr;
|
iconInfo.DefaultImage_NoWrite = iconInfo.ImageByteArr;
|
||||||
iconInfo.Name = System.IO.Path.GetFileNameWithoutExtension(tempPath);
|
iconInfo.Name_NoWrite = System.IO.Path.GetFileNameWithoutExtension(tempPath);
|
||||||
if (StringUtil.IsEmpty(iconInfo.Name))
|
if (StringUtil.IsEmpty(iconInfo.Name))
|
||||||
{
|
{
|
||||||
iconInfo.Name = path;
|
iconInfo.Name_NoWrite = path;
|
||||||
|
}
|
||||||
|
string relativePath = FileUtil.MakeRelativePath(Constants.APP_DIR + "GeekDesk.exe", iconInfo.Path);
|
||||||
|
if (!string.IsNullOrEmpty(relativePath) && !relativePath.Equals(iconInfo.Path))
|
||||||
|
{
|
||||||
|
iconInfo.RelativePath_NoWrite = relativePath;
|
||||||
}
|
}
|
||||||
return iconInfo;
|
return iconInfo;
|
||||||
}
|
}
|
||||||
@@ -171,21 +244,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();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
175
Util/DragAdorner.cs
Normal file
175
Util/DragAdorner.cs
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
// Copyright (C) Josh Smith - January 2007
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Renders a visual which can follow the mouse cursor,
|
||||||
|
/// such as during a drag-and-drop operation.
|
||||||
|
/// </summary>
|
||||||
|
public class DragAdorner : Adorner
|
||||||
|
{
|
||||||
|
#region Data
|
||||||
|
|
||||||
|
private Rectangle child = null;
|
||||||
|
private double offsetLeft = 0;
|
||||||
|
private double offsetTop = 0;
|
||||||
|
|
||||||
|
#endregion // Data
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of DragVisualAdorner.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="adornedElement">The element being adorned.</param>
|
||||||
|
/// <param name="size">The size of the adorner.</param>
|
||||||
|
/// <param name="brush">A brush to with which to paint the adorner.</param>
|
||||||
|
public DragAdorner( UIElement adornedElement, Size size, Brush brush )
|
||||||
|
: base( adornedElement )
|
||||||
|
{
|
||||||
|
Rectangle rect = new Rectangle();
|
||||||
|
rect.Fill = brush;
|
||||||
|
rect.Width = size.Width;
|
||||||
|
rect.Height = size.Height;
|
||||||
|
rect.IsHitTestVisible = false;
|
||||||
|
this.child = rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // Constructor
|
||||||
|
|
||||||
|
#region Public Interface
|
||||||
|
|
||||||
|
#region GetDesiredTransform
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="transform"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override GeneralTransform GetDesiredTransform( GeneralTransform transform )
|
||||||
|
{
|
||||||
|
GeneralTransformGroup result = new GeneralTransformGroup();
|
||||||
|
result.Children.Add( base.GetDesiredTransform( transform ) );
|
||||||
|
result.Children.Add( new TranslateTransform( this.offsetLeft, this.offsetTop ) );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // GetDesiredTransform
|
||||||
|
|
||||||
|
#region OffsetLeft
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets the horizontal offset of the adorner.
|
||||||
|
/// </summary>
|
||||||
|
public double OffsetLeft
|
||||||
|
{
|
||||||
|
get { return this.offsetLeft; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.offsetLeft = value;
|
||||||
|
UpdateLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // OffsetLeft
|
||||||
|
|
||||||
|
#region SetOffsets
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the location of the adorner in one atomic operation.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left"></param>
|
||||||
|
/// <param name="top"></param>
|
||||||
|
public void SetOffsets( double left, double top )
|
||||||
|
{
|
||||||
|
this.offsetLeft = left;
|
||||||
|
this.offsetTop = top;
|
||||||
|
this.UpdateLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // SetOffsets
|
||||||
|
|
||||||
|
#region OffsetTop
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets the vertical offset of the adorner.
|
||||||
|
/// </summary>
|
||||||
|
public double OffsetTop
|
||||||
|
{
|
||||||
|
get { return this.offsetTop; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.offsetTop = value;
|
||||||
|
UpdateLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // OffsetTop
|
||||||
|
|
||||||
|
#endregion // Public Interface
|
||||||
|
|
||||||
|
#region Protected Overrides
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="constraint"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override Size MeasureOverride( Size constraint )
|
||||||
|
{
|
||||||
|
this.child.Measure( constraint );
|
||||||
|
return this.child.DesiredSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="finalSize"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override Size ArrangeOverride( Size finalSize )
|
||||||
|
{
|
||||||
|
this.child.Arrange( new Rect( finalSize ) );
|
||||||
|
return finalSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override Visual GetVisualChild( int index )
|
||||||
|
{
|
||||||
|
return this.child;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override. Always returns 1.
|
||||||
|
/// </summary>
|
||||||
|
protected override int VisualChildrenCount
|
||||||
|
{
|
||||||
|
get { return 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // Protected Overrides
|
||||||
|
|
||||||
|
#region Private Helpers
|
||||||
|
|
||||||
|
private void UpdateLocation()
|
||||||
|
{
|
||||||
|
AdornerLayer adornerLayer = this.Parent as AdornerLayer;
|
||||||
|
if( adornerLayer != null )
|
||||||
|
adornerLayer.Update( this.AdornedElement );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // Private Helpers
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
using IWshRuntimeLibrary;
|
using System;
|
||||||
using System;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
@@ -11,27 +11,42 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
public class FileIcon
|
public class FileIcon
|
||||||
{
|
{
|
||||||
|
static List<string> blurExtsList;
|
||||||
private static List<string> GetBlurExts()
|
static List<int[]> pixelList;
|
||||||
{
|
static FileIcon() {
|
||||||
List<string> list = new List<string>();
|
blurExtsList = new List<string>
|
||||||
list.Add(".exe");
|
{
|
||||||
list.Add(".cer");
|
".exe",
|
||||||
list.Add(".lnk");
|
".cer",
|
||||||
return list;
|
".lnk",
|
||||||
|
".chm"
|
||||||
|
};
|
||||||
|
pixelList = new List<int[]>
|
||||||
|
{
|
||||||
|
new int[]{ 256 / 4, 256 / 4 },
|
||||||
|
new int[]{ 256 / 2, 256 / 4 },
|
||||||
|
new int[]{ 256 / 4 * 3, 256 / 4 },
|
||||||
|
new int[]{ 256 / 4, 256 / 2 },
|
||||||
|
new int[]{ 256 / 4, 256 / 4 * 3 },
|
||||||
|
new int[]{ 256 / 4 * 3, 256 / 2 },
|
||||||
|
new int[]{ 256 / 4 * 3, 256 / 4 * 3 },
|
||||||
|
new int[]{ 256 / 2, 256 / 4 * 3 },
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("User32.dll")]
|
|
||||||
public static extern int PrivateExtractIcons(
|
|
||||||
string lpszFile, //文件名可以是exe,dll,ico,cur,ani,bmp
|
[DllImport("User32.dll")]
|
||||||
int nIconIndex, //从第几个图标开始获取
|
public static extern int PrivateExtractIcons(
|
||||||
int cxIcon, //获取图标的尺寸x
|
string lpszFile, //文件名可以是exe,dll,ico,cur,ani,bmp
|
||||||
int cyIcon, //获取图标的尺寸y
|
int nIconIndex, //从第几个图标开始获取
|
||||||
IntPtr[] phicon, //获取到的图标指针数组
|
int cxIcon, //获取图标的尺寸x
|
||||||
int[] piconid, //图标对应的资源编号
|
int cyIcon, //获取图标的尺寸y
|
||||||
int nIcons, //指定获取的图标数量,仅当文件类型为.exe 和 .dll时候可用
|
IntPtr[] phicon, //获取到的图标指针数组
|
||||||
int flags //标志,默认0就可以,具体可以看LoadImage函数
|
int[] piconid, //图标对应的资源编号
|
||||||
);
|
int nIcons, //指定获取的图标数量,仅当文件类型为.exe 和 .dll时候可用
|
||||||
|
int flags //标志,默认0就可以,具体可以看LoadImage函数
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public static BitmapImage GetBitmapImage(string filePath)
|
public static BitmapImage GetBitmapImage(string filePath)
|
||||||
@@ -54,7 +69,7 @@ namespace GeekDesk.Util
|
|||||||
ip = hIcons[0];
|
ip = hIcons[0];
|
||||||
ico = Icon.FromHandle(ip);
|
ico = Icon.FromHandle(ip);
|
||||||
}
|
}
|
||||||
else if (GetBlurExts().Contains(ext))
|
else if (blurExtsList.Contains(ext))
|
||||||
{
|
{
|
||||||
ico = Icon.ExtractAssociatedIcon(filePath);
|
ico = Icon.ExtractAssociatedIcon(filePath);
|
||||||
}
|
}
|
||||||
@@ -62,8 +77,14 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
ip = GetJumboIcon(GetIconIndex(filePath));
|
ip = GetJumboIcon(GetIconIndex(filePath));
|
||||||
ico = Icon.FromHandle(ip);
|
ico = Icon.FromHandle(ip);
|
||||||
|
if (CheckIsSmallIco(ico.ToBitmap()))
|
||||||
|
{
|
||||||
|
ico = Icon.ExtractAssociatedIcon(filePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Bitmap bmp = ico.ToBitmap();
|
Bitmap bmp = ico.ToBitmap();
|
||||||
MemoryStream strm = new MemoryStream();
|
MemoryStream strm = new MemoryStream();
|
||||||
|
|
||||||
@@ -74,6 +95,7 @@ namespace GeekDesk.Util
|
|||||||
myEncoderParameters.Param[0] = myEncoderParameter;
|
myEncoderParameters.Param[0] = myEncoderParameter;
|
||||||
|
|
||||||
bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
|
bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
|
||||||
|
|
||||||
BitmapImage bmpImage = new BitmapImage();
|
BitmapImage bmpImage = new BitmapImage();
|
||||||
bmpImage.BeginInit();
|
bmpImage.BeginInit();
|
||||||
strm.Seek(0, SeekOrigin.Begin);
|
strm.Seek(0, SeekOrigin.Begin);
|
||||||
@@ -83,6 +105,7 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
Shell32.DestroyIcon(ip);
|
Shell32.DestroyIcon(ip);
|
||||||
}
|
}
|
||||||
|
DeleteObject(bmp.GetHbitmap());
|
||||||
return bmpImage.Clone();
|
return bmpImage.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +122,30 @@ namespace GeekDesk.Util
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool CheckIsSmallIco(Bitmap bm)
|
||||||
|
{
|
||||||
|
Color color;
|
||||||
|
int count = 0;
|
||||||
|
foreach (int[] arr in pixelList)
|
||||||
|
{
|
||||||
|
color = bm.GetPixel(arr[0], arr[1]);
|
||||||
|
if (color.A == 0)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DeleteObject(bm.GetHbitmap());
|
||||||
|
if (count >= 6)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
|
||||||
|
public static extern bool DeleteObject(IntPtr onj);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static int GetIconIndex(string pszFile)
|
public static int GetIconIndex(string pszFile)
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
using IWshRuntimeLibrary;
|
using IWshRuntimeLibrary;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace GeekDesk.Util
|
namespace GeekDesk.Util
|
||||||
{
|
{
|
||||||
@@ -159,5 +157,47 @@ namespace GeekDesk.Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string MakeRelativePath(string fromPath, string toPath)
|
||||||
|
{
|
||||||
|
string relativePath = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(toPath) || string.IsNullOrEmpty(fromPath)) return null;
|
||||||
|
Uri file = new Uri(@toPath);
|
||||||
|
// Must end in a slash to indicate folder
|
||||||
|
Uri folder = new Uri(@fromPath);
|
||||||
|
relativePath =
|
||||||
|
Uri.UnescapeDataString(
|
||||||
|
folder.MakeRelativeUri(file)
|
||||||
|
.ToString()
|
||||||
|
.Replace('/', Path.DirectorySeparatorChar)
|
||||||
|
);
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user