Compare commits
296 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1fa15d624 | ||
|
|
2381be3efc | ||
|
|
7b2ffadf9c | ||
|
|
32e91d6d23 | ||
|
|
e74b6d75c4 | ||
|
|
2360cced09 | ||
|
|
60238ddb17 | ||
|
|
39251b66f6 | ||
|
|
2a4f9a9bda | ||
|
|
a61c69aa0b | ||
|
|
8fea77c304 | ||
|
|
f1b4698878 | ||
|
|
7d3f1c9af0 | ||
|
|
a3af8635fc | ||
|
|
b2a8effff9 | ||
|
|
060836d5cd | ||
|
|
c7456cf66d | ||
|
|
4706f2b021 | ||
|
|
0067f568de | ||
|
|
00acc0311c | ||
|
|
0613fe5e4a | ||
|
|
42d729bf4c | ||
|
|
1c37517d86 | ||
|
|
f340c5e357 | ||
|
|
087e98e6df | ||
|
|
8b2919c3b5 | ||
|
|
1d6830b30b | ||
|
|
ac8302280f | ||
|
|
2df6582f83 | ||
|
|
ece8787b8e | ||
|
|
2e1cc7ee3c | ||
|
|
f152aaf1f4 | ||
|
|
6fd1e65db7 | ||
|
|
ea39576709 | ||
|
|
9485b801b6 | ||
|
|
08424b0db0 | ||
|
|
9de5a19f7f | ||
|
|
943e8bcefb | ||
|
|
48732a0815 | ||
|
|
08b4596f31 | ||
|
|
4565dc5bd6 | ||
|
|
48fffa6da7 | ||
|
|
6072832654 | ||
|
|
dd41635199 | ||
|
|
85ad6a6bc4 | ||
|
|
c34142923c | ||
|
|
29bb799f11 | ||
|
|
41799251af | ||
|
|
a7181f6973 | ||
|
|
eba6d4770a | ||
|
|
058ed5016a | ||
|
|
888c9d3330 | ||
|
|
77a6233e63 | ||
|
|
20071acc4e | ||
|
|
98f332dc2e | ||
|
|
3a18882372 | ||
|
|
26e4a7e4d5 | ||
|
|
280e66f457 | ||
|
|
1fce566f4a | ||
|
|
3654ec393a | ||
|
|
b12bbe9183 | ||
|
|
37dd2f7fb2 | ||
|
|
4b5cc7b7eb | ||
|
|
a18a66352c | ||
|
|
d0547da214 | ||
|
|
300fcb78da | ||
|
|
05afacd3ae | ||
|
|
425d1a4ce5 | ||
|
|
32adce1815 | ||
|
|
80a9975140 | ||
|
|
c1e83e8a39 | ||
|
|
5fa5d3436d | ||
|
|
f4a060eb00 | ||
|
|
6fda2ea107 | ||
|
|
ce17e7174e | ||
|
|
2fd078f722 | ||
|
|
753a4e4fa2 | ||
|
|
ca38d44feb | ||
|
|
546985f132 | ||
|
|
ee47443c34 | ||
|
|
ad2556a216 | ||
|
|
ab5529f1e8 | ||
|
|
7589736751 | ||
|
|
de57b8d78d | ||
|
|
d9b0a4de89 | ||
|
|
d5e0dc98db | ||
|
|
e82af431b5 | ||
|
|
7360412c97 | ||
|
|
3fa3a42bb3 | ||
|
|
904e9a2999 | ||
|
|
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 | ||
|
|
3794d877f2 | ||
|
|
072985d2b6 | ||
|
|
be9dcdb923 | ||
|
|
125cc72499 | ||
|
|
6e5163c23c | ||
|
|
e14faecb19 | ||
|
|
dcb2f24f2f | ||
|
|
f763ba7565 | ||
|
|
e263082f0d | ||
|
|
eec261ca4a | ||
|
|
1457265496 | ||
|
|
bec1b8c6ea | ||
|
|
d9270ff337 | ||
|
|
5bd6af6cc7 | ||
|
|
734b78b327 | ||
|
|
701dc27361 | ||
|
|
b0066939dd | ||
|
|
679a0edbed | ||
|
|
f6624caa82 | ||
|
|
c46f66b54d | ||
|
|
7d48b16900 | ||
|
|
9789e9b02b | ||
|
|
e5f1368c8b | ||
|
|
89ebbbed78 | ||
|
|
c1d6aec622 | ||
|
|
fbcd55b586 | ||
|
|
d61bf2af11 | ||
|
|
6fcc599eff | ||
|
|
9053f4c25b | ||
|
|
9bf0e6ad23 | ||
|
|
fadf020ecf | ||
|
|
c062f332ff | ||
|
|
4d416e673e | ||
|
|
13fbacba40 | ||
|
|
a03fb713e4 | ||
|
|
489a27a0ef | ||
|
|
e112dfebea | ||
|
|
9ca443acf6 | ||
|
|
dd17bbc2b3 | ||
|
|
c9bb1c2fad | ||
|
|
8decd923ff | ||
|
|
65d57b69b6 | ||
|
|
28a523fb04 | ||
|
|
a38ecab5fa | ||
|
|
145564bfc5 | ||
|
|
fdd8c8bb10 | ||
|
|
fce6f47fbe | ||
|
|
c9bc4282c0 | ||
|
|
54200c8254 | ||
|
|
72bcbee888 | ||
|
|
de02248e75 | ||
|
|
78b5b52c2a | ||
|
|
b66c9cd082 | ||
|
|
83cdaa4491 | ||
|
|
9e3c6f67c8 | ||
|
|
1a24222f3f | ||
|
|
1b9e4fc79d | ||
|
|
9eaca05012 | ||
|
|
d82ce80374 | ||
|
|
4444e6000c | ||
|
|
46f6de321c | ||
|
|
c3e46bc751 | ||
|
|
b23a1d91c5 | ||
|
|
edacf3249c | ||
|
|
ab13cff769 | ||
|
|
dee1caa435 | ||
|
|
dedf20528f | ||
|
|
33b9d3af42 | ||
|
|
4f59c2c64d | ||
|
|
8ee27e247b | ||
|
|
701734e048 | ||
|
|
cf8f983f1a | ||
|
|
37e8631f73 | ||
|
|
0f6119c0ba | ||
|
|
caf75e2427 | ||
|
|
c13593bdf4 | ||
|
|
e6a95c4668 | ||
|
|
78b685c9ed | ||
|
|
3483bf88c2 | ||
|
|
746eda8b84 | ||
|
|
f96a76e6fb | ||
|
|
71f18b801a | ||
|
|
1bf0f9c38b | ||
|
|
b4215fb27d | ||
|
|
2efcabe570 | ||
|
|
8958bddb25 | ||
|
|
00f581a03e | ||
|
|
24ba279b18 | ||
|
|
ba59e8c354 | ||
|
|
1c486a5c8a | ||
|
|
95e704279e | ||
|
|
8b115ef27c | ||
|
|
b097001e6c | ||
|
|
79de085158 | ||
|
|
cfd2d041af | ||
|
|
3d877092e5 | ||
|
|
f7ff6e4a46 | ||
|
|
63f9043e00 | ||
|
|
7bfe14c211 | ||
|
|
af8e0b7df2 | ||
|
|
b7431c0408 | ||
|
|
a301e051b6 | ||
|
|
d60435cd61 | ||
|
|
18501b3afe | ||
|
|
274541303a | ||
|
|
5e81f334e2 | ||
|
|
5e1f3fea38 | ||
|
|
1459c35167 | ||
|
|
6f2a5bdc07 | ||
|
|
c231587543 | ||
|
|
787c23ef77 | ||
|
|
7e3babe0c3 | ||
|
|
fd406fea4d | ||
|
|
d46eae4c6e | ||
|
|
4a94aab3c7 | ||
|
|
8d44429bda | ||
|
|
6ecb55061f | ||
|
|
f11056c469 | ||
|
|
c9f19c5084 | ||
|
|
571d7c3d0d | ||
|
|
99eae59dc3 | ||
|
|
2d67d32b29 | ||
|
|
33560ad85a | ||
|
|
53481bf907 | ||
|
|
2673b9862c | ||
|
|
4c0a97b7b1 | ||
|
|
0a89255ad2 | ||
|
|
3c78b058cf | ||
|
|
9a5882ff98 | ||
|
|
69487b9383 | ||
|
|
0107ac8317 | ||
|
|
27e9b56b4d | ||
|
|
3c89d93cf7 | ||
|
|
1dc77da44e | ||
|
|
94f32fdb15 | ||
|
|
15a214aad0 | ||
|
|
67a3b0eddd | ||
|
|
71071a997f | ||
|
|
c2fca3e7aa | ||
|
|
488670a0fc | ||
|
|
14b2d77915 | ||
|
|
1839d310bc |
104
App.config
104
App.config
@@ -1,23 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<configSections>
|
||||
<section name="SystemIcons" type="System.Configuration.DictionarySectionHandler" />
|
||||
<section name="ShowSecondsSettings" type="System.Configuration.DictionarySectionHandler" />
|
||||
<section name="SystemBGs" type="System.Collections.ObjectModel.ObservableCollection" />
|
||||
<section name="GradientBGParam" type="GeekDesk.ViewModel.GradientBGParam" />
|
||||
</configSections>
|
||||
<ShowSecondsSettings>
|
||||
<add key="Version" value="1.0.01" />
|
||||
<add key="LProportion" value="0.82" />
|
||||
<add key="TProportion" value="0.03" />
|
||||
<add key="DelayTime" value="1500" />
|
||||
</ShowSecondsSettings>
|
||||
<SystemIcons>
|
||||
<add key="Calculator" value="计算器" />
|
||||
<add key="Computer" value="此电脑" />
|
||||
<add key="GroupPolicy" value="组策略" />
|
||||
<add key="Network" value="网络连接" />
|
||||
<add key="RecycleBin" value="回收站" />
|
||||
<add key="Registry" value="注册表编辑器" />
|
||||
<add key="Notepad" value="记事本" />
|
||||
<add key="Mstsc" value="远程桌面连接" />
|
||||
<add key="Control" value="控制面板" />
|
||||
<add key="CMD" value="命令行" />
|
||||
<add key="Services" value="服务" />
|
||||
</SystemIcons>
|
||||
<SystemBGs>
|
||||
<GradientBGParam Color1="#FCCF31" Color2="#F55555" Name="诸神黄昏" />
|
||||
</SystemBGs>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="lib;Plugins\EveryThing\lib" />
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
|
||||
</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>
|
||||
</runtime>
|
||||
<appSettings>
|
||||
<add key="Version" value="1.0-beta"/>
|
||||
|
||||
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk"/>
|
||||
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master"/>
|
||||
|
||||
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json"/>
|
||||
<add key="GiteeUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json"/>
|
||||
<add key="Version" value="2.5.15" />
|
||||
<add key="GitHubUrl" value="https://github.com/BookerLiu/GeekDesk" />
|
||||
<add key="GiteeUrl" value="https://gitee.com/BookerLiu/GeekDesk/tree/master" />
|
||||
<add key="GitHubUpdateUrl" value="https://raw.githubusercontent.com/BookerLiu/GeekDesk/master/Update.json" />
|
||||
<add key="GiteeUpdateUrl" value="https://gitee.com/BookerLiu/GeekDesk/raw/master/Update.json" />
|
||||
<!--<add key="GiteeUpdateUrl" value="file:///D:/WorkSpace/VS/GeekDesk/Update.json" />-->
|
||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
|
||||
<add key="ShowPublicWeChat" value="Y" />
|
||||
<add key="BakDays" value="7" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
<system.web>
|
||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||
<providers>
|
||||
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
|
||||
</providers>
|
||||
</membership>
|
||||
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
|
||||
<providers>
|
||||
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
</configuration>
|
||||
3
App.xaml
3
App.xaml
@@ -12,6 +12,9 @@
|
||||
<ResourceDictionary Source="/GeekDesk;component/Resource/Dictionary/Geometry.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.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>
|
||||
</Application.Resources>
|
||||
|
||||
119
App.xaml.cs
119
App.xaml.cs
@@ -1,8 +1,14 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.MyThread;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace GeekDesk
|
||||
@@ -18,59 +24,80 @@ namespace GeekDesk
|
||||
public App()
|
||||
{
|
||||
this.Startup += new StartupEventHandler(App_Startup);
|
||||
Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
SystemEvents.PowerModeChanged += OnPowerModeChanged;
|
||||
}
|
||||
|
||||
|
||||
private void App_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
|
||||
bool ret;
|
||||
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out ret);
|
||||
//RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly; //禁用硬件加速
|
||||
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out bool ret);
|
||||
if (!ret)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out ret);
|
||||
if (!ret)
|
||||
{
|
||||
MessageUtil.SendMsgByWName(
|
||||
"GeekDesk_Main_" + Constants.MY_UUID,
|
||||
"ShowApp"
|
||||
);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//电源监听
|
||||
private void OnPowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||
{
|
||||
switch (e.Mode)
|
||||
{
|
||||
case PowerModes.Resume:
|
||||
// 系统从休眠状态唤醒
|
||||
LogUtil.WriteLog("System resumed from sleep.");
|
||||
ProcessUtil.ReStartApp();
|
||||
break;
|
||||
case PowerModes.Suspend:
|
||||
// 系统进入休眠状态
|
||||
LogUtil.WriteLog("System is going to sleep.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
e.Handled = true;//使用这一行代码告诉运行时,该异常被处理了,不再作为UnhandledException抛出了。
|
||||
Mouse.OverrideCursor = null;
|
||||
LogUtil.WriteErrorLog(e, "未捕获异常!");
|
||||
if (Constants.DEV)
|
||||
{
|
||||
MessageBox.Show("GeekDesk遇到一个问题, 不用担心, 这不影响其它操作!");
|
||||
}
|
||||
}
|
||||
|
||||
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
LogUtil.WriteErrorLog(e, "严重异常!");
|
||||
//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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// private void WriteLog(object exception)
|
||||
// {
|
||||
// Exception ex = exception as Exception;
|
||||
|
||||
// using (FileStream fs = File.Open(".//ErrorLog.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
||||
// {
|
||||
// fs.Seek(0, SeekOrigin.End);
|
||||
// byte[] buffer = Encoding.Default.GetBytes("-------------------------------------------------------\r\n");
|
||||
// fs.Write(buffer, 0, buffer.Length);
|
||||
|
||||
// buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + "\r\n");
|
||||
// fs.Write(buffer, 0, buffer.Length);
|
||||
|
||||
// if (ex != null)
|
||||
// {
|
||||
// buffer = Encoding.Default.GetBytes("成员名: " + ex.TargetSite + "\r\n");
|
||||
// fs.Write(buffer, 0, buffer.Length);
|
||||
|
||||
// buffer = Encoding.Default.GetBytes("引发异常的类: " + ex.TargetSite.DeclaringType + "\r\n");
|
||||
// fs.Write(buffer, 0, buffer.Length);
|
||||
|
||||
// buffer = Encoding.Default.GetBytes("异常信息: " + ex.Message + "\r\n");
|
||||
// fs.Write(buffer, 0, buffer.Length);
|
||||
|
||||
// buffer = Encoding.Default.GetBytes("引发异常的程序集或对象: " + ex.Source + "\r\n");
|
||||
// fs.Write(buffer, 0, buffer.Length);
|
||||
|
||||
// buffer = Encoding.Default.GetBytes("栈:" + ex.StackTrace + "\r\n");
|
||||
// fs.Write(buffer, 0, buffer.Length);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// buffer = Encoding.Default.GetBytes("应用程序错误: " + exception.ToString() + "\r\n");
|
||||
// fs.Write(buffer, 0, buffer.Length);
|
||||
// }
|
||||
// }
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
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 //渐变色
|
||||
}
|
||||
}
|
||||
19
Constant/CommonEnum.cs
Normal file
19
Constant/CommonEnum.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
/// <summary>
|
||||
/// 默认参数
|
||||
/// </summary>
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public enum CommonEnum
|
||||
{
|
||||
WINDOW_WIDTH = 850, //默认窗体宽度
|
||||
WINDOW_HEIGHT = 600, //默认窗体高度
|
||||
MENU_CARD_WIDHT = 165, //默认菜单栏宽度
|
||||
IMAGE_WIDTH = 45, //默认图标宽度
|
||||
IMAGE_HEIGHT = 45, //默认图标高度
|
||||
IMAGE_WIDTH_AM = 52, //动画变换宽度
|
||||
IMAGE_HEIGHT_AM = 52, //动画变换高度
|
||||
IMAGE_PANEL_WIDTH = 110, //图标容器宽度
|
||||
IMAGE_PANEL_HEIGHT = 90, //图标容器高度
|
||||
WINDOW_ANIMATION_TIME = 200, //主窗口动画时间,
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
17
Constant/DictConst.cs
Normal file
17
Constant/DictConst.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public class DictConst
|
||||
{
|
||||
public static readonly Dictionary<bool, string> batchMenuHeaderDict = new Dictionary<bool, string>();
|
||||
static DictConst() {
|
||||
batchMenuHeaderDict.Add(true, "取消批量操作");
|
||||
batchMenuHeaderDict.Add(false, "批量操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// 图标应用启动方式
|
||||
/// </summary>
|
||||
namespace GeekDesk.Constant
|
||||
|
||||
8
Constant/IconType.cs
Normal file
8
Constant/IconType.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public enum IconType
|
||||
{
|
||||
OTHER = 1, //直接打开
|
||||
URL = 2 //调用浏览器打开
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/// <summary>
|
||||
/// 默认参数
|
||||
/// </summary>
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public enum MainWindowEnum
|
||||
{
|
||||
WINDOW_WIDTH = 666, //默认窗体宽度
|
||||
WINDOW_HEIGHT = 500, //默认窗体高度
|
||||
MENU_CARD_WIDHT = 165, //默认菜单栏宽度
|
||||
IMAGE_WIDTH = 60, //默认图标宽度
|
||||
IMAGE_HEIGHT = 60, //默认图标高度
|
||||
}
|
||||
}
|
||||
14
Constant/MenuType.cs
Normal file
14
Constant/MenuType.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 MenuType
|
||||
{
|
||||
NORMAL, //普通菜单
|
||||
LINK, //关联菜单
|
||||
}
|
||||
}
|
||||
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, //取消密码
|
||||
}
|
||||
}
|
||||
90
Constant/RunTimeStatus.cs
Normal file
90
Constant/RunTimeStatus.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
internal class RunTimeStatus
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 查询框是否在工作
|
||||
/// </summary>
|
||||
public static volatile bool SEARCH_BOX_SHOW = false;
|
||||
|
||||
/// <summary>
|
||||
/// 查询框是否已经关闭了300毫秒 防止点击右侧区域关闭查询框时误打开列表
|
||||
/// </summary>
|
||||
public static volatile bool SEARCH_BOX_HIDED_300 = true;
|
||||
|
||||
/// <summary>
|
||||
/// 贴边隐藏后 以非鼠标经过方式触发显示
|
||||
/// </summary>
|
||||
public static volatile bool MARGIN_HIDE_AND_OTHER_SHOW = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否锁定主面板 锁定后 不执行隐藏动作
|
||||
/// </summary>
|
||||
public static volatile bool LOCK_APP_PANEL = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否弹出了菜单密码框
|
||||
/// </summary>
|
||||
public static volatile bool SHOW_MENU_PASSWORDBOX = false;
|
||||
|
||||
/// <summary>
|
||||
/// 是否弹出了右键菜单
|
||||
/// </summary>
|
||||
public static volatile bool SHOW_RIGHT_BTN_MENU = false;
|
||||
|
||||
/// <summary>
|
||||
/// 是否点击了面板功能按钮
|
||||
/// </summary>
|
||||
public static volatile bool APP_BTN_IS_DOWN = false;
|
||||
|
||||
/// <summary>
|
||||
/// 是否正在编辑菜单
|
||||
/// </summary>
|
||||
public static volatile bool IS_MENU_EDIT = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 图标card 鼠标滚轮是否正在工作
|
||||
/// 用来控制popup的显示 否则低性能机器会造成卡顿
|
||||
/// </summary>
|
||||
public static volatile bool ICONLIST_MOUSE_WHEEL = false;
|
||||
/// <summary>
|
||||
/// 控制多少毫秒后 关闭(ICONLIST_MOUSE_WHEEL)鼠标滚轮运行状态
|
||||
/// </summary>
|
||||
public static volatile int MOUSE_WHEEL_WAIT_MS = 100;
|
||||
/// <summary>
|
||||
/// 与关闭popup 配合使用, 避免线程结束后不显示popup
|
||||
/// </summary>
|
||||
public static volatile bool MOUSE_ENTER_ICON = false;
|
||||
/// <summary>
|
||||
/// 控制每次刷新搜索结果 鼠标移动后显示popup
|
||||
/// </summary>
|
||||
public static volatile int MOUSE_MOVE_COUNT = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// everything 新的键入搜索
|
||||
/// </summary>
|
||||
public static volatile bool EVERYTHING_NEW_SEARCH = false;
|
||||
|
||||
/// <summary>
|
||||
/// 键入多少毫秒后 没有新的键入开启搜索
|
||||
/// </summary>
|
||||
public static volatile int EVERYTHING_SEARCH_DELAY_TIME = 300;
|
||||
|
||||
/// <summary>
|
||||
/// 控制主界面热键按下规定时间内只执行一次show hide
|
||||
/// </summary>
|
||||
public static volatile bool MAIN_HOT_KEY_DOWN = false;
|
||||
/// <summary>
|
||||
/// 控制主界面热键按下规定时间内只执行一次show hide
|
||||
/// </summary>
|
||||
public static volatile int MAIN_HOT_KEY_TIME = 300;
|
||||
|
||||
}
|
||||
}
|
||||
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, //按下即搜
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,9 @@
|
||||
public enum SortType
|
||||
{
|
||||
CUSTOM = 1, //自定义排序
|
||||
NAME = 2, //按名称排序
|
||||
COUNT = 3 //按使用次数排序
|
||||
COUNT_UP = 2, //按使用次数升序
|
||||
COUNT_LOW = 3, //按使用次数降序
|
||||
NAME_UP = 4, //按名称升序
|
||||
NAME_LOW = 5, //按名称降序
|
||||
}
|
||||
}
|
||||
|
||||
8
Constant/TodoTaskExecType.cs
Normal file
8
Constant/TodoTaskExecType.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public enum TodoTaskExecType
|
||||
{
|
||||
SET_TIME = 1, //指定时间
|
||||
CRON = 2 //cron表达式
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// 更新源
|
||||
/// </summary>
|
||||
namespace GeekDesk.Constant
|
||||
|
||||
19
Constant/WidthTypeEnum.cs
Normal file
19
Constant/WidthTypeEnum.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Constant
|
||||
{
|
||||
public enum WidthTypeEnum
|
||||
{
|
||||
LEFT_CARD = 0, //左侧托盘宽度
|
||||
RIGHT_CARD = 1, //右侧托盘宽度
|
||||
RIGHT_CARD_HALF = 2, //右侧托盘宽度的一半
|
||||
RIGHT_CARD_HALF_TEXT = 3, //右侧托盘宽度的一半 再减去左侧图像宽度
|
||||
RIGHT_CARD_20 = 4, //右侧托盘宽度 - 20
|
||||
RIGHT_CARD_40 = 5, //右侧托盘宽度 - 40
|
||||
RIGHT_CARD_70 = 6, //右侧托盘宽度 - 70
|
||||
}
|
||||
}
|
||||
34
Control/Other/BGNmaeDialog.xaml
Normal file
34
Control/Other/BGNmaeDialog.xaml
Normal file
@@ -0,0 +1,34 @@
|
||||
<Border x:Class="GeekDesk.Control.Other.BGNmaeDialog"
|
||||
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:cvt="clr-namespace:GeekDesk.Converts"
|
||||
CornerRadius="4"
|
||||
Width="350"
|
||||
Height="160"
|
||||
Style="{StaticResource BorderBG}"
|
||||
>
|
||||
<Border.Resources>
|
||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||
<Setter Property="Width" Value="75"/>
|
||||
<Setter Property="TextAlignment" Value="Left"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="5,8,0,0"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
</Style>
|
||||
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||
</Border.Resources>
|
||||
<hc:SimplePanel Margin="10" VerticalAlignment="Center">
|
||||
<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"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||
<TextBlock Text="起个名字吧:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBox x:Name="BGName" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Margin="0,25,0,0" Spacing="10" Grid.ColumnSpan="4">
|
||||
<Button Content="保存" Style="{StaticResource MyBtnStyle}" Click="Save" Margin="265,10,0,0"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</hc:SimplePanel>
|
||||
</Border>
|
||||
42
Control/Other/BGNmaeDialog.xaml.cs
Normal file
42
Control/Other/BGNmaeDialog.xaml.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
namespace GeekDesk.Control.Other
|
||||
{
|
||||
/// <summary>
|
||||
/// TextDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class BGNmaeDialog
|
||||
{
|
||||
public HandyControl.Controls.Dialog dialog;
|
||||
|
||||
public BGNmaeDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Save(object sender, RoutedEventArgs e)
|
||||
{
|
||||
GradientBGParam bg = new GradientBGParam();
|
||||
bg.Id = Guid.NewGuid().ToString();
|
||||
bg.Name = BGName.Text;
|
||||
bg.Color1 = MainWindow.appData.AppConfig.GradientBGParam.Color1;
|
||||
bg.Color2 = MainWindow.appData.AppConfig.GradientBGParam.Color2;
|
||||
MainWindow.appData.AppConfig.CustomBGParams.Add(bg);
|
||||
MainWindow.appData.AppConfig.CustomBGParams = DeepCopyUtil.DeepCopy(MainWindow.appData.AppConfig.CustomBGParams);
|
||||
dialog.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,20 @@
|
||||
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"
|
||||
Background="AliceBlue"
|
||||
BorderThickness="1"
|
||||
BorderThickness="0"
|
||||
Style="{StaticResource BorderBG}"
|
||||
Margin="15"
|
||||
BorderBrush="{DynamicResource BorderBrush}"
|
||||
Width="320"
|
||||
Height="450">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="0.96"/>
|
||||
</Border.Background>
|
||||
<Grid>
|
||||
|
||||
<Image Source="/Resource/Image/BacklogImg.png" Margin="22,35,22,361" />
|
||||
|
||||
|
||||
|
||||
<hc:Card MaxWidth="250" Height="200" BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="8">
|
||||
<!--Card 的内容部分-->
|
||||
<Border CornerRadius="4,4,0,0" Width="160" Height="160">
|
||||
@@ -32,18 +36,18 @@
|
||||
</hc:Card.Footer>
|
||||
</hc:Card>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="20" HorizontalAlignment="Center" Margin="0,346,0,0">
|
||||
<hc:TextBox x:Name="DelayTime" Height="20" Width="60" Text="10" PreviewTextInput="DelayTime_PreviewTextInput" PreviewLostKeyboardFocus="DelayTime_PreviewLostKeyboardFocus" />
|
||||
<hc:UniformSpacingPanel Spacing="20" HorizontalAlignment="Center" Margin="45.5,310,42.5,36">
|
||||
<hc:TextBox x:Name="DelayTime" Style="{StaticResource MyTextBoxStyle}" Height="20" Width="60" Text="10" PreviewTextInput="DelayTime_PreviewTextInput" PreviewLostKeyboardFocus="DelayTime_PreviewLostKeyboardFocus" />
|
||||
<ComboBox x:Name="DelayType" hc:DropDownElement.ConsistentWidth="False" SelectedIndex="0" Height="20" Width="60">
|
||||
<ComboBox.Items>
|
||||
<ComboBoxItem Content="分"/>
|
||||
<ComboBoxItem Content="时"/>
|
||||
</ComboBox.Items>
|
||||
</ComboBox>
|
||||
<Button Content="推迟提醒" Click="DelayButton_Click"/>
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="推迟提醒" Click="DelayButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
<Button Click="BacklogDone_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
|
||||
<Button Style="{StaticResource MyBtnStyle}" Click="BacklogDone_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
using GeekDesk.Task;
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Task;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using Quartz;
|
||||
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.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.Other
|
||||
{
|
||||
@@ -34,11 +27,42 @@ namespace GeekDesk.Control.Other
|
||||
{
|
||||
ToDoInfo info = this.DataContext as ToDoInfo;
|
||||
info.DoneTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
appData.ToDoList.Remove(info); //执行任务删除
|
||||
appData.HiToDoList.Add(info); //添加历史任务
|
||||
if (info.ExecType == TodoTaskExecType.CRON)
|
||||
{
|
||||
CronExpression exp = new CronExpression(info.Cron);
|
||||
DateTime nowTime = DateTime.Now;
|
||||
|
||||
//计算下次执行时间
|
||||
DateTime nextTime = DateTime.SpecifyKind(exp.GetNextValidTimeAfter(nowTime).Value.LocalDateTime, DateTimeKind.Local);
|
||||
|
||||
string nextTimeStr = nextTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
info.ExeTime = nextTimeStr;
|
||||
|
||||
TimeSpan ts = nextTime.Subtract(nowTime);
|
||||
int minutes = (int)Math.Ceiling(ts.TotalMinutes);
|
||||
if (minutes < 0)
|
||||
{
|
||||
minutes = 0;
|
||||
}
|
||||
if (minutes > 60)
|
||||
{
|
||||
int m = minutes % 60;
|
||||
int h = minutes / 60;
|
||||
Growl.SuccessGlobal("下次任务将在 " + h + " 小时零 " + m + " 分钟后提醒您!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.SuccessGlobal("下次任务将在 " + minutes + " 分钟后提醒您!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
appData.ToDoList.Remove(info); //执行任务删除
|
||||
appData.HiToDoList.Add(info); //添加历史任务
|
||||
}
|
||||
ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
|
||||
ToDoTask.activityBacklog.Remove(info);//激活任务删除
|
||||
CommonCode.SaveAppData(appData);
|
||||
CommonCode.SaveAppData(appData, Constants.DATA_FILE_PATH);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,13 +113,15 @@ namespace GeekDesk.Control.Other
|
||||
ToDoInfo info = this.DataContext as ToDoInfo;
|
||||
int time = int.Parse(DelayTime.Text);
|
||||
string type = DelayType.Text;
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case "分":
|
||||
info.ExeTime = DateTime.Now.AddMinutes(time).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
Growl.SuccessGlobal("将在 " + time + " 分钟后再次提醒您!");
|
||||
break;
|
||||
case "时":
|
||||
info.ExeTime = DateTime.Now.AddHours(time).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
Growl.SuccessGlobal("将在 " + time + " 小时后再次提醒您!");
|
||||
break;
|
||||
}
|
||||
ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
CornerRadius="3"
|
||||
Width="400"
|
||||
Height="230"
|
||||
Opacity="0.95">
|
||||
Opacity="0.95"
|
||||
Style="{StaticResource BorderBG}">
|
||||
<Border.Resources>
|
||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||
<Setter Property="Width" Value="100"/>
|
||||
@@ -14,18 +15,15 @@
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="1"/>
|
||||
</Border.Background>
|
||||
<hc:SimplePanel Margin="10">
|
||||
<StackPanel Margin="10">
|
||||
<Grid Margin="8,20,8,20">
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,-10">
|
||||
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Text="SVG 图标地址:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBlock Text="*" Foreground="Red"/>
|
||||
</WrapPanel>
|
||||
<TextBox x:Name="IconUrl" Text="{Binding CustomIconUrl, Mode=OneWay}" Width="240" FontSize="14"/>
|
||||
<TextBox x:Name="IconUrl" Style="{StaticResource MyTextBoxStyle}" Text="{Binding CustomIconUrl, Mode=OneWay}" Width="240" FontSize="14"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,58.276,0,-58.276">
|
||||
@@ -33,19 +31,20 @@
|
||||
<TextBlock Text="JSON 配置地址:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBlock Text="*" Foreground="Red"/>
|
||||
</WrapPanel>
|
||||
<TextBox x:Name="JsonUrl" Text="{Binding CustomIconJsonUrl, Mode=OneWay}" Width="240" FontSize="14"/>
|
||||
<TextBox x:Name="JsonUrl" Style="{StaticResource MyTextBoxStyle}" Text="{Binding CustomIconJsonUrl, Mode=OneWay}" Width="240" FontSize="14"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<TextBlock Text="注: 需配置正确的url方可加载远程图标!" Foreground="Red" Margin="10,95,-10,-92" />
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="246.206,124.551,-246.206,-124.551">
|
||||
<Button Content="取消" Command="hc:ControlCommands.Close"
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="203,125,-203,-125">
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="取消" Command="hc:ControlCommands.Close" HorizontalAlignment="Stretch" Margin="-1,1,1,1" VerticalAlignment="Stretch"
|
||||
/>
|
||||
<Button Content="教程" Click="Teach_Click"
|
||||
Style="{StaticResource MyBtnStyle}"/>
|
||||
<Button Content="保存" Click="Confirm_Click"
|
||||
Command="hc:ControlCommands.Close"
|
||||
Background="#5BC0DE"
|
||||
Foreground="White"/>
|
||||
Style="{StaticResource MyBtnStyle}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</Grid>
|
||||
<!--<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>-->
|
||||
</hc:SimplePanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
@@ -1,11 +1,9 @@
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
namespace GeekDesk.Control.Other
|
||||
@@ -32,13 +30,21 @@ namespace GeekDesk.Control.Other
|
||||
AppConfig appConfig = this.DataContext as AppConfig;
|
||||
appConfig.CustomIconJsonUrl = JsonUrl.Text.Trim();
|
||||
appConfig.CustomIconUrl = IconUrl.Text.Trim();
|
||||
if (!StringUtil.IsEmpty(IconUrl.Text) && !StringUtil.IsEmpty(JsonUrl.Text))
|
||||
if (!StringUtil.IsEmpty(IconUrl.Text) && !StringUtil.IsEmpty(JsonUrl.Text))
|
||||
{
|
||||
IconfontWindow.vm.IsSettingUrl = "true";
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
IconfontWindow.vm.IsSettingUrl = "false";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Teach_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string url = ConfigurationManager.AppSettings["CustomIconTeachUrl"];
|
||||
Process.Start(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 Style="{StaticResource MyBtnStyle}" 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
83
Control/Other/GradientBGDialog.xaml
Normal file
83
Control/Other/GradientBGDialog.xaml
Normal file
@@ -0,0 +1,83 @@
|
||||
<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>
|
||||
<TextBlock Text="提示: 右键点击可以删除自定义的背景颜色哦" Foreground="Gray" HorizontalAlignment="Center" Margin="0,5,0,0"/>
|
||||
|
||||
<ListBox x:Name="GradientBGs"
|
||||
ItemsSource="{Binding}"
|
||||
Background="Transparent"
|
||||
Margin="20,20,20,50"
|
||||
BorderThickness="0"
|
||||
>
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="CMDialog" Width="200">
|
||||
<MenuItem Header="删除" Click="Delete" Tag="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="ContextMenu" Value="{StaticResource CMDialog}"/>
|
||||
<Setter Property="Margin" Value="10"/>
|
||||
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
|
||||
</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 MyBtnStyle}" Click="Close_Click" HorizontalAlignment="Stretch" Margin="524,360,-524,10" VerticalAlignment="Stretch"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</hc:TransitioningContentControl>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
90
Control/Other/GradientBGDialog.xaml.cs
Normal file
90
Control/Other/GradientBGDialog.xaml.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using GeekDesk.ViewModel.Temp;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
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()
|
||||
{
|
||||
ObservableCollection<GradientBGParam> bgArr = DeepCopyUtil.DeepCopy(GradientBGParamList.GradientBGParams);
|
||||
foreach(var bg in MainWindow.appData.AppConfig.CustomBGParams)
|
||||
{
|
||||
bgArr.Add(bg);
|
||||
}
|
||||
|
||||
this.DataContext = DeepCopyUtil.DeepCopy(bgArr);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private void Delete(object sender, RoutedEventArgs e)
|
||||
{
|
||||
HandyControl.Controls.Growl.Ask("确认删除吗?", isConfirmed =>
|
||||
{
|
||||
if (isConfirmed)
|
||||
{
|
||||
GradientBGParam bg = (GradientBGParam)(((MenuItem)sender).Tag);
|
||||
ObservableCollection<GradientBGParam> bgArr = (ObservableCollection<GradientBGParam>)this.DataContext;
|
||||
bgArr.Remove(bg);
|
||||
MainWindow.appData.AppConfig.CustomBGParams.Remove(bg);
|
||||
for (int i = MainWindow.appData.AppConfig.CustomBGParams.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var cbg = MainWindow.appData.AppConfig.CustomBGParams[i];
|
||||
if (cbg.Id == null)
|
||||
{
|
||||
if (cbg.Color1.Equals(bg.Color1) && cbg.Color2.Equals(bg.Color2))
|
||||
{
|
||||
MainWindow.appData.AppConfig.CustomBGParams.RemoveAt(i);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (cbg.Id.Equals(bg.Id))
|
||||
{
|
||||
MainWindow.appData.AppConfig.CustomBGParams.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
MainWindow.appData.AppConfig.CustomBGParams = DeepCopyUtil.DeepCopy(MainWindow.appData.AppConfig.CustomBGParams);
|
||||
}
|
||||
return true;
|
||||
}, "ConfigWindowAskGrowl");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,49 +2,58 @@
|
||||
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:cvt="clr-namespace:GeekDesk.Converts"
|
||||
CornerRadius="4"
|
||||
Width="300"
|
||||
Height="300"
|
||||
Opacity="0.9">
|
||||
Width="350"
|
||||
Height="450"
|
||||
Style="{StaticResource BorderBG}"
|
||||
>
|
||||
<Border.Resources>
|
||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||
<Setter Property="Width" Value="40"/>
|
||||
<Setter Property="Width" Value="75"/>
|
||||
<Setter Property="TextAlignment" Value="Left"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="5,8,0,0"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
</Style>
|
||||
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||
</Border.Resources>
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>
|
||||
</Border.Background>
|
||||
<hc:SimplePanel Margin="10">
|
||||
<Grid Margin="8,20,8,20">
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<hc:SimplePanel Margin="10" VerticalAlignment="Center">
|
||||
<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"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
|
||||
<TextBox x:Name="IconName" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,50,0,71" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,59,0,-9" Grid.ColumnSpan="4">
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||
<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}"/>
|
||||
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" Width="60" Height="60"/>
|
||||
<Button Content="修改" Click="EditImage"/>
|
||||
<Button Content="重置" Click="ReStoreImage"/>
|
||||
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="修改" Click="EditImage"/>
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="重置" Click="ReStoreImage"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,128,0,23" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,150,0,10" Grid.ColumnSpan="4">
|
||||
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="4,15,0,0">
|
||||
<CheckBox x:Name="IconIsAdmin" Style="{StaticResource MyCheckBoxStyle}"
|
||||
Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,200,0,-27" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,218,0,-38" Grid.ColumnSpan="4">
|
||||
<Button Content="保存" Command="hc:ControlCommands.Close" Click="SaveProperty" Margin="208,6,-208,-10"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||
<TextBlock Text="启动参数:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBox x:Name="StartArg" Style="{StaticResource MyTextBoxStyle}" Text="{Binding StartArg, Mode=OneWay}" Width="230" Height="100" TextWrapping="Wrap" FontSize="14"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</Grid>
|
||||
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>
|
||||
<hc:UniformSpacingPanel Margin="0,25,0,0" Spacing="10" Grid.ColumnSpan="4">
|
||||
<Button Content="保存" Style="{StaticResource MyBtnStyle}" Click="SaveProperty" Margin="265,10,0,0"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</hc:SimplePanel>
|
||||
</Border>
|
||||
@@ -1,9 +1,9 @@
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace GeekDesk.Control.Other
|
||||
/// </summary>
|
||||
public partial class IconInfoDialog
|
||||
{
|
||||
public HandyControl.Controls.Dialog dialog;
|
||||
|
||||
public IconInfoDialog()
|
||||
{
|
||||
@@ -37,7 +38,9 @@ namespace GeekDesk.Control.Other
|
||||
info.BitmapImage = IconImg.Source as BitmapImage;
|
||||
info.Name = IconName.Text;
|
||||
info.AdminStartUp = IconIsAdmin.IsChecked.Value;
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
info.StartArg = StartArg.Text;
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
dialog.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,9 +50,9 @@ namespace GeekDesk.Control.Other
|
||||
/// <param name="e"></param>
|
||||
private void ReStoreImage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IconInfo info = ((Button)sender).Tag as IconInfo;
|
||||
IconInfo info = this.DataContext as IconInfo;
|
||||
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -70,13 +73,15 @@ namespace GeekDesk.Control.Other
|
||||
{
|
||||
IconInfo info = this.DataContext as IconInfo;
|
||||
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
}
|
||||
} catch (Exception)
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
|
||||
LogUtil.WriteErrorLog(e1, "修改图标失败!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
46
Control/Other/IconInfoUrlDialog.xaml
Normal file
46
Control/Other/IconInfoUrlDialog.xaml
Normal file
@@ -0,0 +1,46 @@
|
||||
<Border x:Class="GeekDesk.Control.Other.IconInfoUrlDialog"
|
||||
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"
|
||||
Width="300"
|
||||
Height="340"
|
||||
Style="{StaticResource BorderBG}"
|
||||
>
|
||||
<Border.Resources>
|
||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||
<Setter Property="Width" Value="40"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="0,8,0,0"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
<hc:SimplePanel Margin="10">
|
||||
<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"/>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
|
||||
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBox x:Name="IconName" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
|
||||
<TextBlock Text="Url:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBox x:Name="IconUrl" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Path, Mode=OneWay}" Width="180" FontSize="14"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
|
||||
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
||||
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="修改" Click="EditImage"/>
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="重置" Click="ReStoreImage"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
|
||||
<hc:UniformSpacingPanel Spacing="10">
|
||||
<Button Content="保存" Click="SaveProperty" Style="{StaticResource MyBtnStyle}" Margin="224,-10,-224,0" />
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</hc:SimplePanel>
|
||||
</Border>
|
||||
100
Control/Other/IconInfoUrlDialog.xaml.cs
Normal file
100
Control/Other/IconInfoUrlDialog.xaml.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
namespace GeekDesk.Control.Other
|
||||
{
|
||||
/// <summary>
|
||||
/// TextDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class IconInfoUrlDialog
|
||||
{
|
||||
public HandyControl.Controls.Dialog dialog;
|
||||
|
||||
private bool newIconInfo;
|
||||
public IconInfoUrlDialog()
|
||||
{
|
||||
newIconInfo = true;
|
||||
IconInfo info = new IconInfo
|
||||
{
|
||||
BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.URL_ICON_IMG_BASE64),
|
||||
};
|
||||
info.DefaultImage = info.ImageByteArr;
|
||||
info.IconType = IconType.URL;
|
||||
this.DataContext = info;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public IconInfoUrlDialog(IconInfo info)
|
||||
{
|
||||
this.DataContext = info;
|
||||
newIconInfo = false;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存修改属性
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SaveProperty(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IconInfo info = this.DataContext as IconInfo;
|
||||
info.BitmapImage = IconImg.Source as BitmapImage;
|
||||
info.Name = IconName.Text;
|
||||
info.Path = IconUrl.Text;
|
||||
if (newIconInfo)
|
||||
{
|
||||
MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList.Add(info);
|
||||
}
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
dialog.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改图标为默认
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ReStoreImage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IconInfo info = this.DataContext as IconInfo;
|
||||
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改图标
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void EditImage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
{
|
||||
Multiselect = false, //只允许选中单个文件
|
||||
Filter = "所有文件(*.*)|*.*"
|
||||
};
|
||||
if (ofd.ShowDialog() == true)
|
||||
{
|
||||
IconInfo info = this.DataContext as IconInfo;
|
||||
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
|
||||
LogUtil.WriteErrorLog(ex, "修改图标失败!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<Border x:Class="GeekDesk.Control.Other.MenuGeometryDialog"
|
||||
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="10"
|
||||
Width="300"
|
||||
Height="300"
|
||||
Opacity="0.9">
|
||||
<!--<Border.Resources>
|
||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||
<Setter Property="Width" Value="40"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>
|
||||
</Border.Background>
|
||||
<hc:SimplePanel Margin="10">
|
||||
<Grid Margin="8,20,8,20">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="93*"/>
|
||||
<ColumnDefinition Width="38*"/>
|
||||
<ColumnDefinition Width="126*"/>
|
||||
<ColumnDefinition Width="7*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,50,0,71" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,59,0,-9" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
||||
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" Width="60" Height="60"/>
|
||||
<Button Content="修改" Click="EditImage"/>
|
||||
<Button Content="重置" Click="ReStoreImage"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,128,0,23" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,150,0,10" Grid.ColumnSpan="4">
|
||||
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,200,0,-27" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,218,0,-38" Grid.ColumnSpan="4">
|
||||
<Button Content="保存" Command="hc:ControlCommands.Close" Click="SaveProperty" Margin="208,6,-208,-10"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</Grid>
|
||||
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>
|
||||
</hc:SimplePanel>-->
|
||||
</Border>
|
||||
@@ -1,28 +0,0 @@
|
||||
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.Other
|
||||
{
|
||||
/// <summary>
|
||||
/// MenuGeometryDialogxaml.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MenuGeometryDialog
|
||||
{
|
||||
public MenuGeometryDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
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>
|
||||
108
Control/Other/MyColorPickerDialog.xaml.cs
Normal file
108
Control/Other/MyColorPickerDialog.xaml.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Util;
|
||||
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;
|
||||
Color c = scb.Color;
|
||||
switch (colorType)
|
||||
{
|
||||
case ColorType.COLOR_1:
|
||||
appConfig.GradientBGParam.Color1 = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
|
||||
case ColorType.COLOR_2:
|
||||
appConfig.GradientBGParam.Color2 = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); break;
|
||||
default:
|
||||
appConfig.TextColor = string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B); 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 Style="{StaticResource MyTextBoxStyle}" x:Name="HintBox" TextAlignment="Left" Width="220"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="202,35,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||
<TextBlock Text="跳过" MouseLeftButtonDown="NextTB_MouseLeftButtonDown" Style="{StaticResource NextTB}"/>
|
||||
<TextBlock Text="完成" MouseLeftButtonDown="DoneTB_MouseLeftButtonDown" Style="{StaticResource NextTB}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
289
Control/Other/PasswordDialog.xaml.cs
Normal file
289
Control/Other/PasswordDialog.xaml.cs
Normal file
@@ -0,0 +1,289 @@
|
||||
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.Text = "提示: " + 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);
|
||||
try
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
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();
|
||||
}
|
||||
catch (Exception ex) { }
|
||||
});
|
||||
}
|
||||
catch (Exception e2) { }
|
||||
}).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);
|
||||
}
|
||||
}
|
||||
}
|
||||
196
Control/Other/SearchResControl.xaml
Normal file
196
Control/Other/SearchResControl.xaml
Normal file
@@ -0,0 +1,196 @@
|
||||
<UserControl x:Class="GeekDesk.Control.Other.SearchResControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.Other"
|
||||
xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:cst="clr-namespace:GeekDesk.Constant"
|
||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
>
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="SearchListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||
<Border>
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ImageStyle" TargetType="Image">
|
||||
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
||||
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||
<Setter Property="Source" Value="{Binding BitmapImage}"/>
|
||||
</Style>
|
||||
<Style x:Key="ImageStyleNoWrite" TargetType="Image">
|
||||
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
||||
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||
<Setter Property="Source" Value="{Binding BitmapImage_NoWrite}"/>
|
||||
</Style>
|
||||
|
||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||
<cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
|
||||
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid>
|
||||
<WrapPanel Orientation="Horizontal"
|
||||
Margin="10"
|
||||
Panel.ZIndex="1"
|
||||
>
|
||||
<UniformGrid x:Name="VerticalUFG"
|
||||
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, Event=Loaded}"
|
||||
xf:Animations.Secondary="{xf:Animate BasedOn={StaticResource FadeOut}, Event=None}"
|
||||
xf:Animations.SecondaryBinding="{Binding Visibility,
|
||||
Converter={StaticResource Visibility2BooleanConverter}, ConverterParameter='reverse',
|
||||
ElementName=VerticalUFG}"
|
||||
>
|
||||
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
|
||||
<ListBox VirtualizingPanel.VirtualizationMode="Recycling"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||
VirtualizingPanel.ScrollUnit="Pixel"
|
||||
ItemsSource="{Binding}"
|
||||
BorderThickness="0"
|
||||
Padding="0,10,0,0"
|
||||
x:Name="SearchListBox"
|
||||
SelectionChanged="SearchListBox_SelectionChanged"
|
||||
>
|
||||
<ListBox.Template>
|
||||
<ControlTemplate TargetType="ListBox">
|
||||
<hc:ScrollViewer
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
IsInertiaEnabled="True"
|
||||
CanContentScroll="True"
|
||||
PreviewMouseWheel="VerticalIconList_PreviewMouseWheel"
|
||||
ScrollChanged="VerticalCard_ScrollChanged"
|
||||
>
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderBrush}">
|
||||
<ItemsPresenter/>
|
||||
</Border>
|
||||
</hc:ScrollViewer>
|
||||
</ControlTemplate>
|
||||
</ListBox.Template>
|
||||
|
||||
<ListBox.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</ListBox.Background>
|
||||
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="IconDialog" Width="200">
|
||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource SearchListBoxItemStyle}">
|
||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel
|
||||
Orientation="Vertical"
|
||||
Background="#00FFFFFF"
|
||||
VirtualizationMode="Recycling"
|
||||
IsVirtualizing="True"
|
||||
IsContainerVirtualizable="True"
|
||||
VirtualizingPanel.ScrollUnit="Pixel"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
|
||||
Converter={StaticResource GetWidthByWWConvert},
|
||||
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD}}"
|
||||
/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border CornerRadius="8">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem }}}"
|
||||
Value="True">
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="White" Opacity="0.68"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<WrapPanel Tag="{Binding}"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
|
||||
Converter={StaticResource GetWidthByWWConvert},
|
||||
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF}}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.Placement="BottomLeft"
|
||||
Background="#00FFFFFF"
|
||||
MouseEnter="SearchIcon_MouseEnter"
|
||||
MouseLeave="SearchIcon_MouseLeave"
|
||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||
MouseMove="SearchIcon_MouseMove"
|
||||
Margin="25,10,0,10"
|
||||
>
|
||||
<Image Style="{StaticResource ImageStyleNoWrite}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||
<StackPanel Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.WindowWidth, Mode=OneWay,
|
||||
Converter={StaticResource GetWidthByWWConvert},
|
||||
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_HALF_TEXT}}" >
|
||||
<TextBlock
|
||||
Margin="10,5,0,0"
|
||||
MaxHeight="40"
|
||||
FontSize="13"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||
Text="{Binding Name}"/>
|
||||
<TextBlock
|
||||
Margin="10,10,0,0"
|
||||
MaxHeight="40"
|
||||
FontSize="11"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||
Text="{Binding Path}"/>
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<!--</hc:TransitioningContentControl>-->
|
||||
</UniformGrid>
|
||||
</WrapPanel>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
331
Control/Other/SearchResControl.xaml.cs
Normal file
331
Control/Other/SearchResControl.xaml.cs
Normal file
@@ -0,0 +1,331 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Plugins.EveryThing;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using GeekDesk.ViewModel.Temp;
|
||||
using HandyControl.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace GeekDesk.Control.Other
|
||||
{
|
||||
/// <summary>
|
||||
/// SearchResControl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SearchResControl : UserControl
|
||||
{
|
||||
public SearchResControl(ObservableCollection<IconInfo> iconList)
|
||||
{
|
||||
this.DataContext = iconList;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SearchListBoxIndexAdd()
|
||||
{
|
||||
//控制移动后 鼠标即使在图标上也不显示popup
|
||||
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
|
||||
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
|
||||
|
||||
if (SearchListBox.Items.Count > 0)
|
||||
{
|
||||
if (SearchListBox.SelectedIndex < SearchListBox.Items.Count - 1)
|
||||
{
|
||||
SearchListBox.SelectedIndex += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SearchListBoxIndexSub()
|
||||
{
|
||||
//控制移动后 鼠标即使在图标上也不显示popup
|
||||
RunTimeStatus.MOUSE_MOVE_COUNT = 0;
|
||||
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
|
||||
|
||||
if (SearchListBox.Items.Count > 0)
|
||||
{
|
||||
if (SearchListBox.SelectedIndex > 0)
|
||||
{
|
||||
SearchListBox.SelectedIndex -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StartupSelectionItem()
|
||||
{
|
||||
if (SearchListBox.SelectedItem != null)
|
||||
{
|
||||
IconInfo icon = SearchListBox.SelectedItem as IconInfo;
|
||||
if (icon.AdminStartUp)
|
||||
{
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SearchListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
SearchListBox.ScrollIntoView(SearchListBox.SelectedItem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询结果ICON鼠标移动事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SearchIcon_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
//控制首次刷新搜索结果后, 鼠标首次移动后显示popup
|
||||
RunTimeStatus.MOUSE_MOVE_COUNT++;
|
||||
|
||||
//防止移动后不刷新popup content
|
||||
IconInfo info = (sender as Panel).Tag as IconInfo;
|
||||
MainWindow.mainWindow.RightCard.MyPoptipContent.Text = info.Content;
|
||||
MainWindow.mainWindow.RightCard.MyPoptip.VerticalOffset = 30;
|
||||
|
||||
if (RunTimeStatus.MOUSE_MOVE_COUNT > 1 && !RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询结果 ICON 鼠标进入事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SearchIcon_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
//显示popup
|
||||
RunTimeStatus.MOUSE_ENTER_ICON = true;
|
||||
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
IconInfo info = (sender as Panel).Tag as IconInfo;
|
||||
MainWindow.mainWindow.RightCard.MyPoptipContent.Text = info.Content;
|
||||
MainWindow.mainWindow.RightCard.MyPoptip.VerticalOffset = 30;
|
||||
Thread.Sleep(100);
|
||||
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL && RunTimeStatus.MOUSE_MOVE_COUNT > 1)
|
||||
{
|
||||
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = true;
|
||||
}
|
||||
}));
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询结果ICON鼠标离开事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SearchIcon_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
RunTimeStatus.MOUSE_ENTER_ICON = false;
|
||||
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 搜索结果icon 列表鼠标滚轮预处理时间
|
||||
/// 主要使用自定义popup解决卡顿问题解决卡顿问题
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void VerticalIconList_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
//控制在滚动时不显示popup 否则会在低GPU性能机器上造成卡顿
|
||||
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = false;
|
||||
if (RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 500;
|
||||
}
|
||||
else
|
||||
{
|
||||
RunTimeStatus.ICONLIST_MOUSE_WHEEL = true;
|
||||
|
||||
new Thread(() =>
|
||||
{
|
||||
while (RunTimeStatus.MOUSE_WHEEL_WAIT_MS > 0)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
RunTimeStatus.MOUSE_WHEEL_WAIT_MS -= 1;
|
||||
}
|
||||
if (RunTimeStatus.MOUSE_ENTER_ICON)
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindow.mainWindow.RightCard.MyPoptip.IsOpen = true;
|
||||
}));
|
||||
}
|
||||
RunTimeStatus.MOUSE_WHEEL_WAIT_MS = 100;
|
||||
RunTimeStatus.ICONLIST_MOUSE_WHEEL = false;
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (MainWindow.appData.AppConfig.DoubleOpen)
|
||||
{
|
||||
IconClick(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!MainWindow.appData.AppConfig.DoubleOpen)
|
||||
{
|
||||
IconClick(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图标点击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void IconClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (MainWindow.appData.AppConfig.DoubleOpen && e.ClickCount >= 2)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((Panel)sender).Tag;
|
||||
if (icon.AdminStartUp)
|
||||
{
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
|
||||
}
|
||||
}
|
||||
else if (!MainWindow.appData.AppConfig.DoubleOpen && e.ClickCount == 1)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((Panel)sender).Tag;
|
||||
if (icon.AdminStartUp)
|
||||
{
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static volatile bool EveryThingRuning = false;
|
||||
private void VerticalCard_ScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||
{
|
||||
if (MainWindow.appData.AppConfig.EnableEveryThing == true && EveryThingUtil.HasNext())
|
||||
{
|
||||
HandyControl.Controls.ScrollViewer sv = sender as HandyControl.Controls.ScrollViewer;
|
||||
if (sv.ExtentHeight - (sv.ActualHeight + sv.VerticalOffset) < 100
|
||||
&& EveryThingUtil.HasNext()
|
||||
&& !EveryThingRuning)
|
||||
{
|
||||
EveryThingRuning = true;
|
||||
MainWindow.mainWindow.RightCard.Loading_RightCard.Visibility = Visibility.Visible;
|
||||
int everyThingCount = Convert.ToInt32(MainWindow.mainWindow.EverythingSearchCount.Text);
|
||||
|
||||
ObservableCollection<IconInfo> resList = this.DataContext as ObservableCollection<IconInfo>;
|
||||
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
{
|
||||
ObservableCollection<IconInfo> searchRes = EveryThingUtil.NextPage();
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
everyThingCount += searchRes.Count;
|
||||
MainWindow.mainWindow.EverythingSearchCount.Text = Convert.ToString(everyThingCount);
|
||||
foreach (IconInfo info in searchRes)
|
||||
{
|
||||
resList.Add(info);
|
||||
}
|
||||
MainWindow.mainWindow.RightCard.Loading_RightCard.Visibility = Visibility.Collapsed;
|
||||
EveryThingRuning = false;
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 管理员方式启动
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void IconAdminStart(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开文件所在位置
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ShowInExplore(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
|
||||
}
|
||||
|
||||
|
||||
private void SystemContextMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
|
||||
DirectoryInfo[] folders = new DirectoryInfo[1];
|
||||
folders[0] = new DirectoryInfo(icon.Path);
|
||||
ShellContextMenu scm = new ShellContextMenu();
|
||||
System.Drawing.Point p = System.Windows.Forms.Cursor.Position;
|
||||
p.X -= 80;
|
||||
p.Y -= 80;
|
||||
scm.ShowContextMenu(folders, p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,75 +4,91 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
Background="AliceBlue"
|
||||
Background="Transparent"
|
||||
d:DesignHeight="400" d:DesignWidth="500">
|
||||
|
||||
<UserControl.Resources>
|
||||
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
|
||||
</UserControl.Resources>
|
||||
<hc:SimplePanel Margin="20,50,20,20">
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
|
||||
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk "/>
|
||||
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
|
||||
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
||||
<Grid MouseDown="DragMove">
|
||||
<hc:SimplePanel Margin="20,50,20,20" >
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<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"/>
|
||||
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
|
||||
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
||||
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
|
||||
|
||||
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Demo-liu"
|
||||
Command="hc:ControlCommands.OpenLink"
|
||||
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
|
||||
Margin="0,0,10,0" Color="#24292F"/>
|
||||
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Demo-liu"
|
||||
Command="hc:ControlCommands.OpenLink"
|
||||
CommandParameter=""
|
||||
Margin="0,5,10,0" Color="#C71D23"/>
|
||||
|
||||
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" HorizontalAlignment="Center" Margin="0,5,0,0">
|
||||
<hc:Shield Subject="公众号" Visibility="Visible" Status="抓几个娃" Margin="0,0,5,0" Color="#04913B">
|
||||
<hc:Poptip.Instance>
|
||||
<hc:Poptip PlacementType="Top">
|
||||
<hc:Poptip.Content>
|
||||
<Image x:Name="PublicWeChat" Width="150" Height="150" />
|
||||
</hc:Poptip.Content>
|
||||
</hc:Poptip>
|
||||
</hc:Poptip.Instance>
|
||||
</hc:Shield>
|
||||
<hc:Shield Subject="赞赏" Status="支付宝" Margin="0,0,10,0" Color="#1577FE">
|
||||
<hc:Poptip.Instance>
|
||||
<hc:Poptip PlacementType="Top">
|
||||
<hc:Poptip.Content>
|
||||
<Image x:Name="ZFBCode" Width="150" Height="150" />
|
||||
</hc:Poptip.Content>
|
||||
</hc:Poptip>
|
||||
</hc:Poptip.Instance>
|
||||
</hc:Shield>
|
||||
<hc:Shield Subject="赞赏" Status="微信" Margin="0,0,10,0" Color="#04913B">
|
||||
<hc:Poptip.Instance>
|
||||
<hc:Poptip PlacementType="Top">
|
||||
<hc:Poptip.Content>
|
||||
<Image x:Name="WeChatCode" Width="150" Height="150" />
|
||||
</hc:Poptip.Content>
|
||||
</hc:Poptip>
|
||||
</hc:Poptip.Instance>
|
||||
</hc:Shield>
|
||||
</hc:UniformSpacingPanel>
|
||||
<TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center" Text="这是个人开发的程序,所有人可任意修改和免费使用(商用请联系作者)" TextWrapping="Wrap"/>
|
||||
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Star"
|
||||
MouseEnter="SC_MouseEnter"
|
||||
MouseLeave="SC_MouseLeave"
|
||||
Command="hc:ControlCommands.OpenLink"
|
||||
CommandParameter="https://github.com/BookerLiu/GeekDesk"
|
||||
Margin="0,0,10,0" Color="#24292F"
|
||||
/>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Visibility="Visible" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
|
||||
<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 Spacing="10" HorizontalAlignment="Center" Margin="0,5,0,0">
|
||||
<hc:Shield x:Name="PublicWeChatPanel" Subject="公众号" Visibility="Visible" Status="抓几个娃" Margin="0,0,5,0" Color="#04913B">
|
||||
<hc:Poptip.Instance>
|
||||
<hc:Poptip PlacementType="Top" >
|
||||
<hc:Poptip.Content>
|
||||
<Image x:Name="PublicWeChat" Width="150" Height="150" />
|
||||
</hc:Poptip.Content>
|
||||
|
||||
</hc:Poptip>
|
||||
</hc:Poptip.Instance>
|
||||
</hc:Shield>
|
||||
<hc:Shield Subject="赞赏" Status="支付宝" Margin="0,0,10,0" Color="#1577FE">
|
||||
<hc:Poptip.Instance>
|
||||
<hc:Poptip PlacementType="Top">
|
||||
<hc:Poptip.Content>
|
||||
<Image x:Name="ZFBCode" Width="150" Height="150" />
|
||||
</hc:Poptip.Content>
|
||||
</hc:Poptip>
|
||||
</hc:Poptip.Instance>
|
||||
</hc:Shield>
|
||||
<hc:Shield Subject="赞赏" Status="微信" Margin="0,0,10,0" Color="#04913B">
|
||||
<hc:Poptip.Instance>
|
||||
<hc:Poptip PlacementType="Top">
|
||||
<hc:Poptip.Content>
|
||||
<Image x:Name="WeChatCode" Width="150" Height="150" />
|
||||
</hc:Poptip.Content>
|
||||
</hc:Poptip>
|
||||
</hc:Poptip.Instance>
|
||||
</hc:Shield>
|
||||
</hc:UniformSpacingPanel>
|
||||
<TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center" Text="这是个人开发的程序,所有人可任意修改和免费使用(商用请联系作者)" TextWrapping="Wrap"/>
|
||||
|
||||
<!--<hc:UniformSpacingPanel Spacing="10" Visibility="Visible" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
|
||||
<TextBlock Text="更新源:" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="Gitee"
|
||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=1}"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="GitHub"
|
||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</hc:SimplePanel>
|
||||
</hc:UniformSpacingPanel>-->
|
||||
</StackPanel>
|
||||
</hc:SimplePanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</UserControl>
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
using System;
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using System.Configuration;
|
||||
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;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.Constant;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
@@ -27,9 +16,41 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
InitializeComponent();
|
||||
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);
|
||||
WeChatCode.Source = ImageUtil.Base64ToBitmapImage(Constants.WE_CHAT_CODE_IMG_BASE64);
|
||||
ZFBCode.Source = ImageUtil.Base64ToBitmapImage(Constants.ZFB_CODE_IMG_BASE64);
|
||||
}
|
||||
|
||||
|
||||
/// <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 SC_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.Hand;
|
||||
}
|
||||
private void SC_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.Arrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,82 +4,164 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
Background="AliceBlue"
|
||||
d:DesignHeight="300" d:DesignWidth="450">
|
||||
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"
|
||||
d:DesignHeight="450" d:DesignWidth="450">
|
||||
|
||||
<UserControl.Resources>
|
||||
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
||||
<cvt:SearchTypeConvert x:Key="SearchTypeConvert"/>
|
||||
</UserControl.Resources>
|
||||
<hc:SimplePanel Margin="20">
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,0,10" Grid.ColumnSpan="4">
|
||||
<Grid Background="Transparent" MouseDown="DragMove"
|
||||
>
|
||||
<StackPanel Panel.ZIndex="1" hc:Growl.GrowlParent="True" hc:Growl.Token="HotKeyGrowl"></StackPanel>
|
||||
|
||||
<StackPanel Margin="10">
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="面板动作设置" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,26.394,0,-16.394" Grid.ColumnSpan="4">
|
||||
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
|
||||
x:Name="IconIsAdmin"
|
||||
Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,50,0,-102.337" Grid.ColumnSpan="4">
|
||||
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
|
||||
Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,89.49,-30,-79.49" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="面板关闭方式" VerticalAlignment="Center" Margin="-26,0,26,0"/>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
|
||||
Content="鼠标中键呼出"
|
||||
Click="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,115,20,-102.337" Grid.ColumnSpan="4">
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
|
||||
Content="双击启动" IsChecked="{Binding DoubleOpen}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
|
||||
Content="悬停切换菜单" IsChecked="{Binding HoverMenu}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}"
|
||||
Content="贴边隐藏" IsChecked="{Binding MarginHide}"
|
||||
Click="MarginHide_Changed"/>
|
||||
</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"
|
||||
Style="{StaticResource MyRadioBtnStyle}"
|
||||
Content="失去焦点后"
|
||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="运行项目后"
|
||||
|
||||
<RadioButton Margin="10,0,0,0"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="运行项目后"
|
||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=2}"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="手动关闭"
|
||||
<RadioButton Margin="10,0,0,0"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="手动关闭"
|
||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,164.49,-30,-154.49" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="热键设置" VerticalAlignment="Center" Margin="-26,0,26,0"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,193,0,-180.337" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板:" Width="55"/>
|
||||
<hc:TextBox HorizontalAlignment="Left"
|
||||
Tag="Main"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="200"
|
||||
Text="{Binding HotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
Margin="12.967,-7.38,-12.967,0"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<!--<hc:UniformSpacingPanel Spacing="10" Margin="30,229,0,-216.337" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="新建待办:" Width="55"/>
|
||||
<hc:TextBox HorizontalAlignment="Left"
|
||||
Tag="ToDo"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="200"
|
||||
Text="{Binding ToDoHotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
Margin="12.967,-7.38,-12.967,0"/>
|
||||
</hc:UniformSpacingPanel>-->
|
||||
<StackPanel hc:Growl.GrowlParent="True" hc:Growl.Token="HotKeyGrowl" VerticalAlignment="Top"/>
|
||||
</hc:SimplePanel>
|
||||
|
||||
<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"
|
||||
hc:Poptip.Content="主面板显示时按下Ctrl+F开始搜索"
|
||||
hc:Poptip.Placement="Top"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="快捷键"
|
||||
IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=0}"/>
|
||||
<RadioButton Margin="10,0,0,0"
|
||||
hc:Poptip.Content="主面板显示时按下按键直接搜索"
|
||||
hc:Poptip.Placement="Top"
|
||||
Style="{StaticResource MyRadioBtnStyle}" 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">
|
||||
<TextBlock Text="热键设置" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板:" VerticalAlignment="Center" Margin="0,5,0,0" Width="55"/>
|
||||
<hc:TextBox HorizontalAlignment="Left"
|
||||
Style="{StaticResource MyTextBoxStyle}"
|
||||
Tag="{x:Static cst:HotKeyType.Main}"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="170"
|
||||
Text="{Binding HotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
/>
|
||||
|
||||
<CheckBox Content="启用"
|
||||
Style="{StaticResource MyCheckBoxStyle}"
|
||||
Click="EnableHotKey_Click"
|
||||
Tag="{x:Static cst:HotKeyType.Main}"
|
||||
IsChecked="{Binding EnableAppHotKey}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="待办任务:" Margin="0,5,0,0" Width="55"/>
|
||||
<hc:TextBox HorizontalAlignment="Left"
|
||||
Style="{StaticResource MyTextBoxStyle}"
|
||||
Tag="{x:Static cst:HotKeyType.ToDo}"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="170"
|
||||
Text="{Binding ToDoHotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
/>
|
||||
|
||||
<CheckBox Content="启用"
|
||||
Style="{StaticResource MyCheckBoxStyle}"
|
||||
Click="EnableHotKey_Click"
|
||||
Tag="{x:Static cst:HotKeyType.ToDo}"
|
||||
IsChecked="{Binding EnableTodoHotKey}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="拾色器:" Margin="0,5,0,0" Width="55"/>
|
||||
<hc:TextBox HorizontalAlignment="Left"
|
||||
Style="{StaticResource MyTextBoxStyle}"
|
||||
Tag="{x:Static cst:HotKeyType.ColorPicker}"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="170"
|
||||
Text="{Binding ColorPickerHotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
/>
|
||||
<CheckBox Content="启用"
|
||||
Style="{StaticResource MyCheckBoxStyle}"
|
||||
Tag="{x:Static cst:HotKeyType.ColorPicker}"
|
||||
Click="EnableHotKey_Click"
|
||||
IsChecked="{Binding EnableColorPickerHotKey}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</UserControl>
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.MyThread;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Data;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
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;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
@@ -28,9 +18,9 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
public partial class MotionControl : UserControl
|
||||
{
|
||||
public static bool hotkeyFinished = true; //热键设置结束
|
||||
private static KeyEventArgs prevKeyTemp; //上一个按键
|
||||
private static List<KeyEventArgs> keysTemp = new List<KeyEventArgs>();//存储一次快捷键集合
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
private Key prevKeyTemp = Key.None; //上一个按键
|
||||
private readonly List<KeyEventArgs> keysTemp = new List<KeyEventArgs>();//存储一次快捷键集合
|
||||
private readonly AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
|
||||
public MotionControl()
|
||||
{
|
||||
@@ -45,98 +35,140 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
/// <param name="e"></param>
|
||||
private void HotKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
string tag = (sender as TextBox).Tag.ToString();
|
||||
|
||||
bool main = false;
|
||||
if ("Main".Equals(tag))
|
||||
lock (this)
|
||||
{
|
||||
main = true;
|
||||
}
|
||||
HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
|
||||
|
||||
if (!e.IsRepeat)
|
||||
{
|
||||
if (hotkeyFinished)
|
||||
Key downKey = e.Key;
|
||||
if (downKey == Key.System)
|
||||
{
|
||||
if (main)
|
||||
{
|
||||
appConfig.Hotkey = 0;
|
||||
appConfig.HotkeyStr = "";
|
||||
appConfig.HotkeyModifiers = 0;
|
||||
} else
|
||||
{
|
||||
appConfig.ToDoHotkey = 0;
|
||||
appConfig.ToDoHotkeyStr = "";
|
||||
appConfig.ToDoHotkeyModifiers = 0;
|
||||
}
|
||||
hotkeyFinished = false;
|
||||
downKey = e.SystemKey;
|
||||
}
|
||||
|
||||
}
|
||||
//首次按下按键
|
||||
if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|
||||
|| (!main && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0)))
|
||||
if (!CheckIsEnable(hkType)) return;
|
||||
|
||||
|
||||
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
|
||||
{
|
||||
if (CheckModifierKeys(e))
|
||||
if (hotkeyFinished)
|
||||
{
|
||||
//辅助键
|
||||
if (main)
|
||||
switch (hkType)
|
||||
{
|
||||
appConfig.HotkeyStr = GetKeyName(e);
|
||||
appConfig.HotkeyModifiers = GetModifierKeys(e);
|
||||
} else
|
||||
{
|
||||
appConfig.ToDoHotkeyStr = GetKeyName(e);
|
||||
appConfig.ToDoHotkeyModifiers = GetModifierKeys(e);
|
||||
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;
|
||||
}
|
||||
prevKeyTemp = e;
|
||||
keysTemp.Add(e);
|
||||
hotkeyFinished = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//非首次按下 需要判断前一个键值是否为辅助键
|
||||
if (CheckModifierKeys(prevKeyTemp)
|
||||
&& ((e.Key >= Key.A && e.Key <= Key.Z)
|
||||
|| (e.Key >= Key.F1 && e.Key <= Key.F12)
|
||||
|| (e.Key >= Key.D0 && e.Key <= Key.D9)))
|
||||
|
||||
//首次按下按键
|
||||
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 (main)
|
||||
if (CheckModifierKeys(downKey))
|
||||
{
|
||||
appConfig.Hotkey = e.Key;
|
||||
appConfig.HotkeyStr += e.Key.ToString();
|
||||
} else
|
||||
{
|
||||
appConfig.ToDoHotkey = e.Key;
|
||||
appConfig.ToDoHotkeyStr += e.Key.ToString();
|
||||
//辅助键
|
||||
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);
|
||||
}
|
||||
prevKeyTemp = e;
|
||||
keysTemp.Add(e);
|
||||
}
|
||||
else if (CheckModifierKeys(e))
|
||||
else
|
||||
{
|
||||
if (main)
|
||||
//非首次按下 需要判断前一个键值是否为辅助键
|
||||
if (CheckModifierKeys(prevKeyTemp)
|
||||
&& ((downKey >= Key.A && downKey <= Key.Z)
|
||||
|| (downKey >= Key.F1 && downKey <= Key.F12)
|
||||
|| (downKey >= Key.D0 && downKey <= Key.D9)
|
||||
|| downKey == Key.Oem3
|
||||
))
|
||||
{
|
||||
appConfig.HotkeyStr += GetKeyName(e);
|
||||
appConfig.HotkeyModifiers |= GetModifierKeys(e);
|
||||
} else
|
||||
{
|
||||
appConfig.ToDoHotkeyStr += GetKeyName(e);
|
||||
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(e);
|
||||
KeyUtil.KeyProp keyProp = new KeyUtil.KeyProp();
|
||||
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 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);
|
||||
}
|
||||
|
||||
prevKeyTemp = e;
|
||||
keysTemp.Add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetKeyName(KeyEventArgs e)
|
||||
private string GetKeyName(Key key)
|
||||
{
|
||||
Key key = e.Key;
|
||||
if (key == Key.LeftCtrl || key == Key.RightCtrl)
|
||||
{
|
||||
return "Ctrl + ";
|
||||
} else if (key == Key.LWin || key == Key.RWin)
|
||||
}
|
||||
else if (key == Key.LWin || key == Key.RWin)
|
||||
{
|
||||
return "Win + ";
|
||||
}
|
||||
@@ -148,12 +180,10 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
return "Alt + ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private HotkeyModifiers GetModifierKeys(KeyEventArgs e)
|
||||
private HotkeyModifiers GetModifierKeys(Key key)
|
||||
{
|
||||
Key key = e.Key;
|
||||
if (key == Key.LeftCtrl || key == Key.RightCtrl)
|
||||
{
|
||||
return HotkeyModifiers.MOD_CONTROL;
|
||||
@@ -172,9 +202,8 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckModifierKeys(KeyEventArgs e)
|
||||
private bool CheckModifierKeys(Key key)
|
||||
{
|
||||
Key key = e.Key;
|
||||
return key == Key.LeftCtrl || key == Key.RightCtrl
|
||||
|| key == Key.LWin || key == Key.RWin
|
||||
|| key == Key.LeftShift || key == Key.RightShift
|
||||
@@ -182,16 +211,10 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
private void HotKeyUp(object sender, KeyEventArgs e)
|
||||
//[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
private void HotKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
string tag = (sender as TextBox).Tag.ToString();
|
||||
bool main = false;
|
||||
if ("Main".Equals(tag))
|
||||
{
|
||||
main = true;
|
||||
}
|
||||
lock(this)
|
||||
lock (this)
|
||||
{
|
||||
bool allKeyUp = true;
|
||||
//判断所有键是否都松开
|
||||
@@ -206,89 +229,155 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
if (allKeyUp && !hotkeyFinished)
|
||||
{
|
||||
keysTemp.Clear();
|
||||
prevKeyTemp = Key.None;
|
||||
hotkeyFinished = true;
|
||||
|
||||
if (main)
|
||||
HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
|
||||
if (!CheckIsEnable(hkType)) return;
|
||||
|
||||
switch (hkType)
|
||||
{
|
||||
if (MainWindow.hotKeyId != -1)
|
||||
{
|
||||
Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
|
||||
}
|
||||
MainWindow.RegisterHotKey(false);
|
||||
} else
|
||||
{
|
||||
if (MainWindow.toDoHotKeyId != -1)
|
||||
{
|
||||
Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
||||
}
|
||||
MainWindow.RegisterCreateToDoHotKey(false);
|
||||
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 void ShowApp(MainWindow mainWindow)
|
||||
//{
|
||||
// if (appConfig.FollowMouse)
|
||||
// {
|
||||
// ShowAppAndFollowMouse(mainWindow);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.Visibility = Visibility.Visible;
|
||||
// }
|
||||
// Keyboard.Focus(this);
|
||||
//}
|
||||
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>
|
||||
//private void ShowAppAndFollowMouse(MainWindow mainWindow)
|
||||
//{
|
||||
// //获取鼠标位置
|
||||
// System.Windows.Point p = MouseUtil.GetMousePosition();
|
||||
// double left = SystemParameters.VirtualScreenLeft;
|
||||
// double top = SystemParameters.VirtualScreenTop;
|
||||
// double width = SystemParameters.VirtualScreenWidth;
|
||||
// double height = SystemParameters.VirtualScreenHeight;
|
||||
// double right = width - Math.Abs(left);
|
||||
// double bottom = height - Math.Abs(top);
|
||||
/// <summary>
|
||||
/// 移动窗口
|
||||
/// </summary>
|
||||
/// <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 MarginHide_Changed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (appConfig.MarginHide)
|
||||
{
|
||||
MarginHide.StartHide();
|
||||
}
|
||||
else
|
||||
{
|
||||
MarginHide.StopHide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (p.X - mainWindow.Width / 2 < left)
|
||||
// {
|
||||
// //判断是否在最左边缘
|
||||
// mainWindow.Left = left;
|
||||
// }
|
||||
// else if (p.X + mainWindow.Width / 2 > right)
|
||||
// {
|
||||
// //判断是否在最右边缘
|
||||
// mainWindow.Left = right - mainWindow.Width;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// mainWindow.Left = p.X - mainWindow.Width / 2;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标中键呼出 change
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void MouseMiddle_Changed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//if (appConfig.MouseMiddleShow)
|
||||
//{
|
||||
// MouseHookThread.MiddleHook();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MouseHookThread.DisposeMiddle();
|
||||
//}
|
||||
|
||||
// if (p.Y - mainWindow.Height / 2 < top)
|
||||
// {
|
||||
// //判断是否在最上边缘
|
||||
// mainWindow.Top = top;
|
||||
// }
|
||||
// else if (p.Y + mainWindow.Height / 2 > bottom)
|
||||
// {
|
||||
// //判断是否在最下边缘
|
||||
// mainWindow.Top = bottom - mainWindow.Height;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// mainWindow.Top = p.Y - mainWindow.Height / 2;
|
||||
// }
|
||||
MouseHookThread.Dispose();
|
||||
MouseHookThread.Hook();
|
||||
}
|
||||
|
||||
// mainWindow.Visibility = Visibility.Visible;
|
||||
//}
|
||||
/// <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,41 +5,117 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
|
||||
mc:Ignorable="d"
|
||||
Background="AliceBlue"
|
||||
Background="Transparent"
|
||||
d:DesignHeight="400" d:DesignWidth="500"
|
||||
>
|
||||
|
||||
<UserControl.Resources>
|
||||
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
|
||||
<cvt:SortTypeConvert x:Key="SortTypeConvert"/>
|
||||
</UserControl.Resources>
|
||||
<hc:SimplePanel Margin="20">
|
||||
<StackPanel >
|
||||
<TextBlock Text="程序设置" />
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0">
|
||||
<CheckBox x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
<TextBlock Text="更新源" Margin="0,20,0,0"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0">
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
||||
<Grid MouseDown="DragMove" Background="Transparent">
|
||||
<hc:SimplePanel Margin="20" >
|
||||
<StackPanel >
|
||||
<TextBlock Text="程序设置" />
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
|
||||
<CheckBox Content="性能模式"
|
||||
Style="{StaticResource MyCheckBoxStyle}"
|
||||
IsChecked="{Binding PMModel}"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
hc:Poptip.Content="开启性能模式将取消图标动画效果"
|
||||
hc:Poptip.Placement="Top"
|
||||
/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<TextBlock Text="插件" Margin="0,20,0,0"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
|
||||
<CheckBox Content="时钟显秒"
|
||||
Style="{StaticResource MyCheckBoxStyle}"
|
||||
Click="ShowSeconds_Click" IsChecked="{Binding SecondsWindow}"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
hc:Poptip.Content="仅Win11有效"
|
||||
hc:Poptip.Placement="Top"
|
||||
/>
|
||||
<CheckBox Content="EveryThing搜索"
|
||||
Style="{StaticResource MyCheckBoxStyle}"
|
||||
Click="EveryThing_Changed" IsChecked="{Binding EnableEveryThing}"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
hc:Poptip.Content="勾选后若弹出用户帐户控制请选择是"
|
||||
hc:Poptip.Placement="Top"
|
||||
/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<TextBlock Text="排序方式" Margin="0,25,0,0"/>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||
<RadioButton x:Name="CustomSort" Margin="10,0,0,0"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="自定义"
|
||||
Tag="1"
|
||||
hc:IconElement.Geometry="{StaticResource CustomSort}"
|
||||
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
|
||||
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=1}"/>
|
||||
|
||||
<RadioButton x:Name="CountUpSort" Margin="10,0,0,0"
|
||||
hc:IconElement.Geometry="{StaticResource UpSort}"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="使用次数"
|
||||
Tag="2"
|
||||
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
|
||||
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=2}"/>
|
||||
|
||||
<RadioButton x:Name="CountLowSort" Margin="10,0,0,0" Visibility="Collapsed"
|
||||
hc:IconElement.Geometry="{StaticResource LowSort}"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="使用次数"
|
||||
Tag="3"
|
||||
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
|
||||
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=3}"/>
|
||||
|
||||
<RadioButton x:Name="NameUpSort" Margin="10,0,0,0"
|
||||
hc:IconElement.Geometry="{StaticResource UpSort}"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="名称"
|
||||
Tag="4"
|
||||
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
|
||||
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=4}"/>
|
||||
|
||||
<RadioButton x:Name="NameLowSort" Margin="10,0,0,0" Visibility="Collapsed"
|
||||
hc:IconElement.Geometry="{StaticResource LowSort}"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="名称"
|
||||
Tag="5"
|
||||
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
|
||||
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=5}"/>
|
||||
|
||||
</hc:UniformSpacingPanel>
|
||||
<TextBlock Text="更新源" Margin="0,25,0,0"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||
<RadioButton Margin="10,0,0,0"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="Gitee"
|
||||
hc:IconElement.Geometry="{StaticResource Gitee}"
|
||||
Foreground="#B32225"
|
||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=1}"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
<RadioButton Margin="10,0,0,0"
|
||||
hc:IconElement.Geometry="{StaticResource GitHub}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="GitHub"
|
||||
Foreground="Black"
|
||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</hc:SimplePanel>
|
||||
</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="Top"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
Style="{StaticResource MyBtnStyle}"
|
||||
Click="BakDataFile"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</hc:SimplePanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</UserControl>
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.MyThread;
|
||||
using GeekDesk.Plugins.EveryThing;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using ShowSeconds;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Management;
|
||||
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.Config
|
||||
{
|
||||
@@ -26,6 +22,13 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
public OtherControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Loaded += OtherControl_Loaded;
|
||||
|
||||
}
|
||||
|
||||
private void OtherControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Sort_Check();
|
||||
}
|
||||
|
||||
private void SelfStartUpBox_Click(object sender, RoutedEventArgs e)
|
||||
@@ -33,5 +36,171 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
RegisterUtil.SetSelfStarting(appConfig.SelfStartUp, Constants.MY_NAME);
|
||||
}
|
||||
|
||||
/// <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 SortType_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
RadioButton rb = sender as RadioButton;
|
||||
SortType type = (SortType)int.Parse(rb.Tag.ToString());
|
||||
|
||||
SortType resType = type;
|
||||
switch (type)
|
||||
{
|
||||
case SortType.CUSTOM:
|
||||
break;
|
||||
case SortType.COUNT_UP:
|
||||
if (rb.IsChecked == true)
|
||||
{
|
||||
CountLowSort.IsChecked = true;
|
||||
CountUpSort.Visibility = Visibility.Collapsed;
|
||||
CountLowSort.Visibility = Visibility.Visible;
|
||||
resType = SortType.COUNT_LOW;
|
||||
}
|
||||
break;
|
||||
case SortType.COUNT_LOW:
|
||||
if (rb.IsChecked == true)
|
||||
{
|
||||
CountUpSort.IsChecked = true;
|
||||
CountLowSort.Visibility = Visibility.Collapsed;
|
||||
CountUpSort.Visibility = Visibility.Visible;
|
||||
resType = SortType.COUNT_UP;
|
||||
}
|
||||
break;
|
||||
case SortType.NAME_UP:
|
||||
if (rb.IsChecked == true)
|
||||
{
|
||||
NameLowSort.IsChecked = true;
|
||||
NameUpSort.Visibility = Visibility.Collapsed;
|
||||
NameLowSort.Visibility = Visibility.Visible;
|
||||
resType = SortType.NAME_LOW;
|
||||
}
|
||||
break;
|
||||
case SortType.NAME_LOW:
|
||||
if (rb.IsChecked == true)
|
||||
{
|
||||
NameUpSort.IsChecked = true;
|
||||
NameLowSort.Visibility = Visibility.Collapsed;
|
||||
NameUpSort.Visibility = Visibility.Visible;
|
||||
resType = SortType.NAME_UP;
|
||||
}
|
||||
break;
|
||||
}
|
||||
MainWindow.appData.AppConfig.IconSortType = resType;
|
||||
CommonCode.SortIconList();
|
||||
}
|
||||
|
||||
private void Sort_Check()
|
||||
{
|
||||
if (NameLowSort.IsChecked == true)
|
||||
{
|
||||
NameUpSort.Visibility = Visibility.Collapsed;
|
||||
NameLowSort.Visibility = Visibility.Visible;
|
||||
}
|
||||
if (CountLowSort.IsChecked == true)
|
||||
{
|
||||
CountUpSort.Visibility = Visibility.Collapsed;
|
||||
CountLowSort.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
else
|
||||
{
|
||||
SecondsWindow.CloseWindow();
|
||||
//StopSecondsWindow();
|
||||
}
|
||||
}
|
||||
|
||||
public static void StopSecondsWindow()
|
||||
{
|
||||
if (MessageUtil.CheckWindowIsRuning("ShowSeconds_Main_" + Constants.MY_UUID))
|
||||
{
|
||||
MessageUtil.SendMsgByWName(
|
||||
"ShowSeconds_Main_" + Constants.MY_UUID,
|
||||
"Shutdown"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static void StartSecondsWindow()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var objOS = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem"))
|
||||
{
|
||||
foreach (ManagementObject objMgmt in objOS.Get())
|
||||
{
|
||||
if (objMgmt.Properties["Caption"].Value != null)
|
||||
{
|
||||
string caption = objMgmt.Properties["Caption"].Value.ToString(); ;
|
||||
LogUtil.WriteLog("获取的系统版本号为:" + caption);
|
||||
if (caption.Contains("Windows 11"))
|
||||
{
|
||||
//找到ShowSeconds插件
|
||||
FileInfo fi = FileUtil.GetFileByNameWithDir("ShowSeconds.exe", Constants.PLUGINS_PATH);
|
||||
if (fi == null)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("未安装程序插件:ShowSeconds");
|
||||
}
|
||||
else
|
||||
{
|
||||
//检查是否在运行
|
||||
if (!MessageUtil.CheckWindowIsRuning("ShowSeconds_Main_" + Constants.MY_UUID))
|
||||
{
|
||||
using (Process p = new Process())
|
||||
{
|
||||
p.StartInfo.FileName = fi.FullName;
|
||||
p.StartInfo.WorkingDirectory = fi.FullName.Substring(0, fi.FullName.LastIndexOf("\\"));
|
||||
p.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EveryThing插件开关
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void EveryThing_Changed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MainWindow.appData.AppConfig.EnableEveryThing == true)
|
||||
{
|
||||
EveryThingUtil.EnableEveryThing(0);
|
||||
} else
|
||||
{
|
||||
EveryThingUtil.DisableEveryThing(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,101 +2,255 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.Config"
|
||||
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:cvt="clr-namespace:GeekDesk.Converts"
|
||||
mc:Ignorable="d"
|
||||
Background="AliceBlue"
|
||||
d:DesignHeight="380" d:DesignWidth="450">
|
||||
<hc:SimplePanel Margin="20">
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,-40,-12" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="19,20,-59,-31.5" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="图片路径:" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding BacImgName}" Width="200"
|
||||
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"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="19,60,11,-36.433" Grid.ColumnSpan="4">
|
||||
<CheckBox x:Name="IconIsAdmin" Content="毛玻璃效果" IsChecked="{Binding BlurEffect}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,91.5,0,34.5" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
|
||||
<StackPanel Margin="0,30,0,0">
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,80,-40,-89.5" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="托盘不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,110,-40,-122" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding CardOpacity}"
|
||||
Maximum="100"
|
||||
Margin="0,-12,-313.5,19.5"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
Background="Transparent"
|
||||
d:DesignHeight="500" d:DesignWidth="450">
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,135,-40,-161.626" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,155,-40,-183" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
||||
Maximum="100"
|
||||
Margin="0,0,-313.5,7.5"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
<UserControl.Resources>
|
||||
<cvt:BGStyleConvert x:Key="BGStyleConvert"/>
|
||||
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
|
||||
<cvt:TextToColorConverter x:Key="TextToColorConverter"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid Background="Transparent">
|
||||
<StackPanel Margin="20" >
|
||||
<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"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Click="BGStyle_Changed" Content="图 片"
|
||||
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=1}"/>
|
||||
<RadioButton Margin="10,0,0,0"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Click="BGStyle_Changed" Content="纯 色"
|
||||
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=2}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<UniformGrid x:Name="ImgBGConf">
|
||||
<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="修改" Style="{StaticResource MyBtnStyle}" Click="BGButton_Click"/>
|
||||
<Button Content="默认" Style="{StaticResource MyBtnStyle}" Click="DefaultButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,10,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="IconIsAdmin" Content="毛玻璃效果" Click="BGStyle_Changed" IsChecked="{Binding BlurEffect}"/>
|
||||
</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"/>
|
||||
<Rectangle Width="10" Height="10" Stroke="White" Margin="0,0,0,5" Fill="{Binding Path=GradientBGParam.Color1, Converter={StaticResource TextToColorConverter}}"/>
|
||||
<TextBlock Text="{Binding GradientBGParam.Color1, NotifyOnTargetUpdated=True, Mode=OneWay}"
|
||||
TargetUpdated="Color_TargetUpdated"
|
||||
Width="65"
|
||||
Margin="0,5,0,0"
|
||||
VerticalAlignment="Center"
|
||||
/>
|
||||
<Button Style="{StaticResource MyBtnStyle}"
|
||||
Content="设置"
|
||||
Tag="Color1"
|
||||
Click="ColorButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="色彩2:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||
<Rectangle Width="10" Height="10" Stroke="White" Margin="0,0,0,5" Fill="{Binding Path=GradientBGParam.Color2, Converter={StaticResource TextToColorConverter}}"/>
|
||||
<TextBlock Text="{Binding GradientBGParam.Color2, NotifyOnTargetUpdated=True, Mode=OneWay}"
|
||||
TargetUpdated="Color_TargetUpdated"
|
||||
Width="65"
|
||||
Margin="0,5,0,0"
|
||||
VerticalAlignment="Center"
|
||||
/>
|
||||
<Button Style="{StaticResource MyBtnStyle}"
|
||||
Content="设置" Tag="Color2"
|
||||
Click="ColorButton_Click"
|
||||
/>
|
||||
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel HorizontalAlignment="Center" Spacing="10" Grid.ColumnSpan="4">
|
||||
<Button Content="系统预设"
|
||||
Style="{StaticResource MyBtnStyle}"
|
||||
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"
|
||||
/>
|
||||
<Button Content="保存当前颜色到系统预设"
|
||||
Style="{StaticResource MyBtnStyle}"
|
||||
Margin="0,5,0,0"
|
||||
Click="NewBGBtn_Click"
|
||||
/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
</UniformGrid>
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,195,-40,-208.813" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,215,-40,-241" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding PannelOpacity}"
|
||||
Minimum="50"
|
||||
Maximum="100"
|
||||
Margin="0,0,-313.5,7.5"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
<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 Style="{StaticResource MyCheckBoxStyle}" Content="置于顶层" IsChecked="{Binding AlwaysTopmost}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="主窗口动画" IsChecked="{Binding AppAnimation}" Click="Animation_Checked"/>
|
||||
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="列表展开动画" IsChecked="{Binding ItemSpradeAnimation}"/>
|
||||
|
||||
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}" x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
|
||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="显示图标标题" IsChecked="{Binding ShowIconTitle, Mode=TwoWay}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
<StackPanel Margin="0,15,0,0">
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="卡片不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding CardOpacity}"
|
||||
Maximum="100"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</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">
|
||||
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
||||
ValueChanged="BGOpacity_ValueChanged"
|
||||
Maximum="100"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</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">
|
||||
<hc:PreviewSlider Value="{Binding PannelOpacity}"
|
||||
Minimum="50"
|
||||
Maximum="100"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</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">
|
||||
<hc:PreviewSlider Value="{Binding PannelCornerRadius}"
|
||||
Maximum="25"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</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"
|
||||
Background="#00FFFFFF"
|
||||
PreviewMouseLeftButtonDown="PreviewSlider_MouseLeftButtonUp"
|
||||
>
|
||||
<hc:PreviewSlider Value="{Binding ImageWidth, Mode=TwoWay}"
|
||||
Minimum="40"
|
||||
Maximum="60"
|
||||
Width="350"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
|
||||
<Rectangle Width="10" Height="10" Stroke="White" Margin="0,0,0,5" Fill="{Binding Path=TextColor, Converter={StaticResource TextToColorConverter}}"/>
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Foreground="{Binding TextColor}" Width="100"/>
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!--<StackPanel x:Name="ColorPanel" Panel.ZIndex="1"
|
||||
Visibility="Collapsed"
|
||||
Height="500"
|
||||
Width="450"
|
||||
VerticalAlignment="Center">
|
||||
<StackPanel.Background>
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
|
||||
</StackPanel.Background>-->
|
||||
|
||||
<!--<hc:ColorPicker Name="MyColorPicker"
|
||||
Canceled="MyColorPicker_Canceled"
|
||||
Confirmed="MyColorPicker_Confirmed"
|
||||
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>-->
|
||||
|
||||
<!--</StackPanel>-->
|
||||
</Grid>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,245,-40,-279.313" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,265,-40,-321" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding PannelCornerRadius}"
|
||||
Maximum="25"
|
||||
Margin="0,0,-313.5,7.5"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
|
||||
</hc:SimplePanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,31 +1,39 @@
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.Other;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.ObjectModel;
|
||||
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.Config
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// MotionControl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ThemeControl : System.Windows.Controls.UserControl
|
||||
{
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
|
||||
public ThemeControl()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
if (appConfig.BGStyle != BGStyle.GradientBac)
|
||||
{
|
||||
GradientBGConf.Visibility = Visibility.Collapsed;
|
||||
ImgBGConf.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImgBGConf.Visibility = Visibility.Collapsed;
|
||||
GradientBGConf.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,14 +43,13 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
/// <param name="e"></param>
|
||||
private void BGButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
|
||||
try
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
{
|
||||
Multiselect = false, //只允许选中单个文件
|
||||
Filter = "图像文件(*.png, *.jpg)|*.png;*.jpg;*.gif"
|
||||
Filter = "图像文件(*.png, *.jpg, *.gif)|*.png;*.jpg;*.gif"
|
||||
};
|
||||
if (ofd.ShowDialog() == true)
|
||||
{
|
||||
@@ -50,11 +57,126 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
appConfig.BacImgName = ofd.FileName;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUtil.WriteErrorLog(ex, "修改背景失败,已重置为默认背景!");
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||
}
|
||||
BGSettingUtil.BGSetting();
|
||||
}
|
||||
|
||||
|
||||
private void DefaultButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
appConfig.BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
|
||||
appConfig.BacImgName = "系统默认";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUtil.WriteErrorLog(ex, "修改背景失败2,已重置为默认背景!");
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||
}
|
||||
BGSettingUtil.BGSetting();
|
||||
}
|
||||
|
||||
|
||||
private void ColorButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string tag = (sender as Button).Tag.ToString();
|
||||
new MyColorPickerDialog(tag, "ConfigWindowDialog");
|
||||
}
|
||||
|
||||
|
||||
private void PreviewSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
CheckButtonUpClass cbu = new CheckButtonUpClass
|
||||
{
|
||||
e = e
|
||||
};
|
||||
System.Threading.ThreadStart ts = new System.Threading.ThreadStart(cbu.CheckButtonUp);
|
||||
System.Threading.Thread t = new System.Threading.Thread(ts);
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
private class CheckButtonUpClass
|
||||
{
|
||||
public MouseButtonEventArgs e;
|
||||
|
||||
public void CheckButtonUp()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Released)
|
||||
{
|
||||
App.Current.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
AppData appData = MainWindow.appData;
|
||||
ObservableCollection<IconInfo> selectIcons = appData.AppConfig.SelectedMenuIcons;
|
||||
appData.AppConfig.SelectedMenuIcons = null;
|
||||
appData.AppConfig.SelectedMenuIcons = selectIcons;
|
||||
}));
|
||||
return;
|
||||
}
|
||||
System.Threading.Thread.Sleep(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void BGStyle_Changed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BGSettingUtil.BGSetting();
|
||||
if (appConfig.BGStyle != BGStyle.GradientBac)
|
||||
{
|
||||
GradientBGConf.Visibility = Visibility.Collapsed;
|
||||
ImgBGConf.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImgBGConf.Visibility = Visibility.Collapsed;
|
||||
GradientBGConf.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存当前颜色到系统预设
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void NewBGBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BGNmaeDialog dialog = new BGNmaeDialog();
|
||||
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "ConfigWindowDialog");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.IconFont"
|
||||
mc:Ignorable="d"
|
||||
mc:Ignorable="d"
|
||||
Background="#00FFFFFF"
|
||||
>
|
||||
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<ListBox x:Name="IconListBox" ItemsSource="{Binding Iconfonts}" BorderThickness="0" Background="AliceBlue">
|
||||
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Top" Background="Transparent">
|
||||
<ListBox x:Name="IconListBox" ItemsSource="{Binding Iconfonts}" BorderThickness="0" Background="Transparent">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" Background="Transparent"/>
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
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.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.IconFont
|
||||
{
|
||||
|
||||
@@ -6,22 +6,32 @@
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:cst="clr-namespace:GeekDesk.Constant"
|
||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
>
|
||||
<UserControl.Resources>
|
||||
|
||||
<!--左侧栏样式动画-->
|
||||
<Style x:Key="MenuStyle" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItemBaseStyle}">
|
||||
<Setter Property="FontSize" Value="15"/>
|
||||
<Setter Property="FontSize" Value="16"/>
|
||||
<Setter Property="Margin" Value="0,0,0,1"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
<SolidColorBrush Color="Black" Opacity="0.01"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<EventSetter Event="MouseLeftButtonDown" Handler="MenuClick"/>
|
||||
<EventSetter Event="MouseRightButtonDown" Handler="MenuClick"/>
|
||||
<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}" />
|
||||
<EventSetter Event="MouseEnter" Handler="Menu_MouseEnter"/>
|
||||
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_MouseDown"/>
|
||||
<EventSetter Event="PreviewMouseRightButtonDown" Handler="ListBoxItem_PreviewMouseRightButtonDown"/>
|
||||
<!--<EventSetter Event="Unselected" Handler="Lbi_Unselected"/>-->
|
||||
<Style.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
@@ -30,8 +40,8 @@
|
||||
</MultiTrigger.Conditions>
|
||||
<MultiTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation To="15" Duration="0:0:0.5" Storyboard.TargetProperty="FontSize"/>
|
||||
<Storyboard Timeline.DesiredFrameRate="60">
|
||||
<DoubleAnimation To="16" Duration="0:0:0.2" Storyboard.TargetProperty="FontSize"/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiTrigger.EnterActions>
|
||||
@@ -42,28 +52,85 @@
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiTrigger.ExitActions>
|
||||
<MultiTrigger.Setters>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="Black" Opacity="0.01"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</MultiTrigger.Setters>
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#FFE4DBDB"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="Background" Value="#FFECECEC"/>
|
||||
|
||||
|
||||
<!--移到代码设置-->
|
||||
<!--<Trigger Property="IsSelected" Value="False">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#ECECEC"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>-->
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
<Setter Property="Background" Value="#00FFFFFF"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>
|
||||
|
||||
|
||||
</Style.Triggers>
|
||||
</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:OpcityConvert x:Key="OpcityConvert"/>
|
||||
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||
</UserControl.Resources>
|
||||
<Grid Background="Transparent">
|
||||
<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="Center" Text="Test" FontSize="14"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Popup>
|
||||
|
||||
<!--左侧栏-->
|
||||
<hc:Card x:Name="MyCard"
|
||||
BorderThickness="1"
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource EffectShadow2}"
|
||||
Margin="5,0,0,5"
|
||||
MouseDown="MyCard_MouseDown"
|
||||
PreviewMouseRightButtonDown="MyCard_PreviewMouseRightButtonDown"
|
||||
>
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
||||
|
||||
|
||||
</SolidColorBrush>
|
||||
</hc:Card.Background>
|
||||
<hc:Card.BorderBrush>
|
||||
@@ -72,29 +139,38 @@
|
||||
<hc:Card.ContextMenu>
|
||||
<ContextMenu Width="200">
|
||||
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
||||
<MenuItem Header="新建关联菜单" Click="CreateLinkMenu"/>
|
||||
<MenuItem x:Name="AlterPW1" Header="修改密码" Click="AlterPassword"/>
|
||||
</ContextMenu>
|
||||
</hc:Card.ContextMenu>
|
||||
|
||||
<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="menus_SelectionChanged"
|
||||
SelectionChanged="Menu_SelectionChanged"
|
||||
PreviewMouseWheel="Menu_MouseWheel"
|
||||
PreviewMouseRightButtonDown="MyCard_PreviewMouseRightButtonDown"
|
||||
>
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="menuDialog" Width="200">
|
||||
<ContextMenu x:Key="MenuDialog" Width="200">
|
||||
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
||||
<MenuItem Header="新建关联菜单" Click="CreateLinkMenu"/>
|
||||
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
|
||||
<MenuItem Header="加密此列表" Click="EncryptMenu" Tag="{Binding}"/>
|
||||
<MenuItem x:Name="AlterPW2" Header="修改密码" Click="AlterPassword"/>
|
||||
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
|
||||
<MenuItem Header="删除" Click="DeleteMenu" Tag="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MenuStyle}">
|
||||
<Setter Property="ContextMenu" Value="{StaticResource menuDialog}"/>
|
||||
<Setter Property="ContextMenu" Value="{StaticResource MenuDialog}"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.Background>
|
||||
@@ -103,43 +179,48 @@
|
||||
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="30" ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}}" HorizontalAlignment="Center" VerticalAlignment="Top" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
||||
<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}}}"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
|
||||
<StackPanel.Background>
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
|
||||
</StackPanel.Background>
|
||||
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}}"
|
||||
FontSize="15"
|
||||
TextAlignment="Left"
|
||||
LostFocus="LostFocusOrEnterDown"
|
||||
KeyDown="LostFocusOrEnterDown"
|
||||
Tag="{Binding}"
|
||||
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
||||
Visibility="{Binding MenuEdit}"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel Tag="{Binding}">
|
||||
<TextBox Style="{StaticResource MyTextBoxStyle}" Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
||||
FontSize="16"
|
||||
Height="28"
|
||||
VerticalAlignment="Center"
|
||||
TextAlignment="Left"
|
||||
LostFocus="LostFocusOrEnterDown"
|
||||
KeyDown="LostFocusOrEnterDown"
|
||||
Tag="{Binding}"
|
||||
Padding="2"
|
||||
BorderThickness="0"
|
||||
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
||||
Visibility="{Binding MenuEdit}">
|
||||
<TextBox.Background>
|
||||
<SolidColorBrush Color="White" Opacity="0.6" />
|
||||
</TextBox.Background>
|
||||
</TextBox>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
IsVisibleChanged="MenuWhenVisibilityChanged"
|
||||
Visibility="{Binding NotMenuEdit}">
|
||||
<Button Background="Transparent"
|
||||
BorderThickness="0"
|
||||
hc:IconElement.Geometry="{Binding MenuGeometry}"
|
||||
hc:IconElement.Height="18"
|
||||
hc:IconElement.Width="18"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
Foreground="{Binding GeometryColor}"
|
||||
/>
|
||||
BorderThickness="0"
|
||||
hc:IconElement.Geometry="{Binding MenuGeometry}"
|
||||
hc:IconElement.Height="18"
|
||||
hc:IconElement.Width="18"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
Foreground="{Binding GeometryColor}"
|
||||
/>
|
||||
<TextBlock Text="{Binding MenuName}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
IsVisibleChanged="MenuWhenVisibilityChanged"
|
||||
Visibility="{Binding NotMenuEdit}"
|
||||
/>
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
@@ -147,4 +228,5 @@
|
||||
</ListBox>
|
||||
</WrapPanel>
|
||||
</hc:Card>
|
||||
</UserControl>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,16 +1,22 @@
|
||||
using DraggAnimatedPanelExample;
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.Other;
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
using System.Windows.Input;
|
||||
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using WindowsAPICodePack.Dialogs;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
@@ -21,18 +27,65 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
private int menuSelectIndexTemp = -1;
|
||||
private AppData appData = MainWindow.appData;
|
||||
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(255, 255, 255));
|
||||
|
||||
|
||||
|
||||
public LeftCardControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
bac.Opacity = 0.6;
|
||||
|
||||
this.Loaded += (s, e) =>
|
||||
{
|
||||
SelectLastMenu();
|
||||
SetMenuListBoxItemEvent();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private void SetMenuListBoxItemEvent()
|
||||
{
|
||||
int size = MenuListBox.Items.Count;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ListBoxItem lbi = (ListBoxItem)(MenuListBox.ItemContainerGenerator.ContainerFromIndex(i));
|
||||
if (lbi != null)
|
||||
{
|
||||
SetListBoxItemEvent(lbi);
|
||||
}
|
||||
}
|
||||
//首次触发不了Selected事件
|
||||
object obj = MenuListBox.ItemContainerGenerator.ContainerFromIndex(MenuListBox.SelectedIndex);
|
||||
Lbi_Selected(obj, null);
|
||||
}
|
||||
|
||||
private void SetListBoxItemEvent(ListBoxItem lbi)
|
||||
{
|
||||
lbi.MouseEnter += (s, me) =>
|
||||
{
|
||||
lbi.Background = bac;
|
||||
};
|
||||
lbi.Unselected += Lbi_Unselected;
|
||||
|
||||
lbi.MouseLeave += Lbi_MouseLeave;
|
||||
|
||||
lbi.Selected += Lbi_Selected;
|
||||
}
|
||||
|
||||
private void SelectLastMenu()
|
||||
{
|
||||
if (appData.AppConfig.SelectedMenuIndex >= appData.MenuList.Count || appData.AppConfig.SelectedMenuIndex == -1)
|
||||
{
|
||||
MenuListBox.SelectedIndex = 0;
|
||||
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[0].IconList;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuListBox.SelectedIndex = appData.AppConfig.SelectedMenuIndex;
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DelegateCommand<int[]> _swap;
|
||||
@@ -60,13 +113,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
}
|
||||
}
|
||||
|
||||
////菜单点击事件
|
||||
private void MenuClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
//设置对应菜单的图标列表
|
||||
MenuInfo mi = (MenuInfo)(((StackPanel)sender).Tag);
|
||||
appData.AppConfig.SelectedMenuIcons = mi.IconList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当修改菜单元素可见时 设置原菜单为不可见 并且不可选中
|
||||
@@ -76,9 +122,12 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
/// <param name="e"></param>
|
||||
private void MenuWhenVisibilityChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
TextBlock tb = sender as TextBlock;
|
||||
if (tb.Visibility == Visibility.Collapsed)
|
||||
StackPanel sp = sender as StackPanel;
|
||||
|
||||
ListBoxItem lbi = (sp.TemplatedParent as ContentPresenter).TemplatedParent as ListBoxItem;
|
||||
if (sp.Visibility == Visibility.Collapsed)
|
||||
{
|
||||
lbi.MouseEnter += Lbi_MouseEnter;
|
||||
if (MenuListBox.SelectedIndex != -1)
|
||||
{
|
||||
menuSelectIndexTemp = MenuListBox.SelectedIndex;
|
||||
@@ -89,8 +138,56 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
MenuListBox.SelectedIndex = menuSelectIndexTemp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lbi.MouseEnter += (s, me) =>
|
||||
{
|
||||
lbi.Background = bac;
|
||||
};
|
||||
|
||||
lbi.MouseLeave += Lbi_MouseLeave;
|
||||
lbi.Selected += Lbi_Selected;
|
||||
}
|
||||
}
|
||||
|
||||
#region 设置菜单触发事件
|
||||
private void Lbi_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
lbi.Background = Brushes.Transparent;
|
||||
}
|
||||
|
||||
private void Lbi_Unselected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//添加Leave效果
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
lbi.Background = Brushes.Transparent;
|
||||
lbi.MouseLeave += Lbi_MouseLeave;
|
||||
}
|
||||
|
||||
private void Lbi_Selected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
|
||||
SolidColorBrush fontColor = new SolidColorBrush(Colors.Black);
|
||||
|
||||
lbi.MouseLeave -= Lbi_MouseLeave;
|
||||
lbi.Background = bac;
|
||||
lbi.Foreground = fontColor;
|
||||
}
|
||||
catch { }
|
||||
|
||||
}
|
||||
|
||||
private void Lbi_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
lbi.Background = Brushes.Transparent;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 新建菜单
|
||||
/// </summary>
|
||||
@@ -100,12 +197,87 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
MenuInfo info = new MenuInfo() { MenuEdit = Visibility.Collapsed, MenuId = System.Guid.NewGuid().ToString(), MenuName = "NewMenu" };
|
||||
appData.MenuList.Add(info);
|
||||
MenuListBox.Items.Refresh();
|
||||
MenuListBox.SelectedIndex = appData.MenuList.Count - 1;
|
||||
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
|
||||
appData.AppConfig.SelectedMenuIcons = info.IconList;
|
||||
//首次触发不了Selected事件
|
||||
object obj = MenuListBox.ItemContainerGenerator.ContainerFromIndex(MenuListBox.SelectedIndex);
|
||||
SetListBoxItemEvent((ListBoxItem)obj);
|
||||
Lbi_Selected(obj, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建实时文件菜单
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void CreateLinkMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
CommonOpenFileDialog dialog = new CommonOpenFileDialog
|
||||
{
|
||||
IsFolderPicker = true,
|
||||
Title = "选择关联文件夹"
|
||||
};
|
||||
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
|
||||
{
|
||||
string menuId = System.Guid.NewGuid().ToString();
|
||||
|
||||
string path = dialog.FileName;
|
||||
|
||||
MenuInfo menuInfo = new MenuInfo
|
||||
{
|
||||
MenuName = Path.GetFileNameWithoutExtension(path),
|
||||
MenuId = menuId,
|
||||
MenuType = MenuType.LINK,
|
||||
LinkPath = path,
|
||||
IsEncrypt = false,
|
||||
};
|
||||
|
||||
appData.MenuList.Add(menuInfo);
|
||||
|
||||
MenuListBox.SelectedIndex = appData.MenuList.Count - 1;
|
||||
appData.AppConfig.SelectedMenuIndex = MenuListBox.SelectedIndex;
|
||||
appData.AppConfig.SelectedMenuIcons = menuInfo.IconList;
|
||||
//首次触发不了Selected事件
|
||||
object obj = MenuListBox.ItemContainerGenerator.ContainerFromIndex(MenuListBox.SelectedIndex);
|
||||
SetListBoxItemEvent((ListBoxItem)obj);
|
||||
Lbi_Selected(obj, null);
|
||||
HandyControl.Controls.Growl.Success("菜单关联成功, 加载列表中, 稍后重新进入此菜单可查看列表!", "MainWindowGrowl");
|
||||
FileWatcher.LinkMenuWatcher(menuInfo);
|
||||
|
||||
new Thread(() =>
|
||||
{
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(menuInfo.LinkPath);
|
||||
FileSystemInfo[] fileInfos = dirInfo.GetFileSystemInfos();
|
||||
|
||||
ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
|
||||
foreach (FileSystemInfo fileInfo in fileInfos)
|
||||
{
|
||||
IconInfo iconInfo = CommonCode.GetIconInfoByPath_NoWrite(fileInfo.FullName);
|
||||
iconList.Add(iconInfo);
|
||||
}
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
menuInfo.IconList = iconList;
|
||||
//foreach (IconInfo iconInfo in iconList)
|
||||
//{
|
||||
// menuInfo.IconList = iconList;
|
||||
//}
|
||||
});
|
||||
}).Start();
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUtil.WriteErrorLog(ex, "新建关联菜单失败!");
|
||||
HandyControl.Controls.Growl.WarningGlobal("新建关联菜单失败!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重命名菜单 将textbox 设置为可见
|
||||
/// </summary>
|
||||
@@ -113,6 +285,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
/// <param name="e"></param>
|
||||
private void RenameMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RunTimeStatus.IS_MENU_EDIT = true;
|
||||
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
||||
menuInfo.MenuEdit = (int)Visibility.Visible;
|
||||
}
|
||||
@@ -124,19 +297,39 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
/// <param name="e"></param>
|
||||
private void DeleteMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
||||
if (menuInfo.IconList != null && menuInfo.IconList.Count > 0)
|
||||
{
|
||||
HandyControl.Controls.Growl.Ask("确认删除此菜单吗?", isConfirmed =>
|
||||
{
|
||||
if (isConfirmed)
|
||||
{
|
||||
DeleteMenu(menuInfo);
|
||||
}
|
||||
return true;
|
||||
}, "MainWindowAskGrowl");
|
||||
} else
|
||||
{
|
||||
DeleteMenu(menuInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteMenu(MenuInfo menuInfo)
|
||||
{
|
||||
if (appData.MenuList.Count == 1)
|
||||
{
|
||||
//如果删除以后没有菜单的话 先创建一个
|
||||
CreateMenu(null, null);
|
||||
}
|
||||
int index = appData.MenuList.IndexOf(menuInfo);
|
||||
if(index == 0)
|
||||
if (index == 0)
|
||||
{
|
||||
index = 0;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
index = index - 1;
|
||||
index--;
|
||||
}
|
||||
|
||||
appData.MenuList.Remove(menuInfo);
|
||||
@@ -153,6 +346,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
/// <param name="e"></param>
|
||||
private void LostFocusOrEnterDown(object sender, EventArgs e)
|
||||
{
|
||||
bool done = true;
|
||||
TextBox menuBox = null;
|
||||
if (e.GetType() == typeof(KeyEventArgs))
|
||||
{
|
||||
@@ -161,18 +355,29 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
menuBox = ((TextBox)sender);
|
||||
}
|
||||
else
|
||||
{
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
else if (e.GetType() == typeof(RoutedEventArgs))
|
||||
{
|
||||
menuBox = ((TextBox)sender);
|
||||
}
|
||||
|
||||
if (menuBox != null)
|
||||
if (done)
|
||||
{
|
||||
MenuInfo menuInfo = menuBox.Tag as MenuInfo;
|
||||
string text = menuBox.Text;
|
||||
menuInfo.MenuName = text;
|
||||
menuInfo.MenuEdit = Visibility.Collapsed;
|
||||
if (menuBox != null)
|
||||
{
|
||||
MenuInfo menuInfo = menuBox.Tag as MenuInfo;
|
||||
string text = menuBox.Text;
|
||||
menuInfo.MenuName = text;
|
||||
menuInfo.MenuEdit = Visibility.Collapsed;
|
||||
}
|
||||
RunTimeStatus.IS_MENU_EDIT = false;
|
||||
//为了解决无法修改菜单的问题
|
||||
MainWindow.mainWindow.SearchBox.Focus();
|
||||
MenuListBox.SelectedIndex = menuSelectIndexTemp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,6 +389,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
private void MenuEditWhenVisibilityChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
TextBox box = sender as TextBox;
|
||||
MenuInfo mi = box.Tag as MenuInfo;
|
||||
if (box.Visibility == Visibility.Visible)
|
||||
{
|
||||
Keyboard.Focus(box);
|
||||
@@ -202,16 +408,333 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
IconfontWindow.Show(SvgToGeometry.GetIconfonts(), menuInfo);
|
||||
}
|
||||
|
||||
private void menus_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)
|
||||
{
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count-1].IconList;
|
||||
} else
|
||||
//appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count - 1].IconList;
|
||||
}
|
||||
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.type = PasswordType.INPUT;
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标悬停切换菜单
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Menu_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (appData.AppConfig.HoverMenu && !RunTimeStatus.IS_MENU_EDIT)
|
||||
{
|
||||
Thread t = new Thread(() =>
|
||||
{
|
||||
Thread.Sleep(200);
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
if (lbi.IsMouseOver)
|
||||
{
|
||||
int index = MenuListBox.ItemContainerGenerator.IndexFromContainer(lbi);
|
||||
MenuListBox.SelectedIndex = index;
|
||||
if (appData.AppConfig.IconBatch_NoWrite)
|
||||
{
|
||||
appData.AppConfig.IconBatch_NoWrite = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击菜单后 隐藏搜索框
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ListBoxItem_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||
{
|
||||
MainWindow.mainWindow.HidedSearchBox();
|
||||
}
|
||||
|
||||
ListBoxItem lbi = sender as ListBoxItem;
|
||||
MenuInfo mi = lbi.DataContext as MenuInfo;
|
||||
int index = MenuListBox.Items.IndexOf(mi);
|
||||
MenuListBox.SelectedIndex = index;
|
||||
|
||||
if (appData.AppConfig.IconBatch_NoWrite)
|
||||
{
|
||||
appData.AppConfig.IconBatch_NoWrite = false;
|
||||
MainWindow.mainWindow.RightCard.IconListBox.SelectionMode = SelectionMode.Extended;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///// <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>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void MyCard_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 拖动移动图标到指定菜单
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Menu_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
MyPoptip.IsOpen = false;
|
||||
|
||||
MenuInfo mi = (sender as ListBoxItem).DataContext as MenuInfo;
|
||||
IconInfo iconInfo = (IconInfo)e.Data.GetData(typeof(IconInfo));
|
||||
if (iconInfo != null)
|
||||
{
|
||||
// 将已有图标移动到该菜单
|
||||
appData.MenuList[MenuListBox.SelectedIndex].IconList.Remove(iconInfo);
|
||||
appData.MenuList[MenuListBox.Items.IndexOf(mi)].IconList.Add(iconInfo);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// 直接将新图标移动到该菜单
|
||||
Array dropObject = (System.Array)e.Data.GetData(DataFormats.FileDrop);
|
||||
if (dropObject == null) return;
|
||||
foreach (object obj in dropObject)
|
||||
{
|
||||
string path = (string)obj;
|
||||
iconInfo = CommonCode.GetIconInfoByPath(path);
|
||||
if (iconInfo == null)
|
||||
{
|
||||
LogUtil.WriteErrorLog("添加项目失败,未能获取到项目图标:" + path);
|
||||
break;
|
||||
|
||||
}
|
||||
appData.MenuList[MenuListBox.Items.IndexOf(mi)].IconList.Add(iconInfo);
|
||||
}
|
||||
CommonCode.SortIconList();
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
private void EncryptMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
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 = "加密此列表";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,115 +3,323 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:cst="clr-namespace:GeekDesk.Constant"
|
||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||
xmlns:component="clr-namespace:GeekDesk.CustomComponent.VirtualizingWrapPanel"
|
||||
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||
xmlns:ot="clr-namespace:GeekDesk.Control.Other"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
AllowDrop="True"
|
||||
>
|
||||
<UserControl.Resources>
|
||||
<!--右侧栏样式动画-->
|
||||
<Style x:Key="imageStyle" TargetType="Image">
|
||||
<Setter Property="Width" Value="{Binding ImageWidth}"/>
|
||||
<Setter Property="Height" Value="{Binding ImageHeight}"/>
|
||||
<Setter Property="Source" Value="{Binding BitmapImage}"/>
|
||||
<!--<Style x:Key="PanelStyle" TargetType="hc:SimpleStackPanel">
|
||||
<Style.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsMouseOver" Value="True"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<MultiTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation To="80" Duration="0:0:0.001" Storyboard.TargetProperty="Width"/>
|
||||
<DoubleAnimation To="80" Duration="0:0:0.001" Storyboard.TargetProperty="Height"/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiTrigger.EnterActions>
|
||||
<MultiTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation To="60" Duration="0:0:0.5" Storyboard.TargetProperty="Width"/>
|
||||
<DoubleAnimation To="60" Duration="0:0:0.5" Storyboard.TargetProperty="Height"/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiTrigger.ExitActions>
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>-->
|
||||
<Style x:Key="ImageStyle" TargetType="Image">
|
||||
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
||||
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||
<Setter Property="Source" Value="{Binding BitmapImage}"/>
|
||||
</Style>
|
||||
<Style x:Key="ImageStyleNoWrite" TargetType="Image">
|
||||
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
||||
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||
<Setter Property="Source" Value="{Binding BitmapImage_NoWrite}"/>
|
||||
</Style>
|
||||
<Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||
<Border>
|
||||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
||||
<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:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
|
||||
<temp:SearchIconList x:Key="SearchIconList"/>
|
||||
<cvt:Boolean2VisibilityConverter x:Key="MyBoolean2VisibilityConverter"/>
|
||||
<cvt:ValueConvert x:Key="ValueConvert"/>
|
||||
<cst:RunTimeStatus x:Key="RunTimeStatus"/>
|
||||
<cst:DictConst x:Key="DictConst"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<!--右侧栏-->
|
||||
<hc:Card AllowDrop="True"
|
||||
Drop="Wrap_Drop"
|
||||
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource EffectShadow2}"
|
||||
Margin="5,0,5,5" Grid.ColumnSpan="2">
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||
</hc:Card.Background>
|
||||
<hc:Card.BorderBrush>
|
||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||
</hc:Card.BorderBrush>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<ListBox x:Name="icons" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
|
||||
BorderThickness="0"
|
||||
SelectionChanged="IconSelectionChanged "
|
||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||
>
|
||||
<ListBox.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</ListBox.Background>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="115" ItemsWidth="100" HorizontalAlignment="Center" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<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>
|
||||
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="iconDialog" Width="200">
|
||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||
<MenuItem Header="资源管理器菜单" Click="MenuItem_Click" Tag="{Binding}"/>
|
||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
<hc:Card AllowDrop="True"
|
||||
x:Name="WrapCard"
|
||||
Visibility="Visible"
|
||||
Drop="Wrap_Drop"
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource EffectShadow2}"
|
||||
Margin="5,0,5,5" Grid.ColumnSpan="2"
|
||||
PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown"
|
||||
hc:Dialog.Token="RightWrapCardDialog"
|
||||
MouseWheel="IconListBox_MouseWheel"
|
||||
>
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||
</hc:Card.Background>
|
||||
<hc:Card.BorderBrush>
|
||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||
</hc:Card.BorderBrush>
|
||||
<hc:Card.ContextMenu>
|
||||
<ContextMenu Width="200">
|
||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
|
||||
<MenuItem x:Name="showTitle" Header="隐藏/显示标题" Click="ShowTitle_Click"/>
|
||||
<MenuItem Header="{Binding AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource ValueConvert}, ConverterParameter={x:Static cst:DictConst.batchMenuHeaderDict}}" Click="BatchHandle" Tag="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</hc:Card.ContextMenu>
|
||||
<hc:DialogContainer>
|
||||
<Grid>
|
||||
<ot:PasswordDialog xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility, Duration=50, Delay=0}"
|
||||
x:Name="PDDialog"
|
||||
Visibility="Collapsed"
|
||||
Panel.ZIndex="99"
|
||||
IsVisibleChanged="PDDialog_IsVisibleChanged"
|
||||
Margin="0,-100,0,0"/>
|
||||
<StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
|
||||
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="ContextMenu" Value="{StaticResource iconDialog}"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<WrapPanel Orientation="Horizontal"
|
||||
Margin="10"
|
||||
>
|
||||
<UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
|
||||
<!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
|
||||
<ListBox x:Name="IconListBox"
|
||||
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
||||
BorderThickness="0"
|
||||
Padding="0,10,0,0"
|
||||
SelectionChanged="IconListBox_SelectionChanged"
|
||||
ScrollViewer.CanContentScroll ="True"
|
||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||
VirtualizingPanel.ScrollUnit="Pixel"
|
||||
>
|
||||
<ListBox.Template>
|
||||
<ControlTemplate TargetType="ListBox">
|
||||
<hc:ScrollViewer x:Name="WrapScroll"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
IsInertiaEnabled="True"
|
||||
CanContentScroll="True"
|
||||
PreviewMouseWheel="IconListBox_MouseWheel"
|
||||
>
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderBrush}"
|
||||
|
||||
>
|
||||
<ItemsPresenter/>
|
||||
</Border>
|
||||
</hc:ScrollViewer>
|
||||
</ControlTemplate>
|
||||
</ListBox.Template>
|
||||
<ListBox.Background>
|
||||
<SolidColorBrush Color="#00FFFFFF" />
|
||||
</ListBox.Background>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<!--<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
|
||||
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.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Tag="{Binding}"
|
||||
MouseLeftButtonUp="IconClick"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="5,5,5,5"
|
||||
hc:Poptip.HitMode="None"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
hc:Poptip.Content="{Binding Content}"
|
||||
hc:Poptip.Placement="BottomLeft"
|
||||
>
|
||||
<Image Style="{StaticResource imageStyle}" />
|
||||
<TextBlock MaxWidth="80"
|
||||
MaxHeight="40"
|
||||
TextWrapping="Wrap"
|
||||
TextTrimming="WordEllipsis"
|
||||
TextAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Name}"/>
|
||||
<component:VirtualizingWrapPanel VirtualizationMode="Recycling"
|
||||
IsVirtualizing="True"
|
||||
IsContainerVirtualizable="True"
|
||||
VirtualizingPanel.ScrollUnit="Pixel"
|
||||
Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
|
||||
Converter={StaticResource GetWidthByWWConvert},
|
||||
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_70}}"
|
||||
/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</WrapPanel>
|
||||
</hc:Card>
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="IconDialog" Width="200">
|
||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||
<MenuItem Header="从列表移除"
|
||||
Click="RemoveIcon"
|
||||
Tag="{Binding}"/>
|
||||
<!--MenuItem Header="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource ValueConvert}, ConverterParameter={x:Static cst:DictConst.batchMenuHeaderDict}}"
|
||||
Click="BatchHandle"
|
||||
Tag="{Binding}"/>-->
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
<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"
|
||||
>
|
||||
<!--<CheckBox IsChecked="{Binding IsChecked_NoWrite}" Visibility="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,0,-20" HorizontalAlignment="Right"/>-->
|
||||
<!--<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"/>
|
||||
<!--Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
|
||||
Converter={StaticResource GetWidthByWWConvert},
|
||||
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_70}}"-->
|
||||
<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}"
|
||||
Visibility="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ShowIconTitle, Converter={StaticResource MyBoolean2VisibilityConverter}, ConverterParameter={x:Static Visibility.Collapsed}, Mode=TwoWay}"
|
||||
Text="{Binding Name}"/>
|
||||
<!--</StackPanel>-->
|
||||
|
||||
</hc:SimpleStackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<!--</hc:TransitioningContentControl>-->
|
||||
</UniformGrid>
|
||||
</WrapPanel>
|
||||
|
||||
</Grid>
|
||||
</hc:DialogContainer>
|
||||
</hc:Card>
|
||||
|
||||
|
||||
<hc:Card x:Name="VerticalCard"
|
||||
Visibility="Collapsed"
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource EffectShadow2}"
|
||||
Margin="5,0,5,5" Grid.ColumnSpan="2"
|
||||
MouseLeftButtonDown="VerticalCard_MouseLeftButtonDown"
|
||||
>
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Color="AliceBlue"
|
||||
hc:GeometryEffect.GeometryEffect="20"
|
||||
Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||
</hc:Card.Background>
|
||||
<hc:Card.BorderBrush>
|
||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||
</hc:Card.BorderBrush>
|
||||
</hc:Card>
|
||||
<hc:LoadingCircle x:Name="Loading_RightCard"
|
||||
Width="45" Height="45"
|
||||
DotBorderBrush="White"
|
||||
DotBorderThickness="2"
|
||||
Foreground="DarkGray"
|
||||
Opacity="0.8"
|
||||
DotDiameter="10"
|
||||
Margin="-50,-150,0,0"
|
||||
Visibility="Collapsed"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
using DraggAnimatedPanelExample;
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.Other;
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Plugins.EveryThing;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using GeekDesk.ViewModel.Temp;
|
||||
using HandyControl.Controls;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
@@ -30,39 +30,113 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
public partial class RightCardControl : UserControl
|
||||
{
|
||||
private AppData appData = MainWindow.appData;
|
||||
|
||||
ListBoxDragDropManager<IconInfo> dragMgr;
|
||||
|
||||
//private Thread dropCheckThread = null;
|
||||
|
||||
public RightCardControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Loaded += RightCardControl_Loaded;
|
||||
|
||||
}
|
||||
|
||||
private void RightCardControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.dragMgr = new ListBoxDragDropManager<IconInfo>(this.IconListBox);
|
||||
}
|
||||
|
||||
|
||||
#region 图标拖动
|
||||
DelegateCommand<int[]> _swap;
|
||||
public DelegateCommand<int[]> SwapCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_swap == null)
|
||||
_swap = new DelegateCommand<int[]>(
|
||||
(indexes) =>
|
||||
{
|
||||
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];
|
||||
//#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);
|
||||
|
||||
iconList.Remove(dragged);
|
||||
iconList.Insert(to, dragged);
|
||||
}
|
||||
);
|
||||
return _swap;
|
||||
// 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 图标拖动
|
||||
|
||||
|
||||
|
||||
|
||||
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (appData.AppConfig.IconBatch_NoWrite)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
if (appData.AppConfig.DoubleOpen)
|
||||
{
|
||||
IconClick(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 图标拖动
|
||||
|
||||
|
||||
private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
//Console.WriteLine("选中:" + IconListBox.SelectedItems.Count);
|
||||
if (appData.AppConfig.IconBatch_NoWrite)
|
||||
{
|
||||
//查找checkbox更改选中状态
|
||||
Panel p = sender as Panel;
|
||||
var ens = p.Children.OfType<CheckBox>();
|
||||
foreach (CheckBox cb in ens)
|
||||
{
|
||||
cb.IsChecked = !cb.IsChecked;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!appData.AppConfig.DoubleOpen)
|
||||
{
|
||||
IconClick(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图标点击事件
|
||||
@@ -71,15 +145,33 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
/// <param name="e"></param>
|
||||
private void IconClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((StackPanel)sender).Tag;
|
||||
if (icon.AdminStartUp)
|
||||
if (!RunTimeStatus.SEARCH_BOX_HIDED_300) return;
|
||||
|
||||
if (appData.AppConfig.DoubleOpen && e.ClickCount >= 2)
|
||||
{
|
||||
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
IconInfo icon = (IconInfo)((Panel)sender).Tag;
|
||||
if (icon.AdminStartUp)
|
||||
{
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
|
||||
{
|
||||
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
|
||||
IconInfo icon = (IconInfo)((Panel)sender).Tag;
|
||||
if (icon.AdminStartUp)
|
||||
{
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -90,7 +182,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
private void IconAdminStart(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
|
||||
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -101,70 +193,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
private void ShowInExplore(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
|
||||
StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
|
||||
ProcessUtil.StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
|
||||
}
|
||||
|
||||
private void StartIconApp(IconInfo icon, IconStartType type)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
||||
return;
|
||||
}
|
||||
|
||||
Process p = new Process();
|
||||
p.StartInfo.FileName = icon.Path;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case IconStartType.ADMIN_STARTUP:
|
||||
p.StartInfo.Arguments = "1";//启动参数
|
||||
p.StartInfo.Verb = "runas";
|
||||
p.StartInfo.CreateNoWindow = false; //设置显示窗口
|
||||
p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程
|
||||
p.StartInfo.ErrorDialog = false;
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||
{
|
||||
Window parentWin = Window.GetWindow(this);
|
||||
parentWin.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
break;// c#好像不能case穿透
|
||||
case IconStartType.DEFAULT_STARTUP:
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||
{
|
||||
Window parentWin = Window.GetWindow(this);
|
||||
parentWin.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
case IconStartType.SHOW_IN_EXPLORE:
|
||||
p.StartInfo.FileName = "Explorer.exe";
|
||||
p.StartInfo.Arguments = "/e,/select," + icon.Path;
|
||||
break;
|
||||
}
|
||||
p.Start();
|
||||
icon.Count++;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(不支持的启动方式)!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// data选中事件 设置不可选中
|
||||
/// 拖动添加项目
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void IconSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (icons.SelectedIndex != -1) icons.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
|
||||
private void Wrap_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
Array dropObject = (System.Array)e.Data.GetData(DataFormats.FileDrop);
|
||||
@@ -172,18 +208,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
foreach (object obj in dropObject)
|
||||
{
|
||||
string path = (string)obj;
|
||||
|
||||
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Jpeg);
|
||||
|
||||
IconInfo iconInfo = new IconInfo
|
||||
{
|
||||
Path = path,
|
||||
BitmapImage = ImageUtil.GetBitmapIconByPath(path)
|
||||
};
|
||||
iconInfo.DefaultImage = iconInfo.ImageByteArr;
|
||||
iconInfo.Name = System.IO.Path.GetFileNameWithoutExtension(path);
|
||||
IconInfo iconInfo = CommonCode.GetIconInfoByPath(path);
|
||||
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
|
||||
}
|
||||
CommonCode.SortIconList();
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -196,13 +225,16 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Remove((IconInfo)((MenuItem)sender).Tag);
|
||||
}
|
||||
|
||||
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
||||
private void SystemContextMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
|
||||
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe");
|
||||
psi.Arguments = "/e,/select," + icon.Path;
|
||||
System.Diagnostics.Process.Start(psi);
|
||||
DirectoryInfo[] folders = new DirectoryInfo[1];
|
||||
folders[0] = new DirectoryInfo(icon.Path);
|
||||
ShellContextMenu scm = new ShellContextMenu();
|
||||
System.Drawing.Point p = System.Windows.Forms.Cursor.Position;
|
||||
p.X -= 80;
|
||||
p.Y -= 80;
|
||||
scm.ShowContextMenu(folders, p);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -212,7 +244,502 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
/// <param name="e"></param>
|
||||
private void PropertyConfig(object sender, RoutedEventArgs e)
|
||||
{
|
||||
HandyControl.Controls.Dialog.Show(new IconInfoDialog((IconInfo)((MenuItem)sender).Tag));
|
||||
IconInfo info = (IconInfo)((MenuItem)sender).Tag;
|
||||
switch (info.IconType)
|
||||
{
|
||||
case IconType.URL:
|
||||
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog(info);
|
||||
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "MainWindowDialog");
|
||||
break;
|
||||
default:
|
||||
IconInfoDialog dialog = new IconInfoDialog(info);
|
||||
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "MainWindowDialog");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuIcon_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
RunTimeStatus.MOUSE_ENTER_ICON = true;
|
||||
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
IconInfo info = (sender as Panel).Tag as IconInfo;
|
||||
MyPoptipContent.Text = info.Content;
|
||||
MyPoptip.VerticalOffset = 30;
|
||||
Thread.Sleep(50);
|
||||
if (!RunTimeStatus.ICONLIST_MOUSE_WHEEL)
|
||||
{
|
||||
MyPoptip.IsOpen = true;
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
double width = appData.AppConfig.ImageWidth;
|
||||
double height = appData.AppConfig.ImageHeight;
|
||||
width += width * 0.15;
|
||||
height += height * 0.15;
|
||||
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ImgStoryBoard(sender, (int)width, (int)height, 1, true);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
private void MenuIcon_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
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);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void ImgStoryBoard(object sender, int height, int width, int milliseconds, bool checkRmStoryboard = false)
|
||||
{
|
||||
|
||||
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;
|
||||
|
||||
DependencyObject dos = sp.Parent;
|
||||
Image img = null;
|
||||
|
||||
foreach (var imgBak in sp.Children.OfType<Image>())
|
||||
{
|
||||
img = (Image)imgBak;
|
||||
|
||||
}
|
||||
if (img == null) return;
|
||||
double afterHeight = img.Height;
|
||||
double afterWidth = img.Width;
|
||||
|
||||
//动画定义
|
||||
Storyboard myStoryboard = new Storyboard();
|
||||
|
||||
|
||||
|
||||
DoubleAnimation heightAnimation = new DoubleAnimation
|
||||
{
|
||||
From = afterHeight,
|
||||
To = height,
|
||||
Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
|
||||
};
|
||||
DoubleAnimation widthAnimation = new DoubleAnimation
|
||||
{
|
||||
From = afterWidth,
|
||||
To = width,
|
||||
Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
|
||||
};
|
||||
|
||||
|
||||
Timeline.SetDesiredFrameRate(heightAnimation, 60);
|
||||
Timeline.SetDesiredFrameRate(widthAnimation, 60);
|
||||
|
||||
Storyboard.SetTarget(widthAnimation, img);
|
||||
Storyboard.SetTargetProperty(widthAnimation, new PropertyPath("Width"));
|
||||
Storyboard.SetTarget(heightAnimation, img);
|
||||
Storyboard.SetTargetProperty(heightAnimation, new PropertyPath("Height"));
|
||||
|
||||
myStoryboard.Children.Add(heightAnimation);
|
||||
myStoryboard.Children.Add(widthAnimation);
|
||||
|
||||
CheckRemoveStoryboard crs = new CheckRemoveStoryboard
|
||||
{
|
||||
sb = myStoryboard,
|
||||
sp = sp,
|
||||
heightAnimation = heightAnimation,
|
||||
widthAnimation = widthAnimation,
|
||||
img = img,
|
||||
isMouseOver = !checkRmStoryboard
|
||||
};
|
||||
|
||||
heightAnimation.Completed += (s, e) =>
|
||||
{
|
||||
if (checkRmStoryboard)
|
||||
{
|
||||
ThreadStart ts = new ThreadStart(crs.Remove);
|
||||
System.Threading.Thread t = new System.Threading.Thread(ts);
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
img.BeginAnimation(WidthProperty, null);
|
||||
img.BeginAnimation(HeightProperty, null);
|
||||
}
|
||||
};
|
||||
img.BeginAnimation(WidthProperty, widthAnimation);
|
||||
img.BeginAnimation(HeightProperty, heightAnimation);
|
||||
//###################################################################
|
||||
//myStoryboard.Completed += (s, e) =>
|
||||
//{
|
||||
// if (checkRmStoryboard)
|
||||
// {
|
||||
// ThreadStart ts = new ThreadStart(crs.Remove);
|
||||
// System.Threading.Thread t = new System.Threading.Thread(ts);
|
||||
// t.Start();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// myStoryboard.Remove();
|
||||
// }
|
||||
//};
|
||||
//myStoryboard.Begin();
|
||||
}
|
||||
|
||||
private class CheckRemoveStoryboard
|
||||
{
|
||||
public Storyboard sb;
|
||||
public Panel sp;
|
||||
public Image img;
|
||||
public DoubleAnimation heightAnimation;
|
||||
public DoubleAnimation widthAnimation;
|
||||
public bool isMouseOver;
|
||||
public void Remove()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (sp.IsMouseOver == isMouseOver)
|
||||
{
|
||||
App.Current.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
img.BeginAnimation(WidthProperty, null);
|
||||
img.BeginAnimation(HeightProperty, null);
|
||||
//heightAnimation.FillBehavior = FillBehavior.Stop;
|
||||
//widthAnimation.FillBehavior = FillBehavior.Stop;
|
||||
}));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Threading.Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveSB(Object sb)
|
||||
{
|
||||
Storyboard sb2 = sb as Storyboard;
|
||||
System.Threading.Thread.Sleep(500);
|
||||
sb2.Remove();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加URL项目
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void AddUrlIcon(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog();
|
||||
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "MainWindowDialog");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加系统项目
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void AddSystemIcon(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SystemItemWindow.Show();
|
||||
}
|
||||
|
||||
public void VisibilitySearchCard(Visibility vb)
|
||||
{
|
||||
VerticalCard.Visibility = vb;
|
||||
if (vb == Visibility.Visible)
|
||||
{
|
||||
WrapCard.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapCard.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 搜索Card点击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void VerticalCard_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
//隐藏搜索框
|
||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||
{
|
||||
MainWindow.mainWindow.HidedSearchBox();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置光标
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void CursorPanel_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置光标
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void CursorPanel_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
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 = "锁定主面板";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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>
|
||||
/// 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 控制图标标题显示及隐藏
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ShowTitle_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
appData.AppConfig.ShowIconTitle = !appData.AppConfig.ShowIconTitle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量操作
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void BatchHandle(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!appData.AppConfig.IconBatch_NoWrite)
|
||||
{
|
||||
//开启批量操作时把所有的状态更改为未选中
|
||||
foreach(var ic in IconListBox.Items)
|
||||
{
|
||||
IconInfo info = ic as IconInfo;
|
||||
info.IsChecked_NoWrite = false;
|
||||
}
|
||||
}
|
||||
appData.AppConfig.IconBatch_NoWrite = !appData.AppConfig.IconBatch_NoWrite;
|
||||
IconListBox.SelectionMode = SelectionMode.Multiple;
|
||||
}
|
||||
|
||||
private void IconListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
//Console.WriteLine(sender.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
57
Control/UserControls/SystemItem/SystemItem.xaml
Normal file
57
Control/UserControls/SystemItem/SystemItem.xaml
Normal file
@@ -0,0 +1,57 @@
|
||||
<UserControl x:Class="GeekDesk.Control.UserControls.SystemItem.SystemItem"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.IconFont"
|
||||
mc:Ignorable="d"
|
||||
Background="#00FFFFFF"
|
||||
>
|
||||
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Top" Background="Transparent">
|
||||
<ListBox x:Name="ItemListBox" ItemsSource="{Binding IconInfos}" BorderThickness="0"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||
>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" Background="#00FFFFFF"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</ListBox.Background>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Width="80" Height="80" HorizontalAlignment="Center"
|
||||
Background="#00FFFFFF"
|
||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||
hc:Poptip.Content="{Binding Content_NoWrite, Mode=OneWay}"
|
||||
Tag="{Binding}"
|
||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||
hc:Poptip.Placement="BottomLeft"
|
||||
hc:Poptip.HitMode="None"
|
||||
>
|
||||
<Image Source="{Binding BitmapImage_NoWrite, Mode=OneWay}" Width="45" Height="45" RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
<TextBlock TextAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
TextWrapping="Wrap"
|
||||
MaxHeight="40"
|
||||
FontSize="13"
|
||||
TextTrimming="WordEllipsis"
|
||||
Width="65" Text="{Binding Name_NoWrite, Mode=OneWay}"
|
||||
/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</WrapPanel>
|
||||
</UserControl>
|
||||
48
Control/UserControls/SystemItem/SystemItem.xaml.cs
Normal file
48
Control/UserControls/SystemItem/SystemItem.xaml.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.SystemItem
|
||||
{
|
||||
/// <summary>
|
||||
/// IconPannel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SystemItem : UserControl
|
||||
{
|
||||
public SystemItem()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
IconInfo thisInfo = (sender as StackPanel).Tag as IconInfo;
|
||||
|
||||
MenuInfo menuInfo = MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex];
|
||||
|
||||
string startArg = thisInfo.StartArg;
|
||||
IconInfo iconInfo;
|
||||
if (Constants.SYSTEM_ICONS.ContainsKey(startArg))
|
||||
{
|
||||
//系统项
|
||||
iconInfo = new IconInfo
|
||||
{
|
||||
Name_NoWrite = thisInfo.Name_NoWrite,
|
||||
Path_NoWrite = thisInfo.Path_NoWrite,
|
||||
StartArg_NoWrite = thisInfo.StartArg_NoWrite,
|
||||
BitmapImage_NoWrite = thisInfo.BitmapImage_NoWrite
|
||||
};
|
||||
iconInfo.Content_NoWrite = iconInfo.Name_NoWrite
|
||||
+ "\n使用次数:" + iconInfo.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
//startupMenu or Store
|
||||
iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite);
|
||||
}
|
||||
menuInfo.IconList.Add(iconInfo);
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,35 +4,160 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:ToDoInfo}"
|
||||
mc:Ignorable="d"
|
||||
Background="AliceBlue"
|
||||
Background="Transparent"
|
||||
>
|
||||
|
||||
<hc:SimplePanel Margin="20">
|
||||
<Grid>
|
||||
|
||||
<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">
|
||||
<Grid Background="Transparent">
|
||||
<TextBlock x:Name="IsNewToDo" Visibility="Collapsed" />
|
||||
<TextBlock x:Name="NoData"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
Text="暂无数据!"
|
||||
/>
|
||||
|
||||
<DataGrid x:Name="BacklogList"
|
||||
HeadersVisibility="All"
|
||||
AutoGenerateColumns="False"
|
||||
ItemsSource="{Binding}"
|
||||
IsReadOnly="True"
|
||||
Initialized="DataGridMenu_Initialized"
|
||||
>
|
||||
HeadersVisibility="All"
|
||||
AutoGenerateColumns="False"
|
||||
ItemsSource="{Binding}"
|
||||
IsReadOnly="True"
|
||||
Initialized="DataGridMenu_Initialized"
|
||||
>
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu x:Name="Menu" Width="120">
|
||||
<MenuItem Header="详情" Click="DetailMenu_Click"/>
|
||||
<MenuItem Header="删除" Click="DeleteMenu_Click"/>
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.RowStyle>
|
||||
<!--<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow" BasedOn="{StaticResource DataGridRowStyle}">
|
||||
<EventSetter Event="MouseRightButtonUp" Handler="DataGridRow_MouseRightButtonUp" />
|
||||
<EventSetter Event="MouseRightButtonDown" Handler="DataGridRow_MouseRightButtonDown" />
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="{StaticResource BtnBG}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="False">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</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" SnapsToDevicePixels="True">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="White" Opacity="0.6"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Opacity)">
|
||||
<DoubleAnimation To="1" Duration="0:0:0"/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.EnterActions>
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Opacity)">
|
||||
<DoubleAnimation To="0.6" Duration="0:0:0.5"/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.ExitActions>
|
||||
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<SelectiveScrollingGrid>
|
||||
<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.CellStyle>
|
||||
<Style TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
@@ -42,7 +167,7 @@
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
|
||||
<DataGrid.Background>
|
||||
<SolidColorBrush Color="AliceBlue"/>
|
||||
<SolidColorBrush Color="Transparent"/>
|
||||
</DataGrid.Background>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="120" Binding="{Binding Title}" Header="待办任务"/>
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.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.Backlog
|
||||
{
|
||||
|
||||
public enum ToDoType
|
||||
{
|
||||
HISTORY = 1,
|
||||
NEW = 2
|
||||
}
|
||||
/// <summary>
|
||||
/// BacklogControl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TodoControl : UserControl
|
||||
{
|
||||
private AppData appData = MainWindow.appData;
|
||||
public ToDoType type;
|
||||
public TodoControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -37,8 +35,15 @@ namespace GeekDesk.Control.UserControls.Backlog
|
||||
{
|
||||
if (isConfirmed)
|
||||
{
|
||||
appData.ToDoList.Remove(info);
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
if (type == ToDoType.NEW)
|
||||
{
|
||||
MainWindow.appData.ToDoList.Remove(info);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindow.appData.HiToDoList.Remove(info);
|
||||
}
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
}
|
||||
return true;
|
||||
}, "DeleteConfirm");
|
||||
@@ -60,13 +65,41 @@ namespace GeekDesk.Control.UserControls.Backlog
|
||||
BacklogList.ContextMenu = null;
|
||||
}
|
||||
|
||||
|
||||
private void DataGridRow_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
|
||||
/// <summary>
|
||||
/// 打开右键菜单
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中时颜色变化
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void DataGridRow_Selected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Color c = Color.FromRgb(91, 192, 222);
|
||||
SolidColorBrush b = new SolidColorBrush
|
||||
{
|
||||
Color = c,
|
||||
Opacity = 0.9
|
||||
};
|
||||
((DataGridRow)sender).Background = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,79 +4,72 @@
|
||||
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:local="clr-namespace:GeekDesk"
|
||||
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||
xmlns:local="clr-namespace:GeekDesk" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
|
||||
Title="Setting"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Height="450"
|
||||
Width="600"
|
||||
Height="550"
|
||||
Width="750"
|
||||
WindowStyle="None"
|
||||
ResizeMode="NoResize"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent" ShowInTaskbar="False"
|
||||
Background="#00FFFFFF" ShowInTaskbar="False"
|
||||
BorderThickness="0"
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
|
||||
<Window.Resources>
|
||||
<Style x:Key="MenuStyle" TargetType="hc:SideMenuItem" BasedOn="{StaticResource SideMenuItemBaseStyle}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Background" Value="AliceBlue"/>
|
||||
</Style.Setters>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#FFE2E2E2"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#FFDAD7D7"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Border CornerRadius="8" BorderThickness="0">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>
|
||||
</Border.Background>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="140"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Margin="30">
|
||||
|
||||
<hc:Card Grid.Row="0" Grid.Column="0">
|
||||
<hc:SideMenu BorderThickness="1"
|
||||
AutoSelect="True"
|
||||
>
|
||||
<hc:SideMenu.Background>
|
||||
<SolidColorBrush Color="AliceBlue"/>
|
||||
</hc:SideMenu.Background>
|
||||
<Grid.Effect>
|
||||
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
|
||||
RenderingBias="Quality" ShadowDepth="2"/>
|
||||
</Grid.Effect>
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Panel.ZIndex="9999" hc:Growl.GrowlParent="False" hc:Growl.Token="ConfigWindowAskGrowl" Grid.Column="1" Grid.Row="1"/>
|
||||
|
||||
<hc:SideMenu.ItemContainerStyle>
|
||||
<Style TargetType="hc:SideMenuItem" BasedOn="{StaticResource MenuStyle}"/>
|
||||
</hc:SideMenu.ItemContainerStyle>
|
||||
|
||||
<hc:SideMenuItem Header="关于"
|
||||
<Grid hc:Dialog.Token="ConfigWindowDialog">
|
||||
<hc:DialogContainer Margin="10">
|
||||
<Border Style="{StaticResource BorderBG}">
|
||||
<Grid Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="140"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<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.ItemContainerStyle>
|
||||
<Style TargetType="hc:SideMenuItem" BasedOn="{StaticResource MyMenuStyle}"/>
|
||||
</hc:SideMenu.ItemContainerStyle>
|
||||
|
||||
<hc:SideMenuItem Header="关于"
|
||||
IsSelected="True"
|
||||
Selected="MemuClick"
|
||||
Tag="About"
|
||||
>
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
Opacity="0.9"
|
||||
BorderThickness="0"
|
||||
hc:IconElement.Geometry="{StaticResource About}"
|
||||
hc:IconElement.Height="18"
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="显示设置"
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="显示设置"
|
||||
Tag="Theme"
|
||||
Selected="MemuClick">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
BorderThickness="0"
|
||||
@@ -85,14 +78,14 @@
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
|
||||
<hc:SideMenuItem Header="动作"
|
||||
<hc:SideMenuItem Header="动作"
|
||||
Tag="Motion"
|
||||
Selected="MemuClick">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
BorderThickness="0"
|
||||
@@ -101,13 +94,13 @@
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="其它"
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="其它"
|
||||
Tag="Other"
|
||||
Selected="MemuClick">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
BorderThickness="0"
|
||||
@@ -116,17 +109,28 @@
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</hc:Card>
|
||||
<hc:ScrollViewer Grid.Row="0" Grid.Column="1">
|
||||
<hc:Card x:Name="RightCard" Height="448" MouseDown="DragMove">
|
||||
</hc:Card>
|
||||
</hc:ScrollViewer>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</hc:Card>
|
||||
<hc:ScrollViewer Grid.Row="0" Grid.Column="1" BorderThickness="0" Margin="0,5,1,5">
|
||||
<UniformGrid x:Name="UFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, Event=Visibility, Delay=0}">
|
||||
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
|
||||
<hc:Card x:Name="RightCard" BorderThickness="0" MouseDown="DragMove">
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</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>
|
||||
</Border>
|
||||
|
||||
</hc:DialogContainer>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
</hc:Window>
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
using GeekDesk.Control.UserControls;
|
||||
using GeekDesk.Control.UserControls.Config;
|
||||
using GeekDesk.Control.UserControls.Config;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
@@ -13,36 +13,36 @@ namespace GeekDesk.Control.Windows
|
||||
/// <summary>
|
||||
/// ConfigDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ConfigWindow
|
||||
public partial class ConfigWindow : IWindowCommon
|
||||
{
|
||||
private static AboutControl about = new AboutControl();
|
||||
private static ThemeControl theme = new ThemeControl();
|
||||
private static MotionControl motion = new MotionControl();
|
||||
private static OtherControl other = new OtherControl();
|
||||
private static readonly AboutControl about = new AboutControl();
|
||||
private static readonly ThemeControl theme = new ThemeControl();
|
||||
private static readonly MotionControl motion = new MotionControl();
|
||||
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;
|
||||
|
||||
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
|
||||
{
|
||||
InitializeComponent();
|
||||
//BG.Source = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
|
||||
this.DataContext = appConfig;
|
||||
RightCard.Content = about;
|
||||
this.Topmost = true;
|
||||
WindowUtil.SetOwner(this, mainWindow);
|
||||
this.mainWindow = mainWindow;
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
|
||||
/// <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)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 点击关闭按钮
|
||||
@@ -60,20 +60,41 @@ namespace GeekDesk.Control.Windows
|
||||
switch (smi.Tag.ToString())
|
||||
{
|
||||
case "Motion":
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
RightCard.Content = motion;
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case "Theme":
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
RightCard.Content = theme;
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case "Other":
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
RightCard.Content = other;
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
default:
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
RightCard.Content = about;
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
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)
|
||||
{
|
||||
this.DragMove();
|
||||
}
|
||||
}
|
||||
|
||||
private static System.Windows.Window window = null;
|
||||
public static void Show(AppConfig appConfig, MainWindow mainWindow)
|
||||
{
|
||||
@@ -82,6 +103,16 @@ namespace GeekDesk.Control.Windows
|
||||
window = new ConfigWindow(appConfig, mainWindow);
|
||||
}
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
83
Control/Windows/GlobalColorPickerWindow.xaml
Normal file
83
Control/Windows/GlobalColorPickerWindow.xaml
Normal file
@@ -0,0 +1,83 @@
|
||||
<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"
|
||||
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||
WindowStyle="None"
|
||||
ResizeMode="NoResize"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
<Border CornerRadius="8"
|
||||
Background="White"
|
||||
Height="385"
|
||||
Width="228">
|
||||
<Grid>
|
||||
<TextBlock Panel.ZIndex="1000" Text="❤❤❤"
|
||||
x:Name="CopySuccess"
|
||||
Visibility="Collapsed"
|
||||
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndSlideFromBottom}, Duration=400, Event=None}"
|
||||
xf:Animations.PrimaryBinding="{Binding CopyAnimation}"
|
||||
Margin="138,300,0,0"
|
||||
/>
|
||||
<Button Height="32"
|
||||
BorderThickness="0" Content="复 制"
|
||||
Panel.ZIndex="999"
|
||||
Margin="122,329,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Background="#BF8EF6"
|
||||
Click="MyColorPicker_Confirmed"
|
||||
VerticalAlignment="Top" Width="80"
|
||||
>
|
||||
<Button.Style>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource MyBtnStyle}">
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
<Button Height="32"
|
||||
BorderThickness="0" Content="关 闭"
|
||||
Panel.ZIndex="999" Margin="26,329,0,0"
|
||||
Background="#EEEEEE"
|
||||
Click="MyColorPicker_Canceled"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top" Width="80"
|
||||
>
|
||||
<Button.Style>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource MyBtnStyle}">
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
<StackPanel>
|
||||
<Border MouseDown="DragMove"
|
||||
VerticalAlignment="Top"
|
||||
CornerRadius="8,8,0,0"
|
||||
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"
|
||||
ToggleButton.Checked="MyColorPicker_Checked"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
213
Control/Windows/GlobalColorPickerWindow.xaml.cs
Normal file
213
Control/Windows/GlobalColorPickerWindow.xaml.cs
Normal file
@@ -0,0 +1,213 @@
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// GlobalColorPickerWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class GlobalColorPickerWindow : IWindowCommon
|
||||
{
|
||||
PixelColorPickerWindow colorPickerWindow = null;
|
||||
|
||||
class PrivateDataContext : INotifyPropertyChanged
|
||||
{
|
||||
private bool copyAnimation = false;
|
||||
|
||||
public bool CopyAnimation
|
||||
{
|
||||
set
|
||||
{
|
||||
copyAnimation = value;
|
||||
OnPropertyChanged("CopyAnimation");
|
||||
|
||||
}
|
||||
get { return copyAnimation; }
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
public GlobalColorPickerWindow()
|
||||
{
|
||||
this.Topmost = true;
|
||||
InitializeComponent();
|
||||
this.DataContext = new PrivateDataContext();
|
||||
}
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
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, RoutedEventArgs e)
|
||||
{
|
||||
MyColorPickerClose();
|
||||
}
|
||||
private void MyColorPicker_Confirmed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CopySuccess.Visibility = Visibility.Visible;
|
||||
PrivateDataContext pdc = this.DataContext as PrivateDataContext;
|
||||
pdc.CopyAnimation = true;
|
||||
new Thread(() =>
|
||||
{
|
||||
Thread.Sleep(400);
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
pdc.CopyAnimation = false;
|
||||
CopySuccess.Visibility = Visibility.Collapsed;
|
||||
});
|
||||
}).Start();
|
||||
Color c = MyColorPicker.SelectedBrush.Color;
|
||||
Clipboard.SetData(DataFormats.Text, string.Format("#{0:X2}{1:X2}{2:X2}", 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();
|
||||
}
|
||||
|
||||
private ICommand _hideCommand;
|
||||
public ICommand HideCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_hideCommand == null)
|
||||
{
|
||||
_hideCommand = new RelayCommand(
|
||||
p =>
|
||||
{
|
||||
return true;
|
||||
},
|
||||
p =>
|
||||
{
|
||||
//CopySuccess.Visibility = Visibility.Collapsed;
|
||||
});
|
||||
}
|
||||
return _hideCommand;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,46 +8,80 @@
|
||||
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.IconFont"
|
||||
mc:Ignorable="d"
|
||||
Title="Svg"
|
||||
Height="450" Width="600"
|
||||
Height="520" Width="700"
|
||||
WindowStyle="None"
|
||||
ResizeMode="NoResize"
|
||||
AllowsTransparency="True"
|
||||
Background="AliceBlue"
|
||||
MouseDown="DragMove"
|
||||
Background="Transparent" ShowInTaskbar="False"
|
||||
BorderThickness="0"
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
|
||||
<Window.Resources>
|
||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||
<Setter Property="Width" Value="80"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
<Style x:Key="HcTabControl" TargetType="hc:TabControl" BasedOn="{StaticResource TabControlInLine}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TabTitle" TargetType="hc:TabItem" BasedOn="{StaticResource TabItemInLine}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="White" Opacity="0.68"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Margin="20">
|
||||
<Grid.Effect>
|
||||
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||
RenderingBias="Quality" ShadowDepth="2"/>
|
||||
</Grid.Effect>
|
||||
<Border MouseDown="DragMove" Style="{StaticResource BorderBG}" hc:Dialog.Token="IconUrlDialog">
|
||||
<!--<Border.Background>
|
||||
--><!--<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>--><!--
|
||||
<LinearGradientBrush Opacity="0.97">
|
||||
<GradientStop Color="#D1F0A4" Offset="0"/>
|
||||
<GradientStop Color="#97D282" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>-->
|
||||
<hc:DialogContainer>
|
||||
<Grid MouseDown="DragMove">
|
||||
<TextBox x:Name="CheckSettingUrl" Style="{StaticResource MyTextBoxStyle}" Visibility="Collapsed" Text="{Binding IsSettingUrl}" TextChanged="CheckSettingUrl_TextChanged"/>
|
||||
<hc:TabControl x:Name="MyTabControl"
|
||||
IsAnimationEnabled="True"
|
||||
SelectionChanged="TabControl_SelectionChanged"
|
||||
ShowContextMenu="True"
|
||||
IsTabFillEnabled="True"
|
||||
Margin="20,30,20,20"
|
||||
Height="350"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource HcTabControl}">
|
||||
<hc:TabItem Tag="System" IsSelected="True" Header="系统图标" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource SystemIcon}" Style="{StaticResource TabTitle}">
|
||||
<hc:SimplePanel>
|
||||
<uc:IconPannel x:Name="SystemIcon"/>
|
||||
</hc:SimplePanel>
|
||||
</hc:TabItem>
|
||||
<hc:TabItem Tag="Custom" Header="自定义图标" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource CustomIcon}" Style="{StaticResource TabTitle}">
|
||||
<hc:SimplePanel>
|
||||
<uc:IconPannel x:Name="CustomIcon"/>
|
||||
<hc:LoadingCircle x:Name="LoadingEle"/>
|
||||
</hc:SimplePanel>
|
||||
</hc:TabItem>
|
||||
</hc:TabControl>
|
||||
|
||||
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="取消" Click="Close_Click" Margin="391,397.5,163,22.5" />
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="自定义设置" Click="CustomButton_Click" IsEnabled="False" Name="CustomButton" Margin="447,397.5,71,22.5"/>
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="确定" Click="Confirm_Click" Margin="534,397.5,20,22.5" />
|
||||
</Grid>
|
||||
</hc:DialogContainer>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Border MouseDown="DragMove">
|
||||
<Grid MouseDown="DragMove">
|
||||
<TextBox x:Name="CheckSettingUrl" Visibility="Collapsed" Text="{Binding IsSettingUrl}" TextChanged="CheckSettingUrl_TextChanged"/>
|
||||
<hc:TabControl x:Name="MyTabControl" IsAnimationEnabled="True" SelectionChanged="TabControl_SelectionChanged" ShowContextMenu="True" IsTabFillEnabled="True" Margin="20,30,20,20" Height="350" VerticalAlignment="Top">
|
||||
<hc:TabItem Tag="System" IsSelected="True" Header="系统图标" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource SystemIcon}" >
|
||||
<hc:SimplePanel Background="AliceBlue">
|
||||
<uc:IconPannel x:Name="SystemIcon"/>
|
||||
</hc:SimplePanel>
|
||||
</hc:TabItem>
|
||||
<hc:TabItem Tag="Custom" Header="自定义图标" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource CustomIcon}">
|
||||
<hc:SimplePanel Background="AliceBlue">
|
||||
<uc:IconPannel x:Name="CustomIcon"/>
|
||||
<hc:LoadingCircle x:Name="LoadingEle"/>
|
||||
</hc:SimplePanel>
|
||||
</hc:TabItem>
|
||||
</hc:TabControl>
|
||||
|
||||
|
||||
<Button Content="取消" Click="Close_Click" Margin="391,397.5,163,22.5"/>
|
||||
<Button Content="自定义设置" Click="CustomButton_Click" IsEnabled="False" Name="CustomButton" Background="#5BC0DE" Foreground="White" RenderTransformOrigin="-0.868,0.583" Margin="447,397.5,71,22.5"/>
|
||||
<Button Content="确定" Click="Confirm_Click" Background="#5BC0DE" Foreground="White" Margin="534,397.5,20,22.5" RenderTransformOrigin="0.696,0.45"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
</Window>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GeekDesk.Control.Other;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
|
||||
@@ -10,14 +11,14 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
using System.Windows.Input;
|
||||
|
||||
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// IconfontWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class IconfontWindow : Window
|
||||
public partial class IconfontWindow : Window, IWindowCommon
|
||||
{
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
private static MenuInfo menuInfo;
|
||||
@@ -26,7 +27,7 @@ namespace GeekDesk.Control.Windows
|
||||
public static IconfontViewModel vm;
|
||||
private IconfontWindow(List<IconfontInfo> icons, MenuInfo menuInfo)
|
||||
{
|
||||
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
systemIcons = icons;
|
||||
@@ -56,6 +57,7 @@ namespace GeekDesk.Control.Windows
|
||||
|
||||
private void Close_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@@ -71,14 +73,16 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
LoadingEle.Visibility = Visibility.Visible;
|
||||
CustomIcon.Visibility = Visibility.Collapsed;
|
||||
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig));
|
||||
} else
|
||||
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig), "IconUrlDialog");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (customIcons == null)
|
||||
{
|
||||
vm.Iconfonts = null;
|
||||
LoadingOnlineIcon();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
vm.Iconfonts = customIcons;
|
||||
LoadingEle.Visibility = Visibility.Collapsed;
|
||||
@@ -120,6 +124,7 @@ namespace GeekDesk.Control.Windows
|
||||
}
|
||||
break;
|
||||
}
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@@ -132,11 +137,13 @@ namespace GeekDesk.Control.Windows
|
||||
window = new IconfontWindow(listInfo, menuInfo);
|
||||
}
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0);
|
||||
}
|
||||
|
||||
private void CustomButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig));
|
||||
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig), "IconUrlDialog");
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +152,8 @@ namespace GeekDesk.Control.Windows
|
||||
if (CheckSettingUrl.Text == "true")
|
||||
{
|
||||
LoadingOnlineIcon();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadingEle.IsRunning = true;
|
||||
CustomIcon.Visibility = Visibility.Collapsed;
|
||||
@@ -165,12 +173,21 @@ namespace GeekDesk.Control.Windows
|
||||
LoadingEle.Visibility = Visibility.Collapsed;
|
||||
CustomIcon.Visibility = Visibility.Visible;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception e)
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("加载远程图标异常!");
|
||||
LogUtil.WriteErrorLog(e, "加载远程图标异常!");
|
||||
}
|
||||
}
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public class IconfontViewModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
92
Control/Windows/PixelColorPickerWindow.xaml
Normal file
92
Control/Windows/PixelColorPickerWindow.xaml
Normal file
@@ -0,0 +1,92 @@
|
||||
<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"
|
||||
ResizeMode="NoResize"
|
||||
PreviewMouseMove="Window_PreviewMouseMove"
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||
MouseRightButtonDown="Window_MouseRightButtonDown"
|
||||
MouseWheel="Window_MouseWheel"
|
||||
Loaded="Window_Loaded"
|
||||
>
|
||||
<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>
|
||||
293
Control/Windows/PixelColorPickerWindow.xaml.cs
Normal file
293
Control/Windows/PixelColorPickerWindow.xaml.cs
Normal file
@@ -0,0 +1,293 @@
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using HandyControl.Controls;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
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 static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
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 = 10;
|
||||
|
||||
private static readonly int MIN_LENGTH = 10;
|
||||
private static readonly int MAX_LENGTH = 50;
|
||||
|
||||
//private static System.Drawing.Bitmap bgBitmap;
|
||||
|
||||
private static RenderTargetBitmap renderTargetBitmap;
|
||||
|
||||
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;//还原窗口(非最小化和最大化)
|
||||
|
||||
var screens = Screen.AllScreens;
|
||||
int allWidth = 0;
|
||||
int allHeight = 0;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
|
||||
|
||||
foreach (var screen in screens)
|
||||
{
|
||||
var rect = screen.Bounds;
|
||||
allWidth += rect.Width;
|
||||
allHeight += rect.Height;
|
||||
x = Math.Min(x, rect.X);
|
||||
y = Math.Min(y, rect.Y);
|
||||
}
|
||||
|
||||
//获取缩放比例
|
||||
double scale = ScreenUtil.GetScreenScalingFactor();
|
||||
|
||||
|
||||
this.Width = allWidth;
|
||||
this.Height = allHeight;
|
||||
|
||||
this.Left = x;
|
||||
this.Top = y;
|
||||
|
||||
DesktopBG.Width = this.Width;
|
||||
DesktopBG.Height = this.Height;
|
||||
this.Topmost = true;
|
||||
|
||||
System.Drawing.Bitmap 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(
|
||||
(int)this.Left,
|
||||
(int)this.Top,
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 创建一个RenderTargetBitmap,捕获窗口的内容
|
||||
renderTargetBitmap = new RenderTargetBitmap((int)this.Width, (int)this.Height, 96, 96, PixelFormats.Pbgra32);
|
||||
renderTargetBitmap.Render(this);
|
||||
|
||||
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);
|
||||
colorPicker.SelectedBrush = new SolidColorBrush(GetColorAtPosition(Mouse.GetPosition(this)));
|
||||
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);
|
||||
|
||||
|
||||
// Constants for DPI
|
||||
private const int HORZRES = 8;
|
||||
private const int VERTRES = 10;
|
||||
private const int LOGPIXELSX = 88;
|
||||
private const int LOGPIXELSY = 90;
|
||||
private static float GetDpi(bool isX)
|
||||
{
|
||||
IntPtr hdc = WindowUtil.GetDC(IntPtr.Zero);
|
||||
int dpi = isX ? WindowUtil.GetDeviceCaps(hdc, LOGPIXELSX) : WindowUtil.GetDeviceCaps(hdc, LOGPIXELSY);
|
||||
WindowUtil.ReleaseDC(IntPtr.Zero, hdc);
|
||||
return dpi / 96f;
|
||||
}
|
||||
|
||||
private void SetPixelAbout(MouseEventArgs e)
|
||||
{
|
||||
VisualBrush b = (VisualBrush)PixelBG.Fill;
|
||||
|
||||
Point pos = Mouse.GetPosition(this);
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
//获取缩放比例
|
||||
double scale = ScreenUtil.GetScreenScalingFactor();
|
||||
if (x + ColorCanvas.Width > this.Width / scale)
|
||||
{
|
||||
x = pos.X - ColorCanvas.Width - 10;
|
||||
}
|
||||
if (y + ColorCanvas.Height > this.Height / scale)
|
||||
{
|
||||
y = pos.Y - ColorCanvas.Height - 10;
|
||||
}
|
||||
|
||||
|
||||
Canvas.SetLeft(ColorCanvas, x);
|
||||
Canvas.SetTop(ColorCanvas, y);
|
||||
|
||||
|
||||
|
||||
|
||||
Color wColor = GetColorAtPosition(pos);
|
||||
|
||||
System.Drawing.Color dColor = System.Drawing.Color.FromArgb(wColor.A, wColor.R, wColor.G, wColor.B);
|
||||
|
||||
PixelColor_HTML.Text = "#" + dColor.Name.ToUpper().Substring(2);
|
||||
PixelColor_RGB.Text = dColor.R + "," + dColor.G + "," + dColor.B;
|
||||
Pixel_XY.Text = (int)pos.X + "*" + (int)pos.Y;
|
||||
|
||||
SolidColorBrush scb = (SolidColorBrush)PixelColor.Fill;
|
||||
scb.Color = wColor;
|
||||
//scb.Color = Color.FromArgb(dColor.A, dColor.R, dColor.G, dColor.B);
|
||||
}
|
||||
|
||||
private Color GetColorAtPosition(Point position)
|
||||
{
|
||||
// 使用CroppedBitmap裁剪出鼠标位置的一个像素
|
||||
CroppedBitmap croppedBitmap = new CroppedBitmap(renderTargetBitmap, new Int32Rect((int)position.X, (int)position.Y, 1, 1));
|
||||
// 将像素数据复制到数组中
|
||||
byte[] pixels = new byte[4];
|
||||
croppedBitmap.CopyPixels(pixels, 4, 0);
|
||||
// 如果像素数据有效,则返回颜色
|
||||
//if (pixels.Length == 4)
|
||||
//{
|
||||
|
||||
//}
|
||||
return Color.FromArgb(pixels[3], pixels[2], pixels[1], pixels[0]);
|
||||
//return Color.FromArgb(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <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)
|
||||
{
|
||||
Mouse.OverrideCursor = null;
|
||||
GlobalColorPickerWindow.ShowOrHide();
|
||||
//关闭
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
100
Control/Windows/SystemItemWindow.xaml
Normal file
100
Control/Windows/SystemItemWindow.xaml
Normal file
@@ -0,0 +1,100 @@
|
||||
<Window x:Class="GeekDesk.Control.Windows.SystemItemWindow"
|
||||
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"
|
||||
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.SystemItem"
|
||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||
mc:Ignorable="d"
|
||||
Title="Svg"
|
||||
Height="520" Width="700"
|
||||
WindowStyle="None"
|
||||
ResizeMode="NoResize"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent" ShowInTaskbar="False"
|
||||
BorderThickness="0"
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
<Window.Resources>
|
||||
<Style x:Key="HcTabControl" TargetType="hc:TabControl" BasedOn="{StaticResource TabControlInLine}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TabTitle" TargetType="hc:TabItem" BasedOn="{StaticResource TabItemInLine}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="White" Opacity="0.68"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
<cvt:MenuInfoConvert x:Key="MenuInfoConvert"/>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Margin="20">
|
||||
<Grid.Effect>
|
||||
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||
RenderingBias="Quality" ShadowDepth="2"/>
|
||||
</Grid.Effect>
|
||||
<Border MouseDown="DragMove" Style="{StaticResource BorderBG}" hc:Dialog.Token="IconUrlDialog">
|
||||
<hc:DialogContainer>
|
||||
<Grid MouseDown="DragMove">
|
||||
<StackPanel HorizontalAlignment="Center" Margin="10">
|
||||
<Border CornerRadius="8" Height="30" Width="150">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="White" Opacity="0.7"/>
|
||||
</Border.Background>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Background="Transparent"
|
||||
BorderThickness="0"
|
||||
hc:IconElement.Geometry="{Binding AppConfig.SelectedMenuIndex, Mode=OneWay, Converter={StaticResource MenuInfoConvert}, ConverterParameter=1}"
|
||||
hc:IconElement.Height="18"
|
||||
hc:IconElement.Width="18"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
>
|
||||
</Button>
|
||||
<TextBlock x:Name="MenuName" Text="{Binding AppConfig.SelectedMenuIndex, Mode=OneWay, Converter={StaticResource MenuInfoConvert}, ConverterParameter=2}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<hc:TabControl x:Name="MyTabControl"
|
||||
IsAnimationEnabled="True"
|
||||
SelectionChanged="TabControl_SelectionChanged"
|
||||
ShowContextMenu="True"
|
||||
IsTabFillEnabled="True"
|
||||
Margin="20,60,20,20"
|
||||
Height="350"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource HcTabControl}">
|
||||
<hc:TabItem Tag="System" IsSelected="True" Header="系统应用" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource SystemIcon}" Style="{StaticResource TabTitle}">
|
||||
<hc:SimplePanel>
|
||||
<uc:SystemItem x:Name="SystemItem"/>
|
||||
</hc:SimplePanel>
|
||||
</hc:TabItem>
|
||||
<hc:TabItem x:Name="StartMenu" Tag="StartMenu" Header="开始菜单应用" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource SystemIcon}" Style="{StaticResource TabTitle}">
|
||||
<hc:SimplePanel>
|
||||
<uc:SystemItem x:Name="StartMenuItem"/>
|
||||
<hc:LoadingCircle x:Name="StartMenuLoading"/>
|
||||
</hc:SimplePanel>
|
||||
</hc:TabItem>
|
||||
<!--<hc:TabItem Tag="Store" Header="商店应用(未开放)" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource CustomIcon}" Style="{StaticResource TabTitle}">
|
||||
<hc:SimplePanel>
|
||||
<uc:SystemItem x:Name="StoreItem"/>
|
||||
</hc:SimplePanel>
|
||||
</hc:TabItem>-->
|
||||
</hc:TabControl>
|
||||
<Button Content="关闭" Click="Close_Click" Margin="594,420,20,31.5"/>
|
||||
</Grid>
|
||||
</hc:DialogContainer>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
|
||||
</Window>
|
||||
300
Control/Windows/SystemItemWindow.xaml.cs
Normal file
300
Control/Windows/SystemItemWindow.xaml.cs
Normal file
@@ -0,0 +1,300 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// SystemItemWindow.xaml 的交互逻辑
|
||||
/// 添加系统项目到对应菜单
|
||||
/// </summary>
|
||||
public partial class SystemItemWindow : Window, IWindowCommon
|
||||
{
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
private static SystemItemViewModel vm;
|
||||
private List<IconInfo> systemIcons;
|
||||
private List<IconInfo> startMenuIcons;
|
||||
private List<IconInfo> storeIcons;
|
||||
|
||||
private SystemItemWindow()
|
||||
{
|
||||
vm = new SystemItemViewModel();
|
||||
this.DataContext = vm;
|
||||
InitializeComponent();
|
||||
this.Topmost = true;
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
}
|
||||
|
||||
private void Close_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切换选项卡
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
TabItem ti = this.MyTabControl.SelectedItem as TabItem;
|
||||
|
||||
List<IconInfo> systemInfos = vm.IconInfos;
|
||||
if (systemInfos == null)
|
||||
{
|
||||
systemInfos = new List<IconInfo>();
|
||||
}
|
||||
switch (ti.Tag.ToString())
|
||||
{
|
||||
case "StartMenu": //开始菜单
|
||||
if (startMenuIcons == null)
|
||||
{
|
||||
vm.IconInfos = null;
|
||||
System.Threading.Thread t = new System.Threading.Thread(new ThreadStart(GetStartMenuInfos))
|
||||
{
|
||||
IsBackground = true
|
||||
};
|
||||
t.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
StartMenuLoading.Visibility = Visibility.Collapsed;
|
||||
vm.IconInfos = startMenuIcons;
|
||||
}
|
||||
break;
|
||||
case "Store": //应用商店
|
||||
if (storeIcons == null)
|
||||
{
|
||||
vm.IconInfos = null;
|
||||
storeIcons = new List<IconInfo>();
|
||||
vm.IconInfos = storeIcons;
|
||||
}
|
||||
else
|
||||
{
|
||||
vm.IconInfos = storeIcons;
|
||||
}
|
||||
break;
|
||||
default: //默认系统项
|
||||
if (systemIcons == null)
|
||||
{
|
||||
vm.IconInfos = null;
|
||||
systemIcons = GetSysteIconInfos();
|
||||
vm.IconInfos = systemIcons;
|
||||
}
|
||||
else
|
||||
{
|
||||
vm.IconInfos = systemIcons;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取开始菜单路径下项目
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private void GetStartMenuInfos()
|
||||
{
|
||||
App.Current.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
StartMenuLoading.Visibility = Visibility.Visible;
|
||||
}));
|
||||
|
||||
List<IconInfo> infos = new List<IconInfo>();
|
||||
//获取开始菜单路径
|
||||
string path = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) + "\\Programs";
|
||||
//递归获取信息
|
||||
GetInfos(path, infos);
|
||||
App.Current.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
if (StartMenu.IsSelected)
|
||||
{
|
||||
startMenuIcons = infos;
|
||||
vm.IconInfos = startMenuIcons;
|
||||
}
|
||||
StartMenuLoading.Visibility = Visibility.Collapsed;
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 递归获取文件信息
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="listInfos"></param>
|
||||
private void GetInfos(string filePath, List<IconInfo> listInfos)
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(filePath);
|
||||
string[] filePaths = Directory.GetFiles(filePath);
|
||||
string[] dirPaths = Directory.GetDirectories(filePath);
|
||||
|
||||
string[] paths = new string[filePaths.Length + dirPaths.Length];
|
||||
filePaths.CopyTo(paths, 0);
|
||||
if (filePaths == null || filePaths.Length == 0)
|
||||
{
|
||||
dirPaths.CopyTo(paths, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
dirPaths.CopyTo(paths, filePaths.Length - 1);
|
||||
}
|
||||
|
||||
foreach (string path in paths)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
string ext = Path.GetExtension(path).ToLower();
|
||||
if (".exe".Equals(ext) || ".lnk".Equals(ext))
|
||||
{
|
||||
try
|
||||
{
|
||||
IconInfo iconInfo = CommonCode.GetIconInfoByPath_NoWrite(path);
|
||||
if (iconInfo.Path_NoWrite != null)
|
||||
{
|
||||
iconInfo.Content_NoWrite = iconInfo.Path_NoWrite + "\n" + iconInfo.Name_NoWrite;
|
||||
listInfos.Add(iconInfo);
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
else if (Directory.Exists(path))
|
||||
{
|
||||
GetInfos(path, listInfos);
|
||||
}
|
||||
}
|
||||
|
||||
//FileSystemInfo[] fileInfoArr = di.GetFileSystemInfos();
|
||||
//foreach(FileSystemInfo fi in fileInfoArr)
|
||||
//{
|
||||
// string path = fi.FullName;
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统项目
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<IconInfo> GetSysteIconInfos()
|
||||
{
|
||||
List<IconInfo> iconInfos = new List<IconInfo>();
|
||||
|
||||
Hashtable systemIcons = Constants.SYSTEM_ICONS;
|
||||
IconInfo iconInfo;
|
||||
foreach (object key in systemIcons.Keys)
|
||||
{
|
||||
string keyStr = key.ToString();
|
||||
iconInfo = new IconInfo
|
||||
{
|
||||
Name_NoWrite = systemIcons[key].ToString()
|
||||
};
|
||||
iconInfo.BitmapImage_NoWrite = new BitmapImage(
|
||||
new Uri("pack://application:,,,/GeekDesk;component/Resource/Image/SystemIcon/" + keyStr + ".png"
|
||||
, UriKind.RelativeOrAbsolute));
|
||||
iconInfo.StartArg = keyStr;
|
||||
iconInfo.Content_NoWrite = iconInfo.Name_NoWrite;
|
||||
iconInfos.Add(iconInfo);
|
||||
}
|
||||
return iconInfos;
|
||||
}
|
||||
|
||||
public class SystemItemViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private List<IconInfo> iconInfos;
|
||||
private AppConfig appConfig;
|
||||
|
||||
public SystemItemViewModel()
|
||||
{
|
||||
this.AppConfig = MainWindow.appData.AppConfig;
|
||||
}
|
||||
|
||||
public AppConfig AppConfig
|
||||
{
|
||||
get
|
||||
{
|
||||
return appConfig;
|
||||
}
|
||||
set
|
||||
{
|
||||
appConfig = value;
|
||||
OnPropertyChanged("AppConfig");
|
||||
}
|
||||
}
|
||||
public List<IconInfo> IconInfos
|
||||
{
|
||||
get
|
||||
{
|
||||
return iconInfos;
|
||||
}
|
||||
set
|
||||
{
|
||||
iconInfos = value;
|
||||
OnPropertyChanged("IconInfos");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static System.Windows.Window window = null;
|
||||
public static void Show()
|
||||
{
|
||||
if (window == null || !window.Activate())
|
||||
{
|
||||
window = new SystemItemWindow();
|
||||
}
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,70 +4,111 @@
|
||||
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:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:local="clr-namespace:GeekDesk"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Height="670"
|
||||
Width="450"
|
||||
Title="TaskInfo"
|
||||
Height="450"
|
||||
Width="510"
|
||||
WindowStyle="None"
|
||||
Title=""
|
||||
ResizeMode="NoResize"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent" ShowInTaskbar="False"
|
||||
>
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
<Window.Resources>
|
||||
|
||||
<cvt:TodoTaskExecConvert x:Key="TodoTaskExecConvert"/>
|
||||
</Window.Resources>
|
||||
<Border CornerRadius="3" BorderThickness="2" BorderBrush="Black" Margin="0,0,0,313.323" MouseDown="DragMove">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="AliceBlue"/>
|
||||
</Border.Background>
|
||||
<Border.Resources>
|
||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||
<Setter Property="Width" Value="65"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
<Grid Margin="0,0,0,8">
|
||||
<hc:SimplePanel Margin="20" HorizontalAlignment="Center">
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<WrapPanel>
|
||||
<TextBlock Text="待办任务:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBlock Text="*" Foreground="Red" />
|
||||
</WrapPanel>
|
||||
<TextBox x:Name="Title" Width="290" FontSize="14" />
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,48.997,0,-48.997">
|
||||
<TextBlock Text="待办详情:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBox x:Name="Msg" TextWrapping="Wrap"
|
||||
<Grid Margin="20">
|
||||
<Grid.Effect>
|
||||
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
|
||||
RenderingBias="Quality" ShadowDepth="2"/>
|
||||
</Grid.Effect>
|
||||
<Border Style="{StaticResource BorderBG}" MouseDown="DragMove">
|
||||
<Border.Resources>
|
||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||
<Setter Property="Width" Value="67"/>
|
||||
<Setter Property="Margin" Value="0,5,0,0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
<Grid Margin="0,15,0,0">
|
||||
<StackPanel Margin="20" HorizontalAlignment="Center">
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="待办任务:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBlock Text="*" Foreground="Red" />
|
||||
</WrapPanel>
|
||||
<TextBox x:Name="Title" Style="{StaticResource MyTextBoxStyle}" Width="290" Text="{Binding Title, Mode=OneWay}" FontSize="14" />
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||
<TextBlock Text="待办详情:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBox x:Name="Msg" TextWrapping="Wrap"
|
||||
Style="{StaticResource MyTextBoxStyle}"
|
||||
Margin="5,0,0,0"
|
||||
Text="{Binding Msg, Mode=OneWay}"
|
||||
AcceptsReturn="True"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
Height="100" MaxHeight="150" MinHeight="100" Width="290" MinWidth="290"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,167.622,0,-167.622">
|
||||
<TextBlock Text="待办时间*:" Style="{StaticResource LeftTB}"/>
|
||||
<hc:DateTimePicker x:Name="ExeTime" ErrorStr="test" Width="200"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||
<TextBlock Text="运行方式:" Style="{StaticResource LeftTB}"/>
|
||||
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Tag="1"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="指定时间"
|
||||
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=1}"/>
|
||||
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Tag="2"
|
||||
Style="{StaticResource MyRadioBtnStyle}" Content="CRON表达式"
|
||||
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=2}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,228,0,-228">
|
||||
<TextBlock Text="完成时间:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBlock x:Name="DoneTime" Width="200"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel x:Name="SetTimePanel" Height="30" Visibility="Visible" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="指定时间:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBlock Text="*" Foreground="Red"/>
|
||||
</WrapPanel>
|
||||
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" Width="200" Margin="1.6,0,0,0">
|
||||
<hc:DateTimePicker.Background>
|
||||
<SolidColorBrush Color="White" Opacity="0.7"/>
|
||||
</hc:DateTimePicker.Background>
|
||||
</hc:DateTimePicker>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel x:Name="CronPanel" Height="30" Visibility="Collapsed" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="CRON:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBlock Text="*" Foreground="Red" />
|
||||
</WrapPanel>
|
||||
<TextBox x:Name="Cron" Style="{StaticResource MyTextBoxStyle}" Width="290" Text="{Binding Cron, Mode=OneWay}" FontSize="14" />
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,273.333,0,-93.333" Grid.ColumnSpan="4">
|
||||
<Button Content="保存" Background="#5BC0DE"
|
||||
Foreground="White" Margin="320,6,-208,-10"
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="完成时间:" Style="{StaticResource LeftTB}"/>
|
||||
</WrapPanel>
|
||||
<TextBlock x:Name="DoneTime" VerticalAlignment="Center" Margin="5,6,0,0" Text="{Binding DoneTime, Mode=OneWay}" Width="200"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||
<Button Content="保存" Style="{StaticResource MyBtnStyle}" Margin="320,6,-208,-10"
|
||||
Click="Save_Button_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</hc:SimplePanel>
|
||||
<Button Panel.ZIndex="2" 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"/>
|
||||
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
<Button Panel.ZIndex="2" 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"/>
|
||||
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,26 +1,20 @@
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using Quartz;
|
||||
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.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// BacklogInfoWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ToDoInfoWindow
|
||||
public partial class ToDoInfoWindow : IWindowCommon
|
||||
{
|
||||
|
||||
private static int windowType = -1;
|
||||
@@ -29,23 +23,32 @@ namespace GeekDesk.Control.Windows
|
||||
|
||||
private AppData appData = MainWindow.appData;
|
||||
|
||||
private ToDoInfo info;
|
||||
//private ToDoInfo info;
|
||||
|
||||
private ToDoInfoWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
ExeTime.SelectedDateTime = DateTime.Now.AddMinutes(10);
|
||||
|
||||
this.Topmost = true;
|
||||
DateTime time = DateTime.Now.AddMinutes(10);
|
||||
ExeTime.SelectedDateTime = time;
|
||||
SetTimePanel.Visibility = Visibility.Visible;
|
||||
this.DataContext = new ToDoInfo
|
||||
{
|
||||
ExeTime = time.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
};
|
||||
}
|
||||
private ToDoInfoWindow(ToDoInfo info)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Topmost = true;
|
||||
Title.Text = info.Title;
|
||||
Msg.Text = info.Msg;
|
||||
ExeTime.Text = info.ExeTime;
|
||||
DoneTime.Text = info.DoneTime;
|
||||
this.info = info;
|
||||
this.DataContext = info;
|
||||
SetTimePanel.Visibility = Visibility.Visible;
|
||||
//Title.Text = info.Title;
|
||||
//Msg.Text = info.Msg;
|
||||
//ExeTime.Text = info.ExeTime;
|
||||
//DoneTime.Text = info.DoneTime;
|
||||
//this.info = info;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,43 +82,103 @@ namespace GeekDesk.Control.Windows
|
||||
/// <param name="e"></param>
|
||||
private void Save_Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (Title.Text.Trim() == "" || ExeTime.Text.Trim() == "")
|
||||
DateTime dt;
|
||||
string execTime;
|
||||
TodoTaskExecType execType;
|
||||
if (Title.Text.Trim() == "")
|
||||
{
|
||||
Growl.Warning("任务标题 和 待办时间不能为空!");
|
||||
Growl.Warning("任务标题不能为空!");
|
||||
return;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
if (SetTimePanel.Visibility == Visibility.Visible)
|
||||
{
|
||||
Convert.ToDateTime(ExeTime.Text);
|
||||
} catch (Exception)
|
||||
execType = TodoTaskExecType.SET_TIME;
|
||||
if (ExeTime.Text.Trim() == "")
|
||||
{
|
||||
Growl.Warning("执行时间不能为空!");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
dt = Convert.ToDateTime(ExeTime.Text);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Growl.Warning("请输入正确的时间!");
|
||||
return;
|
||||
}
|
||||
execTime = ExeTime.Text;
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("请输入正确的时间!");
|
||||
return;
|
||||
execType = TodoTaskExecType.CRON;
|
||||
if (Cron.Text.Trim() == "")
|
||||
{
|
||||
Growl.Warning("Cron表达式不能为空!");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
bool isValid = CronExpression.IsValidExpression(Cron.Text);
|
||||
if (!isValid) throw new Exception();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Growl.Warning("请输入正确的Cron表达式!");
|
||||
return;
|
||||
}
|
||||
CronExpression exp = new CronExpression(Cron.Text);
|
||||
DateTime dd = DateTime.Now;
|
||||
DateTimeOffset ddo = DateTime.SpecifyKind(dd, DateTimeKind.Local);
|
||||
ddo = (DateTimeOffset)exp.GetNextValidTimeAfter(ddo);
|
||||
execTime = ddo.LocalDateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
if (windowType == NEW_TODO)
|
||||
dt = Convert.ToDateTime(execTime);
|
||||
ToDoInfo info = new ToDoInfo
|
||||
{
|
||||
info = new ToDoInfo
|
||||
Title = Title.Text,
|
||||
Msg = Msg.Text,
|
||||
ExeTime = execTime,
|
||||
ExecType = execType,
|
||||
Cron = Cron.Text
|
||||
};
|
||||
if (windowType != NEW_TODO)
|
||||
{
|
||||
ToDoInfo tdi = this.DataContext as ToDoInfo;
|
||||
if (appData.HiToDoList.Contains(tdi))
|
||||
{
|
||||
Title = Title.Text,
|
||||
Msg = Msg.Text,
|
||||
ExeTime = ExeTime.Text
|
||||
};
|
||||
appData.ToDoList.Add(info);
|
||||
} else
|
||||
{
|
||||
int index =appData.ToDoList.IndexOf(info);
|
||||
appData.ToDoList.Remove(info);
|
||||
info.Title = Title.Text;
|
||||
info.Msg = Msg.Text;
|
||||
info.ExeTime = ExeTime.Text;
|
||||
info.DoneTime = DoneTime.Text;
|
||||
appData.ToDoList.Insert(index, info);
|
||||
appData.HiToDoList.Remove(tdi);
|
||||
}
|
||||
else if (appData.ToDoList.Contains(tdi))
|
||||
{
|
||||
appData.ToDoList.Remove(tdi);
|
||||
}
|
||||
}
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
appData.ToDoList.Add(info);
|
||||
|
||||
DateTime dtNow = DateTime.Now;
|
||||
TimeSpan ts = dt.Subtract(dtNow);
|
||||
int minutes = (int)Math.Ceiling(ts.TotalMinutes);
|
||||
if (minutes < 0)
|
||||
{
|
||||
minutes = 0;
|
||||
}
|
||||
if (minutes > 60)
|
||||
{
|
||||
int m = minutes % 60;
|
||||
int h = minutes / 60;
|
||||
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + h + " 小时零 " + m + " 分钟后提醒您!");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + minutes + " 分钟后提醒您!");
|
||||
}
|
||||
|
||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@@ -131,6 +194,19 @@ namespace GeekDesk.Control.Windows
|
||||
window.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
public static void ShowOrHide()
|
||||
{
|
||||
if (window == null || !window.Activate())
|
||||
{
|
||||
window = new ToDoInfoWindow();
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static System.Windows.Window GetThis()
|
||||
{
|
||||
@@ -138,6 +214,7 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
window = new ToDoInfoWindow();
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
window.Visibility = Visibility.Collapsed;
|
||||
windowType = NEW_TODO;
|
||||
@@ -153,6 +230,32 @@ namespace GeekDesk.Control.Windows
|
||||
}
|
||||
windowType = DETAIL_TODO;
|
||||
window2.Show();
|
||||
Keyboard.Focus(window2);
|
||||
}
|
||||
|
||||
private void ExecType_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TodoTaskExecType tag = (TodoTaskExecType)Convert.ToInt32((sender as RadioButton).Tag.ToString());
|
||||
switch (tag)
|
||||
{
|
||||
case TodoTaskExecType.SET_TIME:
|
||||
SetTimePanel.Visibility = Visibility.Visible;
|
||||
CronPanel.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
default:
|
||||
CronPanel.Visibility = Visibility.Visible;
|
||||
SetTimePanel.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,60 +7,51 @@
|
||||
xmlns:local="clr-namespace:GeekDesk"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Height="450"
|
||||
Width="850"
|
||||
Height="550"
|
||||
Width="1000"
|
||||
Title="Task"
|
||||
ResizeMode="NoResize"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent" ShowInTaskbar="False"
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
<Window.Resources>
|
||||
<Style x:Key="MenuStyle" TargetType="hc:SideMenuItem" BasedOn="{StaticResource SideMenuItemBaseStyle}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Background" Value="AliceBlue"/>
|
||||
</Style.Setters>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#FFE2E2E2"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#FFDAD7D7"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Border CornerRadius="4" BorderThickness="0">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>
|
||||
</Border.Background>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="140"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<hc:Card Grid.Row="0" Grid.Column="0">
|
||||
<hc:SideMenu BorderThickness="1"
|
||||
<Grid Margin="50">
|
||||
<Grid.Effect>
|
||||
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
|
||||
RenderingBias="Quality" ShadowDepth="2"/>
|
||||
</Grid.Effect>
|
||||
|
||||
<Border Style="{StaticResource BorderBG}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="140"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<hc:Card Grid.Row="0" Grid.Column="0" Background="Transparent" BorderThickness="0">
|
||||
<hc:SideMenu BorderThickness="0"
|
||||
AutoSelect="True"
|
||||
Background="Transparent"
|
||||
Margin="5"
|
||||
>
|
||||
<hc:SideMenu.Background>
|
||||
<SolidColorBrush Color="AliceBlue"/>
|
||||
</hc:SideMenu.Background>
|
||||
|
||||
<hc:SideMenu.ItemContainerStyle>
|
||||
<Style TargetType="hc:SideMenuItem" BasedOn="{StaticResource MenuStyle}"/>
|
||||
</hc:SideMenu.ItemContainerStyle>
|
||||
<hc:SideMenu.ItemContainerStyle>
|
||||
<Style TargetType="hc:SideMenuItem" BasedOn="{StaticResource MyMenuStyle}"/>
|
||||
</hc:SideMenu.ItemContainerStyle>
|
||||
|
||||
<hc:SideMenuItem Header="待办列表"
|
||||
<hc:SideMenuItem Header="待办列表"
|
||||
IsSelected="True"
|
||||
Selected="MemuClick"
|
||||
Tag="ExeList"
|
||||
>
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
BorderThickness="0"
|
||||
@@ -69,13 +60,13 @@
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="历史待办"
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="历史待办"
|
||||
Tag="History"
|
||||
Selected="MemuClick">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
IsEnabled="False"
|
||||
Opacity="1"
|
||||
BorderThickness="0"
|
||||
@@ -84,21 +75,26 @@
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</hc:Card>
|
||||
<hc:Card Grid.Row="0" Grid.Column="1" x:Name="RightCard" Height="450" MouseDown="DragMove" />
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</hc:Card>
|
||||
<UniformGrid x:Name="UFG" Grid.Column="1" Grid.Row="0">
|
||||
<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 Content="新建待办"
|
||||
<Button Width="22" Height="22" Click="Close_Button_Click" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" Grid.Column="1"/>
|
||||
<Button Content="新建待办"
|
||||
Panel.ZIndex="1"
|
||||
Background="#5BC0DE"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MyBtnStyle}"
|
||||
Grid.Column="1"
|
||||
Margin="590.01,29,10,384"
|
||||
Click="CreateBacklog_BtnClick"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
Margin="669,400,0,0"
|
||||
Click="CreateBacklog_BtnClick" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,27 +1,21 @@
|
||||
using GeekDesk.Control.UserControls.Backlog;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.ViewModel;
|
||||
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.Reactive.Linq;
|
||||
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.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// BacklogWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ToDoWindow
|
||||
public partial class ToDoWindow : IWindowCommon
|
||||
{
|
||||
private static TodoControl backlog = new TodoControl();
|
||||
private AppData appData = MainWindow.appData;
|
||||
@@ -30,7 +24,18 @@ namespace GeekDesk.Control.Windows
|
||||
InitializeComponent();
|
||||
RightCard.Content = backlog;
|
||||
backlog.BacklogList.ItemsSource = appData.ToDoList;
|
||||
backlog.type = ToDoType.NEW;
|
||||
this.Topmost = true;
|
||||
if (backlog.BacklogList.Items.Count > 0)
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Collapsed;
|
||||
backlog.BacklogList.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Visible;
|
||||
backlog.BacklogList.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,10 +68,46 @@ namespace GeekDesk.Control.Windows
|
||||
switch (smi.Tag.ToString())
|
||||
{
|
||||
case "History":
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
//排序历史待办 倒序
|
||||
|
||||
List<ToDoInfo> list = appData.HiToDoList.OrderByDescending(v=>v.DoneTime).ToList();
|
||||
appData.HiToDoList.Clear();
|
||||
foreach (var item in list)
|
||||
{
|
||||
appData.HiToDoList.Add(item);
|
||||
}
|
||||
backlog.BacklogList.ItemsSource = appData.HiToDoList;
|
||||
if (backlog.BacklogList.Items.Count > 0)
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Collapsed;
|
||||
backlog.BacklogList.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
backlog.NoData.Visibility = Visibility.Visible;
|
||||
backlog.BacklogList.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
backlog.type = ToDoType.HISTORY;
|
||||
backlog.IsNewToDo.Text = "N";
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
default:
|
||||
UFG.Visibility = Visibility.Collapsed;
|
||||
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.IsNewToDo.Text = "Y";
|
||||
UFG.Visibility = Visibility.Visible;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -90,8 +131,31 @@ namespace GeekDesk.Control.Windows
|
||||
window = new ToDoWindow();
|
||||
}
|
||||
window.Show();
|
||||
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)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,39 +6,61 @@
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.Windows"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
Title="UpdateWindow" Height="300" Width="450"
|
||||
Height="460" Width="610"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent" ShowInTaskbar="False">
|
||||
<Border CornerRadius="4" Background="AliceBlue" BorderThickness="1" BorderBrush="Green" MouseDown="DragMove">
|
||||
<StackPanel HorizontalAlignment="Center">
|
||||
<hc:Card BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="20,20,20,0">
|
||||
<!--Card 的内容部分-->
|
||||
<Border CornerRadius="4,4,0,0" Height="160">
|
||||
<StackPanel>
|
||||
<TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
|
||||
<TextBlock Margin="15" x:Name="Msg" TextWrapping="Wrap" VerticalAlignment="Center" Text=""/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!--Card 的尾部部分-->
|
||||
<hc:Card.Footer>
|
||||
<StackPanel Margin="10" Width="420">
|
||||
<!--Card 的一级内容-->
|
||||
<TextBlock TextWrapping="NoWrap" x:Name="Title" Style="{DynamicResource TextBlockLargeBold}" TextTrimming="CharacterEllipsis"
|
||||
Title=""
|
||||
ResizeMode="NoResize"
|
||||
Background="Transparent" ShowInTaskbar="False"
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown">
|
||||
<Grid Margin="20">
|
||||
<Grid.Effect>
|
||||
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||
RenderingBias="Quality" ShadowDepth="2"/>
|
||||
</Grid.Effect>
|
||||
<Border CornerRadius="4" Background="White" BorderThickness="0" MouseDown="DragMove">
|
||||
<StackPanel HorizontalAlignment="Center">
|
||||
<hc:Card BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="20,20,20,0">
|
||||
<!--Card 的内容部分-->
|
||||
<Border CornerRadius="4,4,0,0">
|
||||
<StackPanel>
|
||||
<hc:SimplePanel VerticalAlignment="Center">
|
||||
<TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
|
||||
<Button HorizontalAlignment="Right" Margin="0,0,10,0"
|
||||
Content="去点个Star" Click="StarBtnClick"
|
||||
Style="{StaticResource MyBtnStyle}"
|
||||
hc:IconElement.Geometry="M718.565517 863.126069c-7.344552 0-15.077517-2.189241-22.987034-6.285241L512 760.337655l-183.613793 96.503173c-18.785103 9.851586-37.499586 7.521103-48.16331-5.12-5.12-6.10869-10.557793-17.125517-7.485794-35.345656l35.063173-204.411586L159.249655 467.155862c-12.747034-12.393931-17.584552-27.153655-13.241379-40.430345 4.343172-13.312 16.913655-22.386759 34.568827-24.929103l205.223725-29.837242 91.806896-185.979586c7.874207-15.995586 20.409379-25.140966 34.392276-25.140965 13.947586 0 26.482759 9.145379 34.392276 25.140965l91.771586 185.979586 205.259035 29.837242c17.619862 2.577655 30.190345 11.652414 34.498206 24.964414 4.378483 13.27669-0.529655 28.001103-13.241379 40.430344l-148.51531 144.807725 35.063172 204.411586c3.10731 18.149517-2.365793 29.272276-7.485793 35.345655a32.273655 32.273655 0 0 1-25.176276 11.369931z"
|
||||
/>
|
||||
</hc:SimplePanel>
|
||||
<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>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!--Card 的尾部部分-->
|
||||
<hc:Card.Footer>
|
||||
<StackPanel Margin="10" Width="520">
|
||||
<!--Card 的一级内容-->
|
||||
<TextBlock TextWrapping="NoWrap" x:Name="Title" Style="{DynamicResource TextBlockLargeBold}" TextTrimming="CharacterEllipsis"
|
||||
Text=""
|
||||
HorizontalAlignment="Left"/>
|
||||
<!--Card 的二级内容-->
|
||||
<TextBlock TextWrapping="NoWrap" x:Name="SubTitle" Style="{DynamicResource TextBlockDefault}" TextTrimming="CharacterEllipsis"
|
||||
<!--Card 的二级内容-->
|
||||
<TextBlock TextWrapping="NoWrap" x:Name="SubTitle" Style="{DynamicResource TextBlockDefault}" TextTrimming="CharacterEllipsis"
|
||||
Margin="0,6,0,0"
|
||||
HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
</hc:Card.Footer>
|
||||
</hc:Card>
|
||||
<hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
|
||||
<Button Content="暂不更新" Click="Close_Click" />
|
||||
<Button Content="前往更新" Click="Confirm_Click" Background="#5BC0DE" Foreground="White" RenderTransformOrigin="0.696,0.45"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</hc:Card.Footer>
|
||||
</hc:Card>
|
||||
<hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="暂不更新" Click="Close_Click"/>
|
||||
<Button Style="{StaticResource MyBtnStyle}" Content="前往更新" Click="Confirm_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</StackPanel>
|
||||
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,29 +1,21 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net;
|
||||
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.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// UpdateWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class UpdateWindow : Window
|
||||
public partial class UpdateWindow : Window, IWindowCommon
|
||||
{
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
private static string githubUrl = "";
|
||||
@@ -33,6 +25,7 @@ namespace GeekDesk.Control.Windows
|
||||
try
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
this.Topmost = true;
|
||||
InitializeComponent();
|
||||
DataHandle(jo);
|
||||
}
|
||||
@@ -40,7 +33,7 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -66,9 +59,9 @@ namespace GeekDesk.Control.Windows
|
||||
githubUrl = StringUtil.IsEmpty(jo["githubUrl"]) ? ConfigurationManager.AppSettings["GitHubUrl"] : jo["githubUrl"].ToString();
|
||||
giteeUrl = StringUtil.IsEmpty(jo["giteeUrl"]) ? ConfigurationManager.AppSettings["GiteeUrl"] : jo["giteeUrl"].ToString();
|
||||
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";
|
||||
}
|
||||
Msg.Text = msg;
|
||||
}
|
||||
@@ -90,7 +83,11 @@ namespace GeekDesk.Control.Windows
|
||||
packageUrl = giteeUrl;
|
||||
break;
|
||||
}
|
||||
Process.Start(packageUrl);
|
||||
Process.Start(new ProcessStartInfo("cmd", $"/c start {packageUrl}")
|
||||
{
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
});
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@@ -102,6 +99,71 @@ namespace GeekDesk.Control.Windows
|
||||
window = new UpdateWindow(jo);
|
||||
}
|
||||
window.Show();
|
||||
window.Activate();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Converts/Boolean2VisibilityConverter.cs
Normal file
39
Converts/Boolean2VisibilityConverter.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
internal class Boolean2VisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
bool param = false;
|
||||
if (value != null)
|
||||
{
|
||||
param = (bool)value;
|
||||
}
|
||||
if (param)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
} else
|
||||
{
|
||||
return (Visibility)parameter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if ((bool)value)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
|
||||
54
Converts/GetWidthByWWConvert.cs
Normal file
54
Converts/GetWidthByWWConvert.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.ViewModel;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主窗口width 和传入类型 获取其它宽度
|
||||
/// </summary>
|
||||
class GetWidthByWWConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
WidthTypeEnum type = (WidthTypeEnum)parameter;
|
||||
|
||||
AppConfig config = MainWindow.appData.AppConfig;
|
||||
|
||||
if (WidthTypeEnum.LEFT_CARD == type)
|
||||
{
|
||||
return config.MenuCardWidth;
|
||||
}
|
||||
else if (WidthTypeEnum.RIGHT_CARD == type)
|
||||
{
|
||||
return config.WindowWidth - config.MenuCardWidth;
|
||||
} else if (WidthTypeEnum.RIGHT_CARD_HALF == type)
|
||||
{
|
||||
return (config.WindowWidth - config.MenuCardWidth) * 0.618;
|
||||
} else if (WidthTypeEnum.RIGHT_CARD_HALF_TEXT == type)
|
||||
{
|
||||
return (config.WindowWidth - config.MenuCardWidth) * 0.618 - config.ImageWidth - 20;
|
||||
} else if (WidthTypeEnum.RIGHT_CARD_20 == type)
|
||||
{
|
||||
return (config.WindowWidth - config.MenuCardWidth) - 20;
|
||||
}
|
||||
else if (WidthTypeEnum.RIGHT_CARD_40 == type)
|
||||
{
|
||||
return (config.WindowWidth - config.MenuCardWidth) - 40;
|
||||
}
|
||||
else if (WidthTypeEnum.RIGHT_CARD_70 == type)
|
||||
{
|
||||
return (config.WindowWidth - config.MenuCardWidth) - 70;
|
||||
}
|
||||
|
||||
return config.WindowWidth;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class HideTypeConvert : IValueConverter
|
||||
public class HideTypeConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
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;
|
||||
|
||||
@@ -14,12 +10,21 @@ namespace GeekDesk.Converts
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
41
Converts/MenuInfoConvert.cs
Normal file
41
Converts/MenuInfoConvert.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class MenuInfoConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
int menuIndex = MainWindow.appData.AppConfig.SelectedMenuIndex;
|
||||
if (menuIndex == -1)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
string type = parameter.ToString();
|
||||
if ("1".Equals(type))
|
||||
{
|
||||
return MainWindow.appData.MenuList[menuIndex].MenuGeometry;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MainWindow.appData.MenuList[menuIndex].MenuName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
//bool isChecked = (bool)value;
|
||||
//if (!isChecked)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
//return (AppHideType)int.Parse(parameter.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,9 @@ namespace GeekDesk.Converts
|
||||
{
|
||||
if (value != null && value.ToString().Length > 0)
|
||||
{
|
||||
return System.Convert.ToDouble(value.ToString()) - 10d;
|
||||
if (parameter == null) parameter = 0.00;
|
||||
double p = System.Convert.ToDouble(parameter.ToString());
|
||||
return System.Convert.ToDouble(value.ToString()) - p;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
Converts/SearchResWidth.cs
Normal file
29
Converts/SearchResWidth.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Converts/SortTypeConvert.cs
Normal file
25
Converts/SortTypeConvert.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class SortTypeConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (SortType)value == (SortType)int.Parse(parameter.ToString());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
bool isChecked = (bool)value;
|
||||
if (!isChecked)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return (SortType)int.Parse(parameter.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
30
Converts/TextToColorConverter.cs
Normal file
30
Converts/TextToColorConverter.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
internal class TextToColorConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string str = value as string;
|
||||
return new SolidColorBrush((Color)ColorConverter.ConvertFromString(str));
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string str = value as string;
|
||||
return new SolidColorBrush((Color)ColorConverter.ConvertFromString(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Converts/TodoTaskExecConvert.cs
Normal file
25
Converts/TodoTaskExecConvert.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
public class TodoTaskExecConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (TodoTaskExecType)value == (TodoTaskExecType)int.Parse(parameter.ToString());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
bool isChecked = (bool)value;
|
||||
if (!isChecked)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return (TodoTaskExecType)int.Parse(parameter.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
|
||||
32
Converts/ValueConvert.cs
Normal file
32
Converts/ValueConvert.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
internal class ValueConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool) {
|
||||
Dictionary<bool, string> dict = (Dictionary<bool, string>)parameter;
|
||||
bool val = (bool)value;
|
||||
return dict[val];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool)
|
||||
{
|
||||
Dictionary<bool, string> dict = (Dictionary<bool, string>)parameter;
|
||||
bool val = (bool)value;
|
||||
return dict[val];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 (parameter == null)
|
||||
{
|
||||
return (Visibility)value == Visibility.Visible;
|
||||
} else
|
||||
{
|
||||
return !((Visibility)value == Visibility.Visible);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
static DraggAnimatedPanel()
|
||||
{
|
||||
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(DraggAnimatedPanel), new FrameworkPropertyMetadata(typeof(DraggAnimatedPanel)));
|
||||
}
|
||||
|
||||
25
CustomComponent/VirtualizingWrapPanel/ItemRange.cs
Normal file
25
CustomComponent/VirtualizingWrapPanel/ItemRange.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.CustomComponent.VirtualizingWrapPanel
|
||||
{
|
||||
public struct ItemRange
|
||||
{
|
||||
public int StartIndex { get; }
|
||||
public int EndIndex { get; }
|
||||
|
||||
public ItemRange(int startIndex, int endIndex) : this()
|
||||
{
|
||||
StartIndex = startIndex;
|
||||
EndIndex = endIndex;
|
||||
}
|
||||
|
||||
public bool Contains(int itemIndex)
|
||||
{
|
||||
return itemIndex >= StartIndex && itemIndex <= EndIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
CustomComponent/VirtualizingWrapPanel/ScrollDirection.cs
Normal file
14
CustomComponent/VirtualizingWrapPanel/ScrollDirection.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.CustomComponent.VirtualizingWrapPanel
|
||||
{
|
||||
public enum ScrollDirection
|
||||
{
|
||||
Vertical,
|
||||
Horizontal
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user