Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ee27e247b | ||
|
|
cf8f983f1a | ||
|
|
37e8631f73 | ||
|
|
0f6119c0ba | ||
|
|
caf75e2427 | ||
|
|
c13593bdf4 | ||
|
|
e6a95c4668 | ||
|
|
3483bf88c2 | ||
|
|
f96a76e6fb | ||
|
|
71f18b801a | ||
|
|
1bf0f9c38b | ||
|
|
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 | ||
|
|
0107ac8317 |
41
App.config
41
App.config
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
</startup>
|
</startup>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
@@ -21,15 +21,30 @@
|
|||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||||
</dependentAssembly>
|
</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>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="Version" value="2.0" />
|
<add key="Version" value="2.3.21" />
|
||||||
|
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
|
||||||
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
|
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
|
||||||
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
|
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
||||||
|
<add key="GiteeUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
||||||
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||||
<add key="GiteeUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
</appSettings>
|
||||||
</appSettings>
|
<system.web>
|
||||||
</configuration>
|
<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>
|
||||||
1
App.xaml
1
App.xaml
@@ -12,6 +12,7 @@
|
|||||||
<ResourceDictionary Source="/GeekDesk;component/Resource/Dictionary/Geometry.xaml"/>
|
<ResourceDictionary Source="/GeekDesk;component/Resource/Dictionary/Geometry.xaml"/>
|
||||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
||||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
||||||
|
<ResourceDictionary Source="/GeekDesk;component/Resource/Dictionary/CommonStyle.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|||||||
10
App.xaml.cs
10
App.xaml.cs
@@ -24,11 +24,15 @@ namespace GeekDesk
|
|||||||
private void App_Startup(object sender, StartupEventArgs e)
|
private void App_Startup(object sender, StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool ret;
|
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out bool ret);
|
||||||
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out ret);
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
Environment.Exit(0);
|
System.Threading.Thread.Sleep(2000);
|
||||||
|
mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out ret);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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 = 666, //默认窗体宽度
|
||||||
|
WINDOW_HEIGHT = 500, //默认窗体高度
|
||||||
|
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
14
Constant/IconType.cs
Normal file
14
Constant/IconType.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 IconType
|
||||||
|
{
|
||||||
|
OTHER = 1, //直接打开
|
||||||
|
URL = 2 //调用浏览器打开
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
/// <summary>
|
|
||||||
/// 默认参数
|
|
||||||
/// </summary>
|
|
||||||
namespace GeekDesk.Constant
|
|
||||||
{
|
|
||||||
public enum MainWindowEnum
|
|
||||||
{
|
|
||||||
WINDOW_WIDTH = 666, //默认窗体宽度
|
|
||||||
WINDOW_HEIGHT = 500, //默认窗体高度
|
|
||||||
MENU_CARD_WIDHT = 165, //默认菜单栏宽度
|
|
||||||
IMAGE_WIDTH = 50, //默认图标宽度
|
|
||||||
IMAGE_HEIGHT = 50, //默认图标高度
|
|
||||||
IMAGE_WIDTH_AM = 60, //动画变换宽度
|
|
||||||
IMAGE_HEIGHT_AM = 60 //动画变换高度
|
|
||||||
}
|
|
||||||
}
|
|
||||||
14
Constant/TodoTaskExecType.cs
Normal file
14
Constant/TodoTaskExecType.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 TodoTaskExecType
|
||||||
|
{
|
||||||
|
SET_TIME = 1, //指定时间
|
||||||
|
CRON = 2 //cron表达式
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,11 +2,15 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
Background="AliceBlue"
|
BorderThickness="0"
|
||||||
BorderThickness="1"
|
Style="{StaticResource BorderBG}"
|
||||||
|
Margin="15"
|
||||||
BorderBrush="{DynamicResource BorderBrush}"
|
BorderBrush="{DynamicResource BorderBrush}"
|
||||||
Width="320"
|
Width="320"
|
||||||
Height="450">
|
Height="450">
|
||||||
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="AliceBlue" Opacity="0.96"/>
|
||||||
|
</Border.Background>
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|
||||||
<Image Source="/Resource/Image/BacklogImg.png" Margin="22,35,22,361" />
|
<Image Source="/Resource/Image/BacklogImg.png" Margin="22,35,22,361" />
|
||||||
@@ -32,7 +36,7 @@
|
|||||||
</hc:Card.Footer>
|
</hc:Card.Footer>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="20" HorizontalAlignment="Center" Margin="0,346,0,0">
|
<hc:UniformSpacingPanel Spacing="20" HorizontalAlignment="Center" Margin="45.5,310,42.5,36">
|
||||||
<hc:TextBox x:Name="DelayTime" Height="20" Width="60" Text="10" PreviewTextInput="DelayTime_PreviewTextInput" PreviewLostKeyboardFocus="DelayTime_PreviewLostKeyboardFocus" />
|
<hc:TextBox x:Name="DelayTime" 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 x:Name="DelayType" hc:DropDownElement.ConsistentWidth="False" SelectedIndex="0" Height="20" Width="60">
|
||||||
<ComboBox.Items>
|
<ComboBox.Items>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using GeekDesk.Task;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Task;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
using HandyControl.Controls;
|
||||||
|
using Quartz;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -34,8 +37,36 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
ToDoInfo info = this.DataContext as ToDoInfo;
|
ToDoInfo info = this.DataContext as ToDoInfo;
|
||||||
info.DoneTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
info.DoneTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
appData.ToDoList.Remove(info); //执行任务删除
|
if (info.ExecType == TodoTaskExecType.CRON)
|
||||||
appData.HiToDoList.Add(info); //添加历史任务
|
{
|
||||||
|
CronExpression exp = new CronExpression(info.Cron);
|
||||||
|
DateTime dtNow = DateTime.Now;
|
||||||
|
DateTimeOffset ddo = DateTime.SpecifyKind(dtNow, DateTimeKind.Local);
|
||||||
|
string nextExecTime = ddo.LocalDateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
info.ExeTime = nextExecTime;
|
||||||
|
|
||||||
|
DateTime nextTime = ddo.LocalDateTime;
|
||||||
|
TimeSpan ts = nextTime.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 + " 分钟后提醒您!");
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
appData.ToDoList.Remove(info); //执行任务删除
|
||||||
|
appData.HiToDoList.Add(info); //添加历史任务
|
||||||
|
}
|
||||||
ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
|
ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
|
||||||
ToDoTask.activityBacklog.Remove(info);//激活任务删除
|
ToDoTask.activityBacklog.Remove(info);//激活任务删除
|
||||||
CommonCode.SaveAppData(appData);
|
CommonCode.SaveAppData(appData);
|
||||||
@@ -93,9 +124,11 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
case "分":
|
case "分":
|
||||||
info.ExeTime = DateTime.Now.AddMinutes(time).ToString("yyyy-MM-dd HH:mm:ss");
|
info.ExeTime = DateTime.Now.AddMinutes(time).ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Growl.SuccessGlobal("将在 " + time + " 分钟后再次提醒您!");
|
||||||
break;
|
break;
|
||||||
case "时":
|
case "时":
|
||||||
info.ExeTime = DateTime.Now.AddHours(time).ToString("yyyy-MM-dd HH:mm:ss");
|
info.ExeTime = DateTime.Now.AddHours(time).ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Growl.SuccessGlobal("将在 " + time + " 小时后再次提醒您!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
|
ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
CornerRadius="3"
|
CornerRadius="3"
|
||||||
Width="400"
|
Width="400"
|
||||||
Height="230"
|
Height="230"
|
||||||
Opacity="0.95">
|
Opacity="0.95"
|
||||||
|
Style="{StaticResource BorderBG}">
|
||||||
<Border.Resources>
|
<Border.Resources>
|
||||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||||
<Setter Property="Width" Value="100"/>
|
<Setter Property="Width" Value="100"/>
|
||||||
@@ -14,10 +15,7 @@
|
|||||||
<Setter Property="FontSize" Value="14"/>
|
<Setter Property="FontSize" Value="14"/>
|
||||||
</Style>
|
</Style>
|
||||||
</Border.Resources>
|
</Border.Resources>
|
||||||
<Border.Background>
|
<StackPanel Margin="10">
|
||||||
<SolidColorBrush Color="AliceBlue" Opacity="1"/>
|
|
||||||
</Border.Background>
|
|
||||||
<hc:SimplePanel Margin="10">
|
|
||||||
<Grid Margin="8,20,8,20">
|
<Grid Margin="8,20,8,20">
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,-10">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,-10">
|
||||||
@@ -42,10 +40,9 @@
|
|||||||
/>
|
/>
|
||||||
<Button Content="保存" Click="Confirm_Click"
|
<Button Content="保存" Click="Confirm_Click"
|
||||||
Command="hc:ControlCommands.Close"
|
Command="hc:ControlCommands.Close"
|
||||||
Background="#5BC0DE"
|
Style="{StaticResource Btn1}"/>
|
||||||
Foreground="White"/>
|
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</Grid>
|
</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"/>-->
|
<!--<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>
|
</Border>
|
||||||
@@ -4,34 +4,35 @@
|
|||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
CornerRadius="4"
|
CornerRadius="4"
|
||||||
Width="300"
|
Width="300"
|
||||||
Height="300"
|
Height="340"
|
||||||
Opacity="0.9">
|
Style="{StaticResource BorderBG}"
|
||||||
|
>
|
||||||
<Border.Resources>
|
<Border.Resources>
|
||||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||||
<Setter Property="Width" Value="40"/>
|
<Setter Property="Width" Value="40"/>
|
||||||
|
<Setter Property="TextAlignment" Value="Center"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="Margin" Value="0,8,0,0"/>
|
||||||
<Setter Property="FontSize" Value="14"/>
|
<Setter Property="FontSize" Value="14"/>
|
||||||
</Style>
|
</Style>
|
||||||
</Border.Resources>
|
</Border.Resources>
|
||||||
<Border.Background>
|
<hc:SimplePanel Margin="10" VerticalAlignment="Center">
|
||||||
<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>
|
<StackPanel>
|
||||||
</Border.Background>
|
<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:SimplePanel Margin="10">
|
<hc:UniformSpacingPanel Spacing="10">
|
||||||
<Grid Margin="8,20,8,20">
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
|
||||||
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
||||||
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
|
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,50,0,71" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,59,0,-9" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
||||||
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" Width="60" Height="60"/>
|
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
|
||||||
<Button Content="修改" Click="EditImage"/>
|
<Button Content="修改" Click="EditImage"/>
|
||||||
<Button Content="重置" Click="ReStoreImage"/>
|
<Button Content="重置" Click="ReStoreImage"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,128,0,23" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,150,0,10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10">
|
||||||
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
|
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -40,11 +41,10 @@
|
|||||||
</CheckBox.Background>
|
</CheckBox.Background>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,200,0,-27" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,218,0,-38" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
<Button Content="保存" Command="hc:ControlCommands.Close" Click="SaveProperty" Margin="208,6,-208,-10"/>
|
<Button Content="保存" Style="{StaticResource Btn1}" Click="SaveProperty" Margin="208,0,0,0"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</Grid>
|
</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" Margin="0,4,4,0"/>
|
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -14,6 +14,7 @@ namespace GeekDesk.Control.Other
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class IconInfoDialog
|
public partial class IconInfoDialog
|
||||||
{
|
{
|
||||||
|
public HandyControl.Controls.Dialog dialog;
|
||||||
|
|
||||||
public IconInfoDialog()
|
public IconInfoDialog()
|
||||||
{
|
{
|
||||||
@@ -38,6 +39,7 @@ namespace GeekDesk.Control.Other
|
|||||||
info.Name = IconName.Text;
|
info.Name = IconName.Text;
|
||||||
info.AdminStartUp = IconIsAdmin.IsChecked.Value;
|
info.AdminStartUp = IconIsAdmin.IsChecked.Value;
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
|
dialog.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -47,7 +49,7 @@ namespace GeekDesk.Control.Other
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ReStoreImage(object sender, RoutedEventArgs e)
|
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);
|
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
}
|
}
|
||||||
|
|||||||
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" Text="{Binding Name, Mode=OneWay}" Width="180" FontSize="14"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="Url:" Style="{StaticResource LeftTB}"/>
|
||||||
|
<TextBox x:Name="IconUrl" Text="{Binding Path, Mode=OneWay}" Width="180" FontSize="14"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
||||||
|
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
|
||||||
|
<Button Content="修改" Click="EditImage"/>
|
||||||
|
<Button Content="重置" Click="ReStoreImage"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10">
|
||||||
|
<Button Content="保存" Click="SaveProperty" Style="{StaticResource Btn1}" Margin="224,-10,-224,0" />
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</hc:SimplePanel>
|
||||||
|
</Border>
|
||||||
99
Control/Other/IconInfoUrlDialog.xaml.cs
Normal file
99
Control/Other/IconInfoUrlDialog.xaml.cs
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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);
|
||||||
|
}
|
||||||
|
} catch (Exception)
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,63 +7,64 @@
|
|||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="AliceBlue"
|
Background="Transparent"
|
||||||
d:DesignHeight="400" d:DesignWidth="500">
|
d:DesignHeight="400" d:DesignWidth="500">
|
||||||
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
|
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<hc:SimplePanel Margin="20,50,20,20">
|
<Grid MouseDown="DragMove">
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
<hc:SimplePanel Margin="20,50,20,20" >
|
||||||
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk "/>
|
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
|
||||||
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
|
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk V"/>
|
||||||
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
<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="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
|
||||||
|
|
||||||
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Demo-liu"
|
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Demo-liu"
|
||||||
Command="hc:ControlCommands.OpenLink"
|
Command="hc:ControlCommands.OpenLink"
|
||||||
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
|
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
|
||||||
Margin="0,0,10,0" Color="#24292F"/>
|
Margin="0,0,10,0" Color="#24292F"/>
|
||||||
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Demo-liu"
|
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Demo-liu"
|
||||||
Command="hc:ControlCommands.OpenLink"
|
Command="hc:ControlCommands.OpenLink"
|
||||||
CommandParameter=""
|
CommandParameter="https://gitee.com/demo_liu/GeekDesk"
|
||||||
Margin="0,5,10,0" Color="#C71D23"/>
|
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:UniformSpacingPanel Spacing="10" Visibility="Visible" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
|
|
||||||
|
</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:UniformSpacingPanel Spacing="10" Visibility="Visible" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
|
||||||
<TextBlock Text="更新源:" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
<TextBlock Text="更新源:" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
||||||
@@ -71,8 +72,10 @@
|
|||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
|
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
|
||||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>-->
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -31,5 +31,19 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
WeChatCode.Source = ImageUtil.Base64ToBitmapImage(Constants.WE_CHAT_CODE_IMG_BASE64);
|
WeChatCode.Source = ImageUtil.Base64ToBitmapImage(Constants.WE_CHAT_CODE_IMG_BASE64);
|
||||||
ZFBCode.Source = ImageUtil.Base64ToBitmapImage(Constants.ZFB_CODE_IMG_BASE64);
|
ZFBCode.Source = ImageUtil.Base64ToBitmapImage(Constants.ZFB_CODE_IMG_BASE64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,17 +6,21 @@
|
|||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="AliceBlue"
|
Background="Transparent"
|
||||||
d:DesignHeight="300" d:DesignWidth="450">
|
d:DesignHeight="300" d:DesignWidth="450">
|
||||||
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<hc:SimplePanel Margin="20">
|
<Grid Background="Transparent" MouseDown="DragMove"
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,0,10" Grid.ColumnSpan="4">
|
>
|
||||||
|
<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"/>
|
<TextBlock Text="面板动作设置" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,26.394,0,-16.394" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
|
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -26,7 +30,7 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,50,0,-102.337" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}">
|
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -35,10 +39,41 @@
|
|||||||
</CheckBox.Background>
|
</CheckBox.Background>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</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 Content="鼠标中间呼出" Checked="MouseMiddle_Changed" Unchecked="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}">
|
||||||
|
<CheckBox.Background>
|
||||||
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</CheckBox.Background>
|
||||||
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,115,20,-102.337" Grid.ColumnSpan="4">
|
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
|
<CheckBox Content="贴边隐藏" IsChecked="{Binding MarginHide}" Checked="MarginHide_Changed" Unchecked="MarginHide_Changed">
|
||||||
|
<CheckBox.Background>
|
||||||
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</CheckBox.Background>
|
||||||
|
</CheckBox>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
|
<CheckBox Content="主窗口动画效果" IsChecked="{Binding AppAnimation}" Checked="Animation_Checked">
|
||||||
|
<CheckBox.Background>
|
||||||
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</CheckBox.Background>
|
||||||
|
</CheckBox>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"
|
Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"
|
||||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
|
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
|
||||||
@@ -50,12 +85,12 @@
|
|||||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
|
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,164.49,-30,-154.49" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="热键设置" VerticalAlignment="Center" Margin="-26,0,26,0"/>
|
<TextBlock Text="热键设置" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,193,0,-180.337" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板:" Width="55"/>
|
<TextBlock Text="主面板:" VerticalAlignment="Center" Width="55"/>
|
||||||
<hc:TextBox HorizontalAlignment="Left"
|
<hc:TextBox HorizontalAlignment="Left"
|
||||||
Tag="Main"
|
Tag="Main"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
@@ -64,9 +99,9 @@
|
|||||||
Text="{Binding HotkeyStr}"
|
Text="{Binding HotkeyStr}"
|
||||||
KeyDown="HotKeyDown"
|
KeyDown="HotKeyDown"
|
||||||
KeyUp="HotKeyUp"
|
KeyUp="HotKeyUp"
|
||||||
Margin="12.967,-7.38,-12.967,0"/>
|
/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<!--<hc:UniformSpacingPanel Spacing="10" Margin="30,229,0,-216.337" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="新建待办:" Width="55"/>
|
<TextBlock Text="新建待办:" Width="55"/>
|
||||||
<hc:TextBox HorizontalAlignment="Left"
|
<hc:TextBox HorizontalAlignment="Left"
|
||||||
Tag="ToDo"
|
Tag="ToDo"
|
||||||
@@ -77,9 +112,10 @@
|
|||||||
Text="{Binding ToDoHotkeyStr}"
|
Text="{Binding ToDoHotkeyStr}"
|
||||||
KeyDown="HotKeyDown"
|
KeyDown="HotKeyDown"
|
||||||
KeyUp="HotKeyUp"
|
KeyUp="HotKeyUp"
|
||||||
Margin="12.967,-7.38,-12.967,0"/>
|
/>
|
||||||
</hc:UniformSpacingPanel>-->
|
</hc:UniformSpacingPanel>
|
||||||
<StackPanel hc:Growl.GrowlParent="True" hc:Growl.Token="HotKeyGrowl" VerticalAlignment="Top"/>
|
</StackPanel>
|
||||||
</hc:SimplePanel>
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Control.Windows;
|
||||||
|
using GeekDesk.Thread;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Data;
|
using HandyControl.Data;
|
||||||
@@ -19,6 +21,7 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using static GeekDesk.Util.GlobalHotKey;
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.Config
|
namespace GeekDesk.Control.UserControls.Config
|
||||||
{
|
{
|
||||||
@@ -28,9 +31,9 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
public partial class MotionControl : UserControl
|
public partial class MotionControl : UserControl
|
||||||
{
|
{
|
||||||
public static bool hotkeyFinished = true; //热键设置结束
|
public static bool hotkeyFinished = true; //热键设置结束
|
||||||
private static KeyEventArgs prevKeyTemp; //上一个按键
|
private Key prevKeyTemp = Key.None; //上一个按键
|
||||||
private static List<KeyEventArgs> keysTemp = new List<KeyEventArgs>();//存储一次快捷键集合
|
private readonly List<KeyEventArgs> keysTemp = new List<KeyEventArgs>();//存储一次快捷键集合
|
||||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
private readonly AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
|
|
||||||
public MotionControl()
|
public MotionControl()
|
||||||
{
|
{
|
||||||
@@ -47,13 +50,19 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
{
|
{
|
||||||
string tag = (sender as TextBox).Tag.ToString();
|
string tag = (sender as TextBox).Tag.ToString();
|
||||||
|
|
||||||
|
Key downKey = e.Key;
|
||||||
|
if (downKey == Key.System)
|
||||||
|
{
|
||||||
|
downKey = e.SystemKey;
|
||||||
|
}
|
||||||
|
|
||||||
bool main = false;
|
bool main = false;
|
||||||
if ("Main".Equals(tag))
|
if ("Main".Equals(tag))
|
||||||
{
|
{
|
||||||
main = true;
|
main = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!e.IsRepeat)
|
if (prevKeyTemp == Key.None || prevKeyTemp!=downKey)
|
||||||
{
|
{
|
||||||
if (hotkeyFinished)
|
if (hotkeyFinished)
|
||||||
{
|
{
|
||||||
@@ -69,25 +78,24 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
appConfig.ToDoHotkeyModifiers = 0;
|
appConfig.ToDoHotkeyModifiers = 0;
|
||||||
}
|
}
|
||||||
hotkeyFinished = false;
|
hotkeyFinished = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
//首次按下按键
|
//首次按下按键
|
||||||
if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|
if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|
||||||
|| (!main && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0)))
|
|| (!main && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0)))
|
||||||
{
|
{
|
||||||
if (CheckModifierKeys(e))
|
if (CheckModifierKeys(downKey))
|
||||||
{
|
{
|
||||||
//辅助键
|
//辅助键
|
||||||
if (main)
|
if (main)
|
||||||
{
|
{
|
||||||
appConfig.HotkeyStr = GetKeyName(e);
|
appConfig.HotkeyStr = GetKeyName(downKey);
|
||||||
appConfig.HotkeyModifiers = GetModifierKeys(e);
|
appConfig.HotkeyModifiers = GetModifierKeys(downKey);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
appConfig.ToDoHotkeyStr = GetKeyName(e);
|
appConfig.ToDoHotkeyStr = GetKeyName(downKey);
|
||||||
appConfig.ToDoHotkeyModifiers = GetModifierKeys(e);
|
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
|
||||||
}
|
}
|
||||||
prevKeyTemp = e;
|
prevKeyTemp = downKey;
|
||||||
keysTemp.Add(e);
|
keysTemp.Add(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,44 +103,43 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
{
|
{
|
||||||
//非首次按下 需要判断前一个键值是否为辅助键
|
//非首次按下 需要判断前一个键值是否为辅助键
|
||||||
if (CheckModifierKeys(prevKeyTemp)
|
if (CheckModifierKeys(prevKeyTemp)
|
||||||
&& ((e.Key >= Key.A && e.Key <= Key.Z)
|
&& ((downKey >= Key.A && downKey <= Key.Z)
|
||||||
|| (e.Key >= Key.F1 && e.Key <= Key.F12)
|
|| (downKey >= Key.F1 && downKey <= Key.F12)
|
||||||
|| (e.Key >= Key.D0 && e.Key <= Key.D9)))
|
|| (downKey >= Key.D0 && downKey <= Key.D9)))
|
||||||
{
|
{
|
||||||
if (main)
|
if (main)
|
||||||
{
|
{
|
||||||
appConfig.Hotkey = e.Key;
|
appConfig.Hotkey = downKey;
|
||||||
appConfig.HotkeyStr += e.Key.ToString();
|
appConfig.HotkeyStr += downKey.ToString();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
appConfig.ToDoHotkey = e.Key;
|
appConfig.ToDoHotkey = downKey;
|
||||||
appConfig.ToDoHotkeyStr += e.Key.ToString();
|
appConfig.ToDoHotkeyStr += downKey.ToString();
|
||||||
}
|
}
|
||||||
prevKeyTemp = e;
|
prevKeyTemp = downKey;
|
||||||
keysTemp.Add(e);
|
keysTemp.Add(e);
|
||||||
}
|
}
|
||||||
else if (CheckModifierKeys(e))
|
else if (CheckModifierKeys(downKey))
|
||||||
{
|
{
|
||||||
if (main)
|
if (main)
|
||||||
{
|
{
|
||||||
appConfig.HotkeyStr += GetKeyName(e);
|
appConfig.HotkeyStr += GetKeyName(downKey);
|
||||||
appConfig.HotkeyModifiers |= GetModifierKeys(e);
|
appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
appConfig.ToDoHotkeyStr += GetKeyName(e);
|
appConfig.ToDoHotkeyStr += GetKeyName(downKey);
|
||||||
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(e);
|
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
prevKeyTemp = e;
|
prevKeyTemp = downKey;
|
||||||
keysTemp.Add(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)
|
if (key == Key.LeftCtrl || key == Key.RightCtrl)
|
||||||
{
|
{
|
||||||
return "Ctrl + ";
|
return "Ctrl + ";
|
||||||
@@ -148,12 +155,10 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
{
|
{
|
||||||
return "Alt + ";
|
return "Alt + ";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HotkeyModifiers GetModifierKeys(KeyEventArgs e)
|
private HotkeyModifiers GetModifierKeys(Key key)
|
||||||
{
|
{
|
||||||
Key key = e.Key;
|
|
||||||
if (key == Key.LeftCtrl || key == Key.RightCtrl)
|
if (key == Key.LeftCtrl || key == Key.RightCtrl)
|
||||||
{
|
{
|
||||||
return HotkeyModifiers.MOD_CONTROL;
|
return HotkeyModifiers.MOD_CONTROL;
|
||||||
@@ -172,9 +177,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
|
return key == Key.LeftCtrl || key == Key.RightCtrl
|
||||||
|| key == Key.LWin || key == Key.RWin
|
|| key == Key.LWin || key == Key.RWin
|
||||||
|| key == Key.LeftShift || key == Key.RightShift
|
|| key == Key.LeftShift || key == Key.RightShift
|
||||||
@@ -206,20 +210,23 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
if (allKeyUp && !hotkeyFinished)
|
if (allKeyUp && !hotkeyFinished)
|
||||||
{
|
{
|
||||||
keysTemp.Clear();
|
keysTemp.Clear();
|
||||||
|
prevKeyTemp = Key.None;
|
||||||
hotkeyFinished = true;
|
hotkeyFinished = true;
|
||||||
|
|
||||||
if (main)
|
if (main)
|
||||||
{
|
{
|
||||||
if (MainWindow.hotKeyId != -1)
|
if (MainWindow.hotKeyId != -1)
|
||||||
{
|
{
|
||||||
Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
|
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
|
||||||
|
GlobalHotKey.Dispose(MainWindow.hotKeyId);
|
||||||
}
|
}
|
||||||
MainWindow.RegisterHotKey(false);
|
MainWindow.RegisterHotKey(false);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (MainWindow.toDoHotKeyId != -1)
|
if (MainWindow.toDoHotKeyId != -1)
|
||||||
{
|
{
|
||||||
Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
|
||||||
|
GlobalHotKey.Dispose(MainWindow.toDoHotKeyId);
|
||||||
}
|
}
|
||||||
MainWindow.RegisterCreateToDoHotKey(false);
|
MainWindow.RegisterCreateToDoHotKey(false);
|
||||||
}
|
}
|
||||||
@@ -229,66 +236,59 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void ShowApp(MainWindow mainWindow)
|
/// <summary>
|
||||||
//{
|
/// 移动窗口
|
||||||
// if (appConfig.FollowMouse)
|
/// </summary>
|
||||||
// {
|
/// <param name="sender"></param>
|
||||||
// ShowAppAndFollowMouse(mainWindow);
|
/// <param name="e"></param>
|
||||||
// }
|
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||||
// else
|
{
|
||||||
// {
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
// this.Visibility = Visibility.Visible;
|
{
|
||||||
// }
|
Window.GetWindow(this).DragMove();
|
||||||
// Keyboard.Focus(this);
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
///// <summary>
|
private void MarginHide_Changed(object sender, RoutedEventArgs e)
|
||||||
///// 随鼠标位置显示面板 (鼠标始终在中间)
|
{
|
||||||
///// </summary>
|
if (appConfig.MarginHide)
|
||||||
//private void ShowAppAndFollowMouse(MainWindow mainWindow)
|
{
|
||||||
//{
|
MainWindow.hide.TimerSet();
|
||||||
// //获取鼠标位置
|
} else
|
||||||
// System.Windows.Point p = MouseUtil.GetMousePosition();
|
{
|
||||||
// double left = SystemParameters.VirtualScreenLeft;
|
if (MainWindow.hide.timer != null)
|
||||||
// double top = SystemParameters.VirtualScreenTop;
|
{
|
||||||
// double width = SystemParameters.VirtualScreenWidth;
|
MainWindow.hide.TimerStop();
|
||||||
// double height = SystemParameters.VirtualScreenHeight;
|
}
|
||||||
// double right = width - Math.Abs(left);
|
}
|
||||||
// double bottom = height - Math.Abs(top);
|
}
|
||||||
|
|
||||||
|
private void Animation_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed)
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.Visibility = Visibility.Visible;
|
||||||
|
// 执行一下动画 防止太过突兀
|
||||||
|
MainWindow.FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (p.X - mainWindow.Width / 2 < left)
|
/// <summary>
|
||||||
// {
|
/// 鼠标中键呼出 change
|
||||||
// //判断是否在最左边缘
|
/// </summary>
|
||||||
// mainWindow.Left = left;
|
/// <param name="sender"></param>
|
||||||
// }
|
/// <param name="e"></param>
|
||||||
// else if (p.X + mainWindow.Width / 2 > right)
|
private void MouseMiddle_Changed(object sender, RoutedEventArgs e)
|
||||||
// {
|
{
|
||||||
// //判断是否在最右边缘
|
if (appConfig.MouseMiddleShow)
|
||||||
// mainWindow.Left = right - mainWindow.Width;
|
{
|
||||||
// }
|
MouseHookThread.MiddleHook();
|
||||||
// else
|
} else
|
||||||
// {
|
{
|
||||||
// mainWindow.Left = p.X - mainWindow.Width / 2;
|
MouseHookThread.Dispose();
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (p.Y - mainWindow.Height / 2 < top)
|
|
||||||
// {
|
|
||||||
// //判断是否在最上边缘
|
|
||||||
// mainWindow.Top = top;
|
|
||||||
// }
|
|
||||||
// else if (p.Y + mainWindow.Height / 2 > bottom)
|
|
||||||
// {
|
|
||||||
// //判断是否在最下边缘
|
|
||||||
// mainWindow.Top = bottom - mainWindow.Height;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// mainWindow.Top = p.Y - mainWindow.Height / 2;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// mainWindow.Visibility = Visibility.Visible;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,52 +7,55 @@
|
|||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="AliceBlue"
|
Background="Transparent"
|
||||||
d:DesignHeight="400" d:DesignWidth="500"
|
d:DesignHeight="400" d:DesignWidth="500"
|
||||||
>
|
>
|
||||||
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
|
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<hc:SimplePanel Margin="20">
|
<Grid MouseDown="DragMove" Background="Transparent">
|
||||||
<StackPanel >
|
<hc:SimplePanel Margin="20" >
|
||||||
<TextBlock Text="程序设置" />
|
<StackPanel >
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
<TextBlock Text="程序设置" />
|
||||||
<CheckBox x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click">
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||||
<CheckBox.Background>
|
<CheckBox x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click">
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<CheckBox.Background>
|
||||||
<GradientStop Color="#FF9EA3A6"/>
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
</LinearGradientBrush>
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
</CheckBox.Background>
|
</LinearGradientBrush>
|
||||||
</CheckBox>
|
</CheckBox.Background>
|
||||||
</hc:UniformSpacingPanel>
|
</CheckBox>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
|
</hc:UniformSpacingPanel>
|
||||||
<CheckBox Content="性能模式" IsChecked="{Binding PMModel}"
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,6,0,0">
|
||||||
|
<CheckBox Content="性能模式" IsChecked="{Binding PMModel}"
|
||||||
hc:Poptip.HitMode="None"
|
hc:Poptip.HitMode="None"
|
||||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
hc:Poptip.Content="开启性能模式将取消图标动画效果"
|
hc:Poptip.Content="开启性能模式将取消图标动画效果"
|
||||||
hc:Poptip.Placement="TopLeft">
|
hc:Poptip.Placement="TopLeft">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
<GradientStop Color="#FF9EA3A6"/>
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
</LinearGradientBrush>
|
</LinearGradientBrush>
|
||||||
</CheckBox.Background>
|
</CheckBox.Background>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<TextBlock Text="更新源" Margin="0,25,0,0"/>
|
<TextBlock Text="更新源" Margin="0,25,0,0"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
|
||||||
hc:IconElement.Geometry="{StaticResource Gitee}"
|
hc:IconElement.Geometry="{StaticResource Gitee}"
|
||||||
Foreground="#B32225"
|
Foreground="#B32225"
|
||||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=1}"/>
|
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" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
hc:IconElement.Geometry="{StaticResource GitHub}"
|
hc:IconElement.Geometry="{StaticResource GitHub}"
|
||||||
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
|
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
|
||||||
Foreground="Black"
|
Foreground="Black"
|
||||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -33,5 +33,18 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
AppConfig appConfig = MainWindow.appData.AppConfig;
|
AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
RegisterUtil.SetSelfStarting(appConfig.SelfStartUp, Constants.MY_NAME);
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,97 +6,147 @@
|
|||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.Config"
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.Config"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="AliceBlue"
|
Background="Transparent"
|
||||||
d:DesignHeight="380" d:DesignWidth="450">
|
d:DesignHeight="500" 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>
|
|
||||||
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,135,-40,-161.626" Grid.ColumnSpan="4">
|
<Grid>
|
||||||
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
<Grid MouseDown="DragMove" Background="Transparent">
|
||||||
</hc:UniformSpacingPanel>
|
<StackPanel Margin="20" >
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,155,-40,-183" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
|
||||||
Maximum="100"
|
</hc:UniformSpacingPanel>
|
||||||
Margin="0,0,-313.5,7.5"
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
||||||
>
|
<TextBlock Text="图片路径:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||||
<hc:PreviewSlider.PreviewContent>
|
<TextBlock Text="{Binding BacImgName}" Width="200"
|
||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
Margin="0,5,0,0"
|
||||||
</hc:PreviewSlider.PreviewContent>
|
VerticalAlignment="Center"
|
||||||
</hc:PreviewSlider>
|
hc:Poptip.HitMode="None"
|
||||||
</hc:UniformSpacingPanel>
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
|
hc:Poptip.Content="{Binding BacImgName}"
|
||||||
|
hc:Poptip.Placement="TopLeft"
|
||||||
|
/>
|
||||||
|
<Button Content="修改" Click="BGButton_Click"/>
|
||||||
|
<Button Content="默认" Click="DefaultButton_Click"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" 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:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
|
||||||
|
<CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
|
||||||
|
<CheckBox.Background>
|
||||||
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</CheckBox.Background>
|
||||||
|
</CheckBox>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
|
|
||||||
|
<StackPanel>
|
||||||
|
<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,195,-40,-208.813" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,215,-40,-241" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<hc:PreviewSlider Value="{Binding PannelOpacity}"
|
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
||||||
Minimum="50"
|
Maximum="100"
|
||||||
Maximum="100"
|
Width="350"
|
||||||
Margin="0,0,-313.5,7.5"
|
>
|
||||||
>
|
<hc:PreviewSlider.PreviewContent>
|
||||||
<hc:PreviewSlider.PreviewContent>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
</hc:PreviewSlider.PreviewContent>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
</hc:PreviewSlider>
|
||||||
</hc:PreviewSlider>
|
</hc:UniformSpacingPanel>
|
||||||
</hc:UniformSpacingPanel>
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,245,-40,-279.313" Grid.ColumnSpan="4">
|
|
||||||
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
</hc:UniformSpacingPanel>
|
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,265,-40,-321" Grid.ColumnSpan="4">
|
</hc:UniformSpacingPanel>
|
||||||
<hc:PreviewSlider Value="{Binding PannelCornerRadius}"
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
Maximum="25"
|
<hc:PreviewSlider Value="{Binding PannelOpacity}"
|
||||||
Margin="0,0,-313.5,7.5"
|
Minimum="50"
|
||||||
>
|
Maximum="100"
|
||||||
<hc:PreviewSlider.PreviewContent>
|
Width="350"
|
||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
<hc:PreviewSlider.PreviewContent>
|
||||||
</hc:PreviewSlider>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
</hc:UniformSpacingPanel>
|
</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="图标字体颜色:" />
|
||||||
|
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Width="100"/>
|
||||||
|
<Button Content="选择" Click="ColorButton_Click"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<StackPanel x:Name="ColorPanel" Visibility="Collapsed" VerticalAlignment="Center">
|
||||||
|
<StackPanel.Background>
|
||||||
|
<SolidColorBrush Color="AliceBlue" Opacity="0"/>
|
||||||
|
</StackPanel.Background>
|
||||||
|
<hc:ColorPicker
|
||||||
|
Name="ColorPicker"
|
||||||
|
Canceled="ColorPicker_Canceled"
|
||||||
|
SelectedColorChanged="ColorPicker_SelectedColorChanged"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
</hc:SimplePanel>
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using GeekDesk.Util;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -23,6 +25,8 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ThemeControl : System.Windows.Controls.UserControl
|
public partial class ThemeControl : System.Windows.Controls.UserControl
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
public ThemeControl()
|
public ThemeControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -35,8 +39,7 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void BGButton_Click(object sender, RoutedEventArgs e)
|
private void BGButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig appConfig = MainWindow.appData.AppConfig;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OpenFileDialog ofd = new OpenFileDialog
|
OpenFileDialog ofd = new OpenFileDialog
|
||||||
@@ -56,5 +59,87 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void DefaultButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
appConfig.BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
|
||||||
|
appConfig.BacImgName = "系统默认";
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void ColorButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ColorPanel.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ColorPicker_Canceled(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ColorPanel.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||||
|
{
|
||||||
|
SolidColorBrush scb = ColorPicker.SelectedBrush;
|
||||||
|
appConfig.TextColor = scb.ToString();
|
||||||
|
ColorPanel.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移动窗口
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
|
{
|
||||||
|
Window.GetWindow(this).DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreviewSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
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.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,11 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.IconFont"
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.IconFont"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
Background="#00FFFFFF"
|
||||||
>
|
>
|
||||||
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Top">
|
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Top" Background="Transparent">
|
||||||
<ListBox x:Name="IconListBox" ItemsSource="{Binding Iconfonts}" BorderThickness="0" Background="AliceBlue">
|
<ListBox x:Name="IconListBox" ItemsSource="{Binding Iconfonts}" BorderThickness="0" Background="Transparent">
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<WrapPanel Orientation="Horizontal" Background="Transparent"/>
|
<WrapPanel Orientation="Horizontal" Background="Transparent"/>
|
||||||
|
|||||||
@@ -13,13 +13,14 @@
|
|||||||
|
|
||||||
<!--左侧栏样式动画-->
|
<!--左侧栏样式动画-->
|
||||||
<Style x:Key="MenuStyle" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItemBaseStyle}">
|
<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="Margin" Value="0,0,0,1"/>
|
||||||
<Setter Property="Background">
|
<Setter Property="Background">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<SolidColorBrush Opacity="0"/>
|
<SolidColorBrush Opacity="0"/>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
<EventSetter Event="MouseLeftButtonDown" Handler="MenuClick"/>
|
<EventSetter Event="MouseLeftButtonDown" Handler="MenuClick"/>
|
||||||
<EventSetter Event="MouseRightButtonDown" Handler="MenuClick"/>
|
<EventSetter Event="MouseRightButtonDown" Handler="MenuClick"/>
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
@@ -30,8 +31,8 @@
|
|||||||
</MultiTrigger.Conditions>
|
</MultiTrigger.Conditions>
|
||||||
<MultiTrigger.EnterActions>
|
<MultiTrigger.EnterActions>
|
||||||
<BeginStoryboard>
|
<BeginStoryboard>
|
||||||
<Storyboard>
|
<Storyboard Timeline.DesiredFrameRate="60">
|
||||||
<DoubleAnimation To="15" Duration="0:0:0.5" Storyboard.TargetProperty="FontSize"/>
|
<DoubleAnimation To="16" Duration="0:0:0.2" Storyboard.TargetProperty="FontSize"/>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</MultiTrigger.EnterActions>
|
</MultiTrigger.EnterActions>
|
||||||
@@ -103,24 +104,27 @@
|
|||||||
|
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<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>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
|
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
|
||||||
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
||||||
FontSize="15"
|
FontSize="16"
|
||||||
TextAlignment="Left"
|
Height="25"
|
||||||
LostFocus="LostFocusOrEnterDown"
|
VerticalAlignment="Center"
|
||||||
KeyDown="LostFocusOrEnterDown"
|
TextAlignment="Left"
|
||||||
Tag="{Binding}"
|
LostFocus="LostFocusOrEnterDown"
|
||||||
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
KeyDown="LostFocusOrEnterDown"
|
||||||
Visibility="{Binding MenuEdit}"/>
|
Tag="{Binding}"
|
||||||
<StackPanel Orientation="Horizontal">
|
Margin="2"
|
||||||
|
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
||||||
|
Visibility="{Binding MenuEdit}"/>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
hc:IconElement.Geometry="{Binding MenuGeometry}"
|
hc:IconElement.Geometry="{Binding MenuGeometry}"
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
if (appData.AppConfig.SelectedMenuIndex >= appData.MenuList.Count || appData.AppConfig.SelectedMenuIndex == -1)
|
if (appData.AppConfig.SelectedMenuIndex >= appData.MenuList.Count || appData.AppConfig.SelectedMenuIndex == -1)
|
||||||
{
|
{
|
||||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[0].IconList;
|
appData.AppConfig.SelectedMenuIcons = appData.MenuList[0].IconList;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateCommand<int[]> _swap;
|
DelegateCommand<int[]> _swap;
|
||||||
@@ -207,8 +207,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
//设置对应菜单的图标列表
|
//设置对应菜单的图标列表
|
||||||
if (MenuListBox.SelectedIndex == -1)
|
if (MenuListBox.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count-1].IconList;
|
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count - 1].IconList;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
|
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,18 @@
|
|||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
|
||||||
|
>
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<!--右侧栏样式动画-->
|
<!--右侧栏样式动画-->
|
||||||
<Style x:Key="ImageStyle" TargetType="Image">
|
<Style x:Key="ImageStyle" TargetType="Image">
|
||||||
<Setter Property="Width" Value="{Binding ImageWidth}"/>
|
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
||||||
<Setter Property="Height" Value="{Binding ImageHeight}"/>
|
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||||
<Setter Property="Source" Value="{Binding BitmapImage}"/>
|
<Setter Property="Source" Value="{Binding BitmapImage}"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
|
<Style x:Key="MyListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||||
@@ -28,10 +31,8 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
|
||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<!--右侧栏-->
|
<!--右侧栏-->
|
||||||
<hc:Card AllowDrop="True"
|
<hc:Card AllowDrop="True"
|
||||||
Drop="Wrap_Drop"
|
Drop="Wrap_Drop"
|
||||||
@@ -44,7 +45,12 @@
|
|||||||
<hc:Card.BorderBrush>
|
<hc:Card.BorderBrush>
|
||||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||||
</hc:Card.BorderBrush>
|
</hc:Card.BorderBrush>
|
||||||
<WrapPanel Orientation="Horizontal">
|
<hc:Card.ContextMenu>
|
||||||
|
<ContextMenu Width="200">
|
||||||
|
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</hc:Card.ContextMenu>
|
||||||
|
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True">
|
||||||
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
|
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
>
|
>
|
||||||
@@ -53,9 +59,9 @@
|
|||||||
</ListBox.Background>
|
</ListBox.Background>
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="110"
|
<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
|
||||||
ItemsWidth="110"
|
ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||||
Background="#00FFFFFF"
|
ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
@@ -65,6 +71,7 @@
|
|||||||
<ContextMenu x:Key="IconDialog" Width="200">
|
<ContextMenu x:Key="IconDialog" Width="200">
|
||||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||||
|
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||||
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
|
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
|
||||||
@@ -74,25 +81,29 @@
|
|||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||||
|
<!--<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"/>
|
||||||
|
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"/>-->
|
||||||
</Style>
|
</Style>
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
|
<!--Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||||
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"-->
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Tag="{Binding}"
|
<hc:SimpleStackPanel Tag="{Binding}"
|
||||||
Height="110"
|
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||||
Width="110"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
hc:Poptip.HitMode="None"
|
hc:Poptip.HitMode="None"
|
||||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
hc:Poptip.Content="{Binding Content}"
|
hc:Poptip.Content="{Binding Content}"
|
||||||
hc:Poptip.Placement="BottomLeft"
|
hc:Poptip.Placement="BottomLeft"
|
||||||
Background="#00FFFFFF"
|
Background="#00FFFFFF"
|
||||||
MouseLeftButtonUp="IconClick"
|
MouseLeftButtonUp="IconClick"
|
||||||
MouseEnter="StackPanel_MouseEnter"
|
MouseEnter="StackPanel_MouseEnter"
|
||||||
MouseLeave="StackPanel_MouseLeave"
|
MouseLeave="StackPanel_MouseLeave"
|
||||||
>
|
>
|
||||||
<Image Style="{StaticResource ImageStyle}"/>
|
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
<TextBlock MaxWidth="80"
|
<TextBlock MaxWidth="80"
|
||||||
Margin="0,5,0,0"
|
Margin="0,5,0,0"
|
||||||
MaxHeight="40"
|
MaxHeight="40"
|
||||||
@@ -101,11 +112,13 @@
|
|||||||
TextTrimming="WordEllipsis"
|
TextTrimming="WordEllipsis"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||||
Text="{Binding Name}"/>
|
Text="{Binding Name}"/>
|
||||||
</StackPanel>
|
</hc:SimpleStackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -3,25 +3,18 @@ using GeekDesk.Constant;
|
|||||||
using GeekDesk.Control.Other;
|
using GeekDesk.Control.Other;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
using HandyControl.Controls;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Text.RegularExpressions;
|
||||||
using System.Text;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.PannelCard
|
namespace GeekDesk.Control.UserControls.PannelCard
|
||||||
{
|
{
|
||||||
@@ -31,6 +24,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
public partial class RightCardControl : UserControl
|
public partial class RightCardControl : UserControl
|
||||||
{
|
{
|
||||||
private AppData appData = MainWindow.appData;
|
private AppData appData = MainWindow.appData;
|
||||||
|
|
||||||
public RightCardControl()
|
public RightCardControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -72,7 +66,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void IconClick(object sender, MouseButtonEventArgs e)
|
private void IconClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
IconInfo icon = (IconInfo)((StackPanel)sender).Tag;
|
IconInfo icon = (IconInfo)((SimpleStackPanel)sender).Tag;
|
||||||
if (icon.AdminStartUp)
|
if (icon.AdminStartUp)
|
||||||
{
|
{
|
||||||
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||||
@@ -109,41 +103,62 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
|
|
||||||
{
|
|
||||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Process p = new Process();
|
Process p = new Process();
|
||||||
p.StartInfo.FileName = icon.Path;
|
p.StartInfo.FileName = icon.Path;
|
||||||
|
if (icon.IconType == IconType.OTHER)
|
||||||
switch (type)
|
|
||||||
{
|
{
|
||||||
case IconStartType.ADMIN_STARTUP:
|
if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
|
||||||
p.StartInfo.Arguments = "1";//启动参数
|
{
|
||||||
p.StartInfo.Verb = "runas";
|
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
||||||
p.StartInfo.CreateNoWindow = false; //设置显示窗口
|
return;
|
||||||
p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程
|
}
|
||||||
p.StartInfo.ErrorDialog = false;
|
p.StartInfo.WorkingDirectory = icon.Path.Substring(0, icon.Path.LastIndexOf("\\"));
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
switch (type)
|
||||||
{
|
{
|
||||||
Window parentWin = Window.GetWindow(this);
|
case IconStartType.ADMIN_STARTUP:
|
||||||
parentWin.Visibility = Visibility.Collapsed;
|
p.StartInfo.Arguments = "1";//启动参数
|
||||||
}
|
p.StartInfo.Verb = "runas";
|
||||||
break;// c#好像不能case穿透
|
p.StartInfo.CreateNoWindow = false; //设置显示窗口
|
||||||
case IconStartType.DEFAULT_STARTUP:
|
p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
p.StartInfo.ErrorDialog = false;
|
||||||
{
|
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||||
Window parentWin = Window.GetWindow(this);
|
{
|
||||||
parentWin.Visibility = Visibility.Collapsed;
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
}
|
if (appData.AppConfig.MarginHide)
|
||||||
break;
|
{
|
||||||
case IconStartType.SHOW_IN_EXPLORE:
|
if (!MainWindow.hide.IsMargin())
|
||||||
p.StartInfo.FileName = "Explorer.exe";
|
{
|
||||||
p.StartInfo.Arguments = "/e,/select," + icon.Path;
|
MainWindow.HideApp();
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindow.HideApp();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;// c#好像不能case穿透
|
||||||
|
case IconStartType.DEFAULT_STARTUP:
|
||||||
|
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||||
|
{
|
||||||
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
|
if (appData.AppConfig.MarginHide)
|
||||||
|
{
|
||||||
|
if (!MainWindow.hide.IsMargin())
|
||||||
|
{
|
||||||
|
MainWindow.HideApp();
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MainWindow.HideApp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IconStartType.SHOW_IN_EXPLORE:
|
||||||
|
p.StartInfo.FileName = "Explorer.exe";
|
||||||
|
p.StartInfo.Arguments = "/e,/select," + icon.Path;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p.Start();
|
p.Start();
|
||||||
icon.Count++;
|
icon.Count++;
|
||||||
@@ -165,9 +180,12 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
string path = (string)obj;
|
string path = (string)obj;
|
||||||
|
|
||||||
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Jpeg);
|
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Png);
|
||||||
|
string ext = "";
|
||||||
string ext = System.IO.Path.GetExtension(path).ToLower();
|
if (!ImageUtil.IsSystemItem(path))
|
||||||
|
{
|
||||||
|
ext = System.IO.Path.GetExtension(path).ToLower();
|
||||||
|
}
|
||||||
|
|
||||||
if (".lnk".Equals(ext))
|
if (".lnk".Equals(ext))
|
||||||
{
|
{
|
||||||
@@ -178,10 +196,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BitmapImage bi = ImageUtil.GetBitmapIconByPath(path);
|
||||||
IconInfo iconInfo = new IconInfo
|
IconInfo iconInfo = new IconInfo
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
BitmapImage = ImageUtil.GetBitmapIconByPath(path)
|
BitmapImage = bi
|
||||||
};
|
};
|
||||||
iconInfo.DefaultImage = iconInfo.ImageByteArr;
|
iconInfo.DefaultImage = iconInfo.ImageByteArr;
|
||||||
iconInfo.Name = System.IO.Path.GetFileNameWithoutExtension(path);
|
iconInfo.Name = System.IO.Path.GetFileNameWithoutExtension(path);
|
||||||
@@ -223,48 +242,164 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void PropertyConfig(object sender, RoutedEventArgs e)
|
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, "IconInfoDialog");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
IconInfoDialog dialog = new IconInfoDialog(info);
|
||||||
|
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "IconInfoDialog");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
|
private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
ImgStroyBoard(sender, (int)MainWindowEnum.IMAGE_HEIGHT_AM, (int)MainWindowEnum.IMAGE_WIDTH_AM, 1);
|
|
||||||
|
double width = appData.AppConfig.ImageWidth;
|
||||||
|
double height = appData.AppConfig.ImageHeight;
|
||||||
|
width += width * 0.15;
|
||||||
|
height += height * 0.15;
|
||||||
|
ImgStoryBoard(sender, (int)width, (int)height, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
|
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
ImgStroyBoard(sender, (int)MainWindowEnum.IMAGE_HEIGHT, (int)MainWindowEnum.IMAGE_WIDTH, 250);
|
ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 220);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ImgStroyBoard(object sender, int height, int width, int milliseconds)
|
private void ImgStoryBoard(object sender, int height, int width, int milliseconds, bool checkRmStoryboard = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (appData.AppConfig.PMModel) return;
|
if (appData.AppConfig.PMModel) return;
|
||||||
|
|
||||||
StackPanel sp = sender as StackPanel;
|
Panel sp = sender as Panel;
|
||||||
|
|
||||||
|
DependencyObject dos = sp.Parent;
|
||||||
|
|
||||||
Image img = sp.Children[0] as Image;
|
Image img = sp.Children[0] as Image;
|
||||||
|
|
||||||
|
double afterHeight = img.Height;
|
||||||
|
double afterWidth = img.Width;
|
||||||
|
|
||||||
DoubleAnimation heightAnimation = new DoubleAnimation();
|
//动画定义
|
||||||
DoubleAnimation widthAnimation = new DoubleAnimation();
|
Storyboard myStoryboard = new Storyboard();
|
||||||
|
|
||||||
|
|
||||||
heightAnimation.From = img.Height;
|
|
||||||
widthAnimation.From = img.Width;
|
|
||||||
|
|
||||||
heightAnimation.To = height;
|
DoubleAnimation heightAnimation = new DoubleAnimation
|
||||||
widthAnimation.To = width;
|
{
|
||||||
|
From = afterHeight,
|
||||||
heightAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds));
|
To = height,
|
||||||
widthAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds));
|
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(heightAnimation, 60);
|
||||||
Timeline.SetDesiredFrameRate(widthAnimation, 60);
|
Timeline.SetDesiredFrameRate(widthAnimation, 60);
|
||||||
|
|
||||||
img.BeginAnimation(HeightProperty, heightAnimation);
|
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.Start();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
img.BeginAnimation(WidthProperty, null);
|
||||||
|
img.BeginAnimation(HeightProperty, null);
|
||||||
|
}
|
||||||
|
};
|
||||||
img.BeginAnimation(WidthProperty, widthAnimation);
|
img.BeginAnimation(WidthProperty, widthAnimation);
|
||||||
|
img.BeginAnimation(HeightProperty, heightAnimation);
|
||||||
|
|
||||||
|
//myStoryboard.Completed += (s, e) =>
|
||||||
|
//{
|
||||||
|
// if (checkRmStoryboard || true)
|
||||||
|
// {
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddUrlIcon(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog();
|
||||||
|
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "IconInfoDialog");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns: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"
|
mc:Ignorable="d"
|
||||||
Background="AliceBlue"
|
Background="Transparent"
|
||||||
>
|
>
|
||||||
|
|
||||||
<hc:SimplePanel Margin="20">
|
<hc:SimplePanel Margin="20" Background="Transparent">
|
||||||
<Grid>
|
<Grid Background="Transparent">
|
||||||
<DataGrid x:Name="BacklogList"
|
<DataGrid x:Name="BacklogList"
|
||||||
HeadersVisibility="All"
|
HeadersVisibility="All"
|
||||||
AutoGenerateColumns="False"
|
AutoGenerateColumns="False"
|
||||||
@@ -26,13 +26,30 @@
|
|||||||
</DataGrid.ContextMenu>
|
</DataGrid.ContextMenu>
|
||||||
<DataGrid.RowStyle>
|
<DataGrid.RowStyle>
|
||||||
<Style TargetType="DataGridRow" BasedOn="{StaticResource DataGridRowStyle}">
|
<Style TargetType="DataGridRow" BasedOn="{StaticResource DataGridRowStyle}">
|
||||||
<EventSetter Event="MouseRightButtonUp" Handler="DataGridRow_MouseRightButtonUp" />
|
<EventSetter Event="MouseRightButtonDown" Handler="DataGridRow_MouseRightButtonDown" />
|
||||||
|
<EventSetter Event="Selected" Handler="DataGridRow_Selected"/>
|
||||||
|
<Setter Property="Background" Value="White"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="#5BC0DE"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsSelected" Value="False">
|
||||||
|
<Setter Property="Background" Value="White"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</DataGrid.RowStyle>
|
</DataGrid.RowStyle>
|
||||||
|
|
||||||
<DataGrid.CellStyle>
|
<DataGrid.CellStyle>
|
||||||
<Style TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle}">
|
<Style TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle}">
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||||
|
<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>
|
</Style>
|
||||||
</DataGrid.CellStyle>
|
</DataGrid.CellStyle>
|
||||||
<DataGrid.ColumnHeaderStyle>
|
<DataGrid.ColumnHeaderStyle>
|
||||||
@@ -42,7 +59,7 @@
|
|||||||
</DataGrid.ColumnHeaderStyle>
|
</DataGrid.ColumnHeaderStyle>
|
||||||
|
|
||||||
<DataGrid.Background>
|
<DataGrid.Background>
|
||||||
<SolidColorBrush Color="AliceBlue"/>
|
<SolidColorBrush Color="Transparent"/>
|
||||||
</DataGrid.Background>
|
</DataGrid.Background>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Width="120" Binding="{Binding Title}" Header="待办任务"/>
|
<DataGridTextColumn Width="120" Binding="{Binding Title}" Header="待办任务"/>
|
||||||
|
|||||||
@@ -19,12 +19,18 @@ using System.Windows.Shapes;
|
|||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.Backlog
|
namespace GeekDesk.Control.UserControls.Backlog
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public enum ToDoType
|
||||||
|
{
|
||||||
|
HISTORY = 1,
|
||||||
|
NEW = 2
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// BacklogControl.xaml 的交互逻辑
|
/// BacklogControl.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class TodoControl : UserControl
|
public partial class TodoControl : UserControl
|
||||||
{
|
{
|
||||||
private AppData appData = MainWindow.appData;
|
public ToDoType type;
|
||||||
public TodoControl()
|
public TodoControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -37,7 +43,14 @@ namespace GeekDesk.Control.UserControls.Backlog
|
|||||||
{
|
{
|
||||||
if (isConfirmed)
|
if (isConfirmed)
|
||||||
{
|
{
|
||||||
appData.ToDoList.Remove(info);
|
if (type == ToDoType.NEW)
|
||||||
|
{
|
||||||
|
MainWindow.appData.ToDoList.Remove(info);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindow.appData.HiToDoList.Remove(info);
|
||||||
|
}
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -60,13 +73,31 @@ namespace GeekDesk.Control.UserControls.Backlog
|
|||||||
BacklogList.ContextMenu = null;
|
BacklogList.ContextMenu = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
private void DataGridRow_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
|
/// 打开右键菜单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void DataGridRow_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
BacklogList.SelectedIndex = ((DataGridRow)sender).GetIndex();
|
BacklogList.SelectedIndex = ((DataGridRow)sender).GetIndex();
|
||||||
Menu.IsOpen = true;
|
Menu.IsOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 选中时颜色变化
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void DataGridRow_Selected(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Color c = Color.FromRgb(91, 192, 222);
|
||||||
|
SolidColorBrush b = new SolidColorBrush
|
||||||
|
{
|
||||||
|
Color = c,
|
||||||
|
Opacity = 0.9
|
||||||
|
};
|
||||||
|
((DataGridRow)sender).Background = b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,75 +8,61 @@
|
|||||||
Title="Setting"
|
Title="Setting"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Height="450"
|
Height="550"
|
||||||
Width="600"
|
Width="750"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
|
ResizeMode="NoResize"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent" ShowInTaskbar="False"
|
Background="#00FFFFFF" ShowInTaskbar="False"
|
||||||
|
BorderThickness="0"
|
||||||
|
Focusable="True"
|
||||||
|
KeyDown="OnKeyDown"
|
||||||
>
|
>
|
||||||
|
|
||||||
<Window.Resources>
|
<Grid Margin="30">
|
||||||
<Style x:Key="MenuStyle" TargetType="hc:SideMenuItem" BasedOn="{StaticResource SideMenuItemBaseStyle}">
|
<Grid.Effect>
|
||||||
<Style.Setters>
|
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
|
||||||
<Setter Property="Background" Value="AliceBlue"/>
|
RenderingBias="Quality" ShadowDepth="2"/>
|
||||||
</Style.Setters>
|
</Grid.Effect>
|
||||||
<Style.Triggers>
|
<Border Style="{StaticResource BorderBG}">
|
||||||
<Trigger Property="IsMouseOver" Value="True">
|
<Grid Background="Transparent">
|
||||||
<Setter Property="Background" Value="#FFE2E2E2"/>
|
<Grid.RowDefinitions>
|
||||||
</Trigger>
|
<RowDefinition Height="*"/>
|
||||||
<Trigger Property="IsSelected" Value="True">
|
</Grid.RowDefinitions>
|
||||||
<Setter Property="Background" Value="#FFDAD7D7"/>
|
<Grid.ColumnDefinitions>
|
||||||
</Trigger>
|
<ColumnDefinition Width="140"/>
|
||||||
</Style.Triggers>
|
<ColumnDefinition Width="*"/>
|
||||||
</Style>
|
</Grid.ColumnDefinitions>
|
||||||
</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>
|
|
||||||
|
|
||||||
<hc:Card Grid.Row="0" Grid.Column="0">
|
<hc:Card Grid.Row="0" Grid.Column="0" Background="Transparent" BorderThickness="0">
|
||||||
<hc:SideMenu BorderThickness="1"
|
|
||||||
AutoSelect="True"
|
|
||||||
>
|
|
||||||
<hc:SideMenu.Background>
|
|
||||||
<SolidColorBrush Color="AliceBlue"/>
|
|
||||||
</hc:SideMenu.Background>
|
|
||||||
|
|
||||||
<hc:SideMenu.ItemContainerStyle>
|
<hc:SideMenu AutoSelect="True" Background="Transparent" Margin="1,7,0,3">
|
||||||
<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"
|
IsSelected="True"
|
||||||
Selected="MemuClick"
|
Selected="MemuClick"
|
||||||
Tag="About"
|
Tag="About"
|
||||||
>
|
>
|
||||||
<hc:SideMenuItem.Icon>
|
<hc:SideMenuItem.Icon>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Opacity="1"
|
Opacity="0.9"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
hc:IconElement.Geometry="{StaticResource About}"
|
hc:IconElement.Geometry="{StaticResource About}"
|
||||||
hc:IconElement.Height="18"
|
hc:IconElement.Height="18"
|
||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
/>
|
/>
|
||||||
</hc:SideMenuItem.Icon>
|
</hc:SideMenuItem.Icon>
|
||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
<hc:SideMenuItem Header="显示设置"
|
<hc:SideMenuItem Header="显示设置"
|
||||||
Tag="Theme"
|
Tag="Theme"
|
||||||
Selected="MemuClick">
|
Selected="MemuClick">
|
||||||
<hc:SideMenuItem.Icon>
|
<hc:SideMenuItem.Icon>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Opacity="1"
|
Opacity="1"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
@@ -85,14 +71,14 @@
|
|||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
/>
|
/>
|
||||||
</hc:SideMenuItem.Icon>
|
</hc:SideMenuItem.Icon>
|
||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
|
|
||||||
<hc:SideMenuItem Header="动作"
|
<hc:SideMenuItem Header="动作"
|
||||||
Tag="Motion"
|
Tag="Motion"
|
||||||
Selected="MemuClick">
|
Selected="MemuClick">
|
||||||
<hc:SideMenuItem.Icon>
|
<hc:SideMenuItem.Icon>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Opacity="1"
|
Opacity="1"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
@@ -101,13 +87,13 @@
|
|||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
/>
|
/>
|
||||||
</hc:SideMenuItem.Icon>
|
</hc:SideMenuItem.Icon>
|
||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
<hc:SideMenuItem Header="其它"
|
<hc:SideMenuItem Header="其它"
|
||||||
Tag="Other"
|
Tag="Other"
|
||||||
Selected="MemuClick">
|
Selected="MemuClick">
|
||||||
<hc:SideMenuItem.Icon>
|
<hc:SideMenuItem.Icon>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Opacity="1"
|
Opacity="1"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
@@ -116,17 +102,21 @@
|
|||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
/>
|
/>
|
||||||
</hc:SideMenuItem.Icon>
|
</hc:SideMenuItem.Icon>
|
||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
</hc:SideMenu>
|
</hc:SideMenu>
|
||||||
</hc:Card>
|
|
||||||
<hc:ScrollViewer Grid.Row="0" Grid.Column="1">
|
|
||||||
<hc:Card x:Name="RightCard" Height="448" MouseDown="DragMove">
|
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
</hc:ScrollViewer>
|
<hc:ScrollViewer Grid.Row="0" Grid.Column="1" BorderThickness="0" Margin="0,5,1,5">
|
||||||
|
<hc:Card x:Name="RightCard" Height="480" BorderThickness="0" MouseDown="DragMove">
|
||||||
|
<hc:Card.Background>
|
||||||
|
<SolidColorBrush Opacity="0"/>
|
||||||
|
</hc:Card.Background>
|
||||||
|
</hc:Card>
|
||||||
|
</hc:ScrollViewer>
|
||||||
|
|
||||||
<Button Width="22" Height="22" Click="Close_Button_Click" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" Grid.Column="1"/>
|
<Button Width="22" Height="22" Click="Close_Button_Click" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" Grid.Column="1"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
</hc:Window>
|
</hc:Window>
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
|
|
||||||
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.Control.UserControls;
|
using GeekDesk.Control.UserControls;
|
||||||
using GeekDesk.Control.UserControls.Config;
|
using GeekDesk.Control.UserControls.Config;
|
||||||
|
using GeekDesk.Interface;
|
||||||
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using HandyControl.Data;
|
using HandyControl.Data;
|
||||||
@@ -13,17 +16,18 @@ namespace GeekDesk.Control.Windows
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// ConfigDialog.xaml 的交互逻辑
|
/// ConfigDialog.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ConfigWindow
|
public partial class ConfigWindow : IWindowCommon
|
||||||
{
|
{
|
||||||
private static AboutControl about = new AboutControl();
|
private static readonly AboutControl about = new AboutControl();
|
||||||
private static ThemeControl theme = new ThemeControl();
|
private static readonly ThemeControl theme = new ThemeControl();
|
||||||
private static MotionControl motion = new MotionControl();
|
private static readonly MotionControl motion = new MotionControl();
|
||||||
private static OtherControl other = new OtherControl();
|
private static readonly OtherControl other = new OtherControl();
|
||||||
public MainWindow mainWindow;
|
public MainWindow mainWindow;
|
||||||
|
|
||||||
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
|
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
//BG.Source = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
|
||||||
this.DataContext = appConfig;
|
this.DataContext = appConfig;
|
||||||
RightCard.Content = about;
|
RightCard.Content = about;
|
||||||
this.Topmost = true;
|
this.Topmost = true;
|
||||||
@@ -31,18 +35,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <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>
|
/// <summary>
|
||||||
/// 点击关闭按钮
|
/// 点击关闭按钮
|
||||||
@@ -74,6 +67,19 @@ namespace GeekDesk.Control.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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;
|
private static System.Windows.Window window = null;
|
||||||
public static void Show(AppConfig appConfig, MainWindow mainWindow)
|
public static void Show(AppConfig appConfig, MainWindow mainWindow)
|
||||||
{
|
{
|
||||||
@@ -82,6 +88,15 @@ namespace GeekDesk.Control.Windows
|
|||||||
window = new ConfigWindow(appConfig, mainWindow);
|
window = new ConfigWindow(appConfig, mainWindow);
|
||||||
}
|
}
|
||||||
window.Show();
|
window.Show();
|
||||||
|
Keyboard.Focus(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,46 +8,80 @@
|
|||||||
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.IconFont"
|
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.IconFont"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Svg"
|
Title="Svg"
|
||||||
Height="450" Width="600"
|
Height="520" Width="700"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
|
ResizeMode="NoResize"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="AliceBlue"
|
Background="Transparent" ShowInTaskbar="False"
|
||||||
MouseDown="DragMove"
|
BorderThickness="0"
|
||||||
|
Focusable="True"
|
||||||
|
KeyDown="OnKeyDown"
|
||||||
>
|
>
|
||||||
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
<Style x:Key="HcTabControl" TargetType="hc:TabControl" BasedOn="{StaticResource TabControlInLine}">
|
||||||
<Setter Property="Width" Value="80"/>
|
<Style.Setters>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
</Style.Setters>
|
||||||
<Setter Property="FontSize" Value="11"/>
|
</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>
|
</Style>
|
||||||
</Window.Resources>
|
</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" 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 Content="取消" Click="Close_Click" Margin="391,397.5,163,22.5"/>
|
||||||
|
<Button Content="自定义设置" Click="CustomButton_Click" IsEnabled="False" Name="CustomButton" Style="{StaticResource Btn1}" Margin="447,397.5,71,22.5"/>
|
||||||
|
<Button Content="确定" Click="Confirm_Click" Style="{StaticResource Btn1}" Margin="534,397.5,20,22.5" />
|
||||||
|
</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>
|
</Window>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GeekDesk.Control.Other;
|
using GeekDesk.Control.Other;
|
||||||
|
using GeekDesk.Interface;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
|
||||||
@@ -10,14 +11,14 @@ using System.Windows;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||||
|
|
||||||
namespace GeekDesk.Control.Windows
|
namespace GeekDesk.Control.Windows
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IconfontWindow.xaml 的交互逻辑
|
/// IconfontWindow.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class IconfontWindow : Window
|
public partial class IconfontWindow : Window, IWindowCommon
|
||||||
{
|
{
|
||||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
private static MenuInfo menuInfo;
|
private static MenuInfo menuInfo;
|
||||||
@@ -71,7 +72,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
{
|
{
|
||||||
LoadingEle.Visibility = Visibility.Visible;
|
LoadingEle.Visibility = Visibility.Visible;
|
||||||
CustomIcon.Visibility = Visibility.Collapsed;
|
CustomIcon.Visibility = Visibility.Collapsed;
|
||||||
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig));
|
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig), "IconUrlDialog");
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (customIcons == null)
|
if (customIcons == null)
|
||||||
@@ -132,6 +133,8 @@ namespace GeekDesk.Control.Windows
|
|||||||
window = new IconfontWindow(listInfo, menuInfo);
|
window = new IconfontWindow(listInfo, menuInfo);
|
||||||
}
|
}
|
||||||
window.Show();
|
window.Show();
|
||||||
|
Keyboard.Focus(window);
|
||||||
|
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CustomButton_Click(object sender, RoutedEventArgs e)
|
private void CustomButton_Click(object sender, RoutedEventArgs e)
|
||||||
@@ -171,6 +174,13 @@ namespace GeekDesk.Control.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class IconfontViewModel : INotifyPropertyChanged
|
public class IconfontViewModel : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,70 +4,100 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
xmlns:local="clr-namespace:GeekDesk"
|
xmlns:local="clr-namespace:GeekDesk"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Height="670"
|
Height="450"
|
||||||
Width="450"
|
Width="510"
|
||||||
Title="TaskInfo"
|
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
|
Title=""
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent" ShowInTaskbar="False"
|
Background="Transparent" ShowInTaskbar="False"
|
||||||
>
|
Focusable="True"
|
||||||
|
KeyDown="OnKeyDown"
|
||||||
|
>
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
|
<cvt:TodoTaskExecConvert x:Key="TodoTaskExecConvert"/>
|
||||||
</Window.Resources>
|
</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">
|
<Grid Margin="20">
|
||||||
<TextBlock Text="待办详情:" Style="{StaticResource LeftTB}"/>
|
<Grid.Effect>
|
||||||
<TextBox x:Name="Msg" TextWrapping="Wrap"
|
<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="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" 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"
|
||||||
|
Margin="5,0,0,0"
|
||||||
|
Text="{Binding Msg, Mode=OneWay}"
|
||||||
AcceptsReturn="True"
|
AcceptsReturn="True"
|
||||||
VerticalScrollBarVisibility="Visible"
|
VerticalScrollBarVisibility="Visible"
|
||||||
Height="100" MaxHeight="150" MinHeight="100" Width="290" MinWidth="290"
|
Height="100" MaxHeight="150" MinHeight="100" Width="290" MinWidth="290"
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,167.622,0,-167.622">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||||
<TextBlock Text="待办时间*:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="运行方式:" Style="{StaticResource LeftTB}"/>
|
||||||
<hc:DateTimePicker x:Name="ExeTime" ErrorStr="test" Width="200"/>
|
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Tag="1" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
</hc:UniformSpacingPanel>
|
Style="{StaticResource RadioButtonIcon}" Content="指定时间"
|
||||||
|
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=1}"/>
|
||||||
|
<RadioButton Margin="10,0,0,0" Checked="ExecType_Checked" Background="{DynamicResource SecondaryRegionBrush}" Tag="2"
|
||||||
|
Style="{StaticResource RadioButtonIcon}" Content="CRON表达式"
|
||||||
|
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=2}"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,228,0,-228">
|
<hc:UniformSpacingPanel x:Name="SetTimePanel" Visibility="Visible" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||||
<TextBlock Text="完成时间:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="指定时间:" Style="{StaticResource LeftTB}"/>
|
||||||
<TextBlock x:Name="DoneTime" Width="200"/>
|
<TextBlock Text="*" Foreground="Red" Margin="-10,0,0,0"/>
|
||||||
</hc:UniformSpacingPanel>
|
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="-5.2,0,0,0"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<hc:UniformSpacingPanel x:Name="CronPanel" 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" 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"
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||||
Foreground="White" Margin="320,6,-208,-10"
|
<TextBlock Text="完成时间:" Style="{StaticResource LeftTB}"/>
|
||||||
|
<TextBlock x:Name="DoneTime" 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 Btn1}" Margin="320,6,-208,-10"
|
||||||
Click="Save_Button_Click"/>
|
Click="Save_Button_Click"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</hc:SimplePanel>
|
</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"/>
|
<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"/>
|
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using GeekDesk.Util;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Interface;
|
||||||
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
|
using Quartz;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -20,7 +23,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// BacklogInfoWindow.xaml 的交互逻辑
|
/// BacklogInfoWindow.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ToDoInfoWindow
|
public partial class ToDoInfoWindow : IWindowCommon
|
||||||
{
|
{
|
||||||
|
|
||||||
private static int windowType = -1;
|
private static int windowType = -1;
|
||||||
@@ -29,23 +32,31 @@ namespace GeekDesk.Control.Windows
|
|||||||
|
|
||||||
private AppData appData = MainWindow.appData;
|
private AppData appData = MainWindow.appData;
|
||||||
|
|
||||||
private ToDoInfo info;
|
//private ToDoInfo info;
|
||||||
|
|
||||||
private ToDoInfoWindow()
|
private ToDoInfoWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ExeTime.SelectedDateTime = DateTime.Now.AddMinutes(10);
|
|
||||||
this.Topmost = true;
|
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)
|
private ToDoInfoWindow(ToDoInfo info)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Topmost = true;
|
this.Topmost = true;
|
||||||
Title.Text = info.Title;
|
this.DataContext = info;
|
||||||
Msg.Text = info.Msg;
|
SetTimePanel.Visibility = Visibility.Visible;
|
||||||
ExeTime.Text = info.ExeTime;
|
//Title.Text = info.Title;
|
||||||
DoneTime.Text = info.DoneTime;
|
//Msg.Text = info.Msg;
|
||||||
this.info = info;
|
//ExeTime.Text = info.ExeTime;
|
||||||
|
//DoneTime.Text = info.DoneTime;
|
||||||
|
//this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -79,41 +90,70 @@ namespace GeekDesk.Control.Windows
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void Save_Button_Click(object sender, RoutedEventArgs e)
|
private void Save_Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
DateTime dt;
|
DateTime dt;
|
||||||
if (Title.Text.Trim() == "" || ExeTime.Text.Trim() == "")
|
string execTime;
|
||||||
|
TodoTaskExecType execType;
|
||||||
|
if (Title.Text.Trim() == "")
|
||||||
{
|
{
|
||||||
Growl.Warning("任务标题 和 待办时间不能为空!");
|
Growl.Warning("任务标题不能为空!");
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
try
|
if (SetTimePanel.Visibility == Visibility.Visible)
|
||||||
{
|
{
|
||||||
dt = Convert.ToDateTime(ExeTime.Text);
|
execType = TodoTaskExecType.SET_TIME;
|
||||||
} catch (Exception)
|
if (ExeTime.Text.Trim() == "")
|
||||||
{
|
{
|
||||||
Growl.Warning("请输入正确的时间!");
|
Growl.Warning("执行时间不能为空!");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dt = Convert.ToDateTime(ExeTime.Text);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Growl.Warning("请输入正确的时间!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
execTime = ExeTime.Text;
|
||||||
|
} else {
|
||||||
|
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,
|
||||||
Title = Title.Text,
|
ExeTime = execTime,
|
||||||
Msg = Msg.Text,
|
ExecType = execType,
|
||||||
ExeTime = ExeTime.Text
|
Cron = Cron.Text
|
||||||
};
|
};
|
||||||
appData.ToDoList.Add(info);
|
if (windowType != NEW_TODO)
|
||||||
} else
|
|
||||||
{
|
{
|
||||||
appData.HiToDoList.Remove(info);
|
appData.HiToDoList.Remove(this.DataContext as ToDoInfo);
|
||||||
info.Title = Title.Text;
|
}
|
||||||
info.Msg = Msg.Text;
|
appData.ToDoList.Add(info);
|
||||||
info.ExeTime = ExeTime.Text;
|
|
||||||
info.DoneTime = null;
|
|
||||||
appData.ToDoList.Add(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
DateTime dtNow = DateTime.Now;
|
DateTime dtNow = DateTime.Now;
|
||||||
TimeSpan ts = dt.Subtract(dtNow);
|
TimeSpan ts = dt.Subtract(dtNow);
|
||||||
@@ -149,6 +189,18 @@ namespace GeekDesk.Control.Windows
|
|||||||
window.Visibility = Visibility.Visible;
|
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()
|
public static System.Windows.Window GetThis()
|
||||||
{
|
{
|
||||||
@@ -156,6 +208,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
{
|
{
|
||||||
window = new ToDoInfoWindow();
|
window = new ToDoInfoWindow();
|
||||||
window.Show();
|
window.Show();
|
||||||
|
Keyboard.Focus(window);
|
||||||
}
|
}
|
||||||
window.Visibility = Visibility.Collapsed;
|
window.Visibility = Visibility.Collapsed;
|
||||||
windowType = NEW_TODO;
|
windowType = NEW_TODO;
|
||||||
@@ -171,6 +224,31 @@ namespace GeekDesk.Control.Windows
|
|||||||
}
|
}
|
||||||
windowType = DETAIL_TODO;
|
windowType = DETAIL_TODO;
|
||||||
window2.Show();
|
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.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,60 +7,50 @@
|
|||||||
xmlns:local="clr-namespace:GeekDesk"
|
xmlns:local="clr-namespace:GeekDesk"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Height="450"
|
Height="550"
|
||||||
Width="850"
|
Width="1000"
|
||||||
Title="Task"
|
Title="Task"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent" ShowInTaskbar="False"
|
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">
|
<Grid Margin="50">
|
||||||
<hc:SideMenu BorderThickness="1"
|
<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"
|
AutoSelect="True"
|
||||||
|
Background="Transparent"
|
||||||
|
Margin="5"
|
||||||
>
|
>
|
||||||
<hc:SideMenu.Background>
|
|
||||||
<SolidColorBrush Color="AliceBlue"/>
|
|
||||||
</hc:SideMenu.Background>
|
|
||||||
|
|
||||||
<hc:SideMenu.ItemContainerStyle>
|
<hc:SideMenu.ItemContainerStyle>
|
||||||
<Style TargetType="hc:SideMenuItem" BasedOn="{StaticResource MenuStyle}"/>
|
<Style TargetType="hc:SideMenuItem" BasedOn="{StaticResource MyMenuStyle}"/>
|
||||||
</hc:SideMenu.ItemContainerStyle>
|
</hc:SideMenu.ItemContainerStyle>
|
||||||
|
|
||||||
<hc:SideMenuItem Header="待办列表"
|
<hc:SideMenuItem Header="待办列表"
|
||||||
IsSelected="True"
|
IsSelected="True"
|
||||||
Selected="MemuClick"
|
Selected="MemuClick"
|
||||||
Tag="ExeList"
|
Tag="ExeList"
|
||||||
>
|
>
|
||||||
<hc:SideMenuItem.Icon>
|
<hc:SideMenuItem.Icon>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Opacity="1"
|
Opacity="1"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
@@ -69,13 +59,13 @@
|
|||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
/>
|
/>
|
||||||
</hc:SideMenuItem.Icon>
|
</hc:SideMenuItem.Icon>
|
||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
<hc:SideMenuItem Header="历史待办"
|
<hc:SideMenuItem Header="历史待办"
|
||||||
Tag="History"
|
Tag="History"
|
||||||
Selected="MemuClick">
|
Selected="MemuClick">
|
||||||
<hc:SideMenuItem.Icon>
|
<hc:SideMenuItem.Icon>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Opacity="1"
|
Opacity="1"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
@@ -84,21 +74,22 @@
|
|||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
/>
|
/>
|
||||||
</hc:SideMenuItem.Icon>
|
</hc:SideMenuItem.Icon>
|
||||||
</hc:SideMenuItem>
|
</hc:SideMenuItem>
|
||||||
</hc:SideMenu>
|
</hc:SideMenu>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
<hc:Card Grid.Row="0" Grid.Column="1" x:Name="RightCard" Height="450" MouseDown="DragMove" />
|
<hc:Card Grid.Row="0" MouseDown="DragMove" Background="Transparent" BorderThickness="0" Grid.Column="1" x:Name="RightCard" Height="450">
|
||||||
|
</hc:Card>
|
||||||
|
|
||||||
|
|
||||||
<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"/>
|
||||||
<Button Content="新建待办"
|
<Button Content="新建待办"
|
||||||
Panel.ZIndex="1"
|
Panel.ZIndex="1"
|
||||||
Background="#5BC0DE"
|
Style="{StaticResource Btn1}"
|
||||||
Foreground="White"
|
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="590.01,29,10,384"
|
Margin="590.01,29,10,384"
|
||||||
Click="CreateBacklog_BtnClick"/>
|
Click="CreateBacklog_BtnClick"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GeekDesk.Control.UserControls.Backlog;
|
using GeekDesk.Control.UserControls.Backlog;
|
||||||
|
using GeekDesk.Interface;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using System;
|
using System;
|
||||||
@@ -21,7 +22,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// BacklogWindow.xaml 的交互逻辑
|
/// BacklogWindow.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ToDoWindow
|
public partial class ToDoWindow : IWindowCommon
|
||||||
{
|
{
|
||||||
private static TodoControl backlog = new TodoControl();
|
private static TodoControl backlog = new TodoControl();
|
||||||
private AppData appData = MainWindow.appData;
|
private AppData appData = MainWindow.appData;
|
||||||
@@ -64,9 +65,11 @@ namespace GeekDesk.Control.Windows
|
|||||||
{
|
{
|
||||||
case "History":
|
case "History":
|
||||||
backlog.BacklogList.ItemsSource = appData.HiToDoList;
|
backlog.BacklogList.ItemsSource = appData.HiToDoList;
|
||||||
|
backlog.type = ToDoType.HISTORY;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
backlog.BacklogList.ItemsSource = appData.ToDoList;
|
backlog.BacklogList.ItemsSource = appData.ToDoList;
|
||||||
|
backlog.type = ToDoType.NEW;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,15 +86,24 @@ namespace GeekDesk.Control.Windows
|
|||||||
|
|
||||||
|
|
||||||
private static System.Windows.Window window = null;
|
private static System.Windows.Window window = null;
|
||||||
|
#pragma warning disable CS0108 // “ToDoWindow.Show()”隐藏继承的成员“Window.Show()”。如果是有意隐藏,请使用关键字 new。
|
||||||
public static void Show()
|
public static void Show()
|
||||||
|
#pragma warning restore CS0108 // “ToDoWindow.Show()”隐藏继承的成员“Window.Show()”。如果是有意隐藏,请使用关键字 new。
|
||||||
{
|
{
|
||||||
if (window == null || !window.Activate())
|
if (window == null || !window.Activate())
|
||||||
{
|
{
|
||||||
window = new ToDoWindow();
|
window = new ToDoWindow();
|
||||||
}
|
}
|
||||||
window.Show();
|
window.Show();
|
||||||
|
Keyboard.Focus(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,39 +6,52 @@
|
|||||||
xmlns:local="clr-namespace:GeekDesk.Control.Windows"
|
xmlns:local="clr-namespace:GeekDesk.Control.Windows"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="UpdateWindow" Height="300" Width="450"
|
Height="460" Width="610"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent" ShowInTaskbar="False">
|
Title=""
|
||||||
<Border CornerRadius="4" Background="AliceBlue" BorderThickness="1" BorderBrush="Green" MouseDown="DragMove">
|
Background="Transparent" ShowInTaskbar="False"
|
||||||
<StackPanel HorizontalAlignment="Center">
|
Focusable="True"
|
||||||
<hc:Card BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="20,20,20,0">
|
KeyDown="OnKeyDown">
|
||||||
<!--Card 的内容部分-->
|
<Grid Margin="20">
|
||||||
<Border CornerRadius="4,4,0,0" Height="160">
|
<Grid.Effect>
|
||||||
<StackPanel>
|
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||||
<TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
|
RenderingBias="Quality" ShadowDepth="2"/>
|
||||||
<TextBlock Margin="15" x:Name="Msg" TextWrapping="Wrap" VerticalAlignment="Center" Text=""/>
|
</Grid.Effect>
|
||||||
</StackPanel>
|
<Border CornerRadius="4" Background="White" BorderThickness="0" MouseDown="DragMove">
|
||||||
</Border>
|
<StackPanel HorizontalAlignment="Center">
|
||||||
<!--Card 的尾部部分-->
|
<hc:Card BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="20,20,20,0">
|
||||||
<hc:Card.Footer>
|
<!--Card 的内容部分-->
|
||||||
<StackPanel Margin="10" Width="420">
|
<Border CornerRadius="4,4,0,0" Height="260">
|
||||||
<!--Card 的一级内容-->
|
<StackPanel>
|
||||||
<TextBlock TextWrapping="NoWrap" x:Name="Title" Style="{DynamicResource TextBlockLargeBold}" TextTrimming="CharacterEllipsis"
|
<TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
|
||||||
|
<StackPanel x:Name="MsgPanel">
|
||||||
|
<hc:ScrollViewer x:Name="MsgBar" HorizontalScrollBarVisibility="Visible" IsInertiaEnabled="True" Margin="10" Width="430">
|
||||||
|
<TextBlock Width="430" FontSize="15" LineHeight="22" x:Name="Msg" TextWrapping="Wrap" VerticalAlignment="Center" Text="测试"/>
|
||||||
|
</hc:ScrollViewer>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
<!--Card 的尾部部分-->
|
||||||
|
<hc:Card.Footer>
|
||||||
|
<StackPanel Margin="10" Width="520">
|
||||||
|
<!--Card 的一级内容-->
|
||||||
|
<TextBlock TextWrapping="NoWrap" x:Name="Title" Style="{DynamicResource TextBlockLargeBold}" TextTrimming="CharacterEllipsis"
|
||||||
Text=""
|
Text=""
|
||||||
HorizontalAlignment="Left"/>
|
HorizontalAlignment="Left"/>
|
||||||
<!--Card 的二级内容-->
|
<!--Card 的二级内容-->
|
||||||
<TextBlock TextWrapping="NoWrap" x:Name="SubTitle" Style="{DynamicResource TextBlockDefault}" TextTrimming="CharacterEllipsis"
|
<TextBlock TextWrapping="NoWrap" x:Name="SubTitle" Style="{DynamicResource TextBlockDefault}" TextTrimming="CharacterEllipsis"
|
||||||
Margin="0,6,0,0"
|
Margin="0,6,0,0"
|
||||||
HorizontalAlignment="Left"/>
|
HorizontalAlignment="Left"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</hc:Card.Footer>
|
</hc:Card.Footer>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
<hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
|
<hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
|
||||||
<Button Content="暂不更新" Click="Close_Click" />
|
<Button Content="暂不更新" Click="Close_Click" />
|
||||||
<Button Content="前往更新" Click="Confirm_Click" Background="#5BC0DE" Foreground="White" RenderTransformOrigin="0.696,0.45"/>
|
<Button Content="前往更新" Click="Confirm_Click" Style="{StaticResource Btn1}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Interface;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
@@ -23,7 +24,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// UpdateWindow.xaml 的交互逻辑
|
/// UpdateWindow.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UpdateWindow : Window
|
public partial class UpdateWindow : Window, IWindowCommon
|
||||||
{
|
{
|
||||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
private static string githubUrl = "";
|
private static string githubUrl = "";
|
||||||
@@ -33,6 +34,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
this.Topmost = true;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
DataHandle(jo);
|
DataHandle(jo);
|
||||||
}
|
}
|
||||||
@@ -68,7 +70,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
string msg = "";
|
string msg = "";
|
||||||
for (int i=0; i<ja.Count; i++)
|
for (int i=0; i<ja.Count; i++)
|
||||||
{
|
{
|
||||||
msg += "•" + ja[i].ToString() + "\n";
|
msg += "• " + ja[i].ToString() + "\n";
|
||||||
}
|
}
|
||||||
Msg.Text = msg;
|
Msg.Text = msg;
|
||||||
}
|
}
|
||||||
@@ -102,6 +104,15 @@ namespace GeekDesk.Control.Windows
|
|||||||
window = new UpdateWindow(jo);
|
window = new UpdateWindow(jo);
|
||||||
}
|
}
|
||||||
window.Show();
|
window.Show();
|
||||||
|
Keyboard.Focus(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ namespace GeekDesk.Converts
|
|||||||
{
|
{
|
||||||
if (value != null && value.ToString().Length > 0)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
29
Converts/TodoTaskExecConvert.cs
Normal file
29
Converts/TodoTaskExecConvert.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
public class 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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -56,19 +57,50 @@
|
|||||||
<Reference Include="CommonServiceLocator, Version=2.0.6.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
<Reference Include="CommonServiceLocator, Version=2.0.6.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\CommonServiceLocator.2.0.6\lib\net45\CommonServiceLocator.dll</HintPath>
|
<HintPath>packages\CommonServiceLocator.2.0.6\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="HandyControl, Version=3.1.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
|
<Reference Include="Gma.System.MouseKeyHook, Version=5.6.130.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\HandyControl.3.1.0\lib\net472\HandyControl.dll</HintPath>
|
<HintPath>packages\MouseKeyHook.5.6.0\lib\net40\Gma.System.MouseKeyHook.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="HandyControl, Version=3.3.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\HandyControl.3.3.0\lib\net472\HandyControl.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="KeyMouseHook, Version=1.0.6.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\KeyMouseHook.1.0.6\lib\net40\KeyMouseHook.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Quartz, Version=3.3.3.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Quartz.3.3.3\lib\net472\Quartz.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Drawing.Common.6.0.0-preview.6.21352.12\lib\net461\System.Drawing.Common.dll</HintPath>
|
<HintPath>packages\System.Drawing.Common.6.0.0-preview.6.21352.12\lib\net461\System.Drawing.Common.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime.Remoting" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Web.Extensions" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@@ -92,9 +124,11 @@
|
|||||||
<Compile Include="Command\DelegateCommandBase.cs" />
|
<Compile Include="Command\DelegateCommandBase.cs" />
|
||||||
<Compile Include="Constant\AppHideType.cs" />
|
<Compile Include="Constant\AppHideType.cs" />
|
||||||
<Compile Include="Constant\Constants.cs" />
|
<Compile Include="Constant\Constants.cs" />
|
||||||
<Compile Include="Constant\MainWindowEnum.cs" />
|
<Compile Include="Constant\IconType.cs" />
|
||||||
|
<Compile Include="Constant\CommonEnum.cs" />
|
||||||
<Compile Include="Constant\IconStartType.cs" />
|
<Compile Include="Constant\IconStartType.cs" />
|
||||||
<Compile Include="Constant\SortType.cs" />
|
<Compile Include="Constant\SortType.cs" />
|
||||||
|
<Compile Include="Constant\TodoTaskExecType.cs" />
|
||||||
<Compile Include="Constant\UpdateType.cs" />
|
<Compile Include="Constant\UpdateType.cs" />
|
||||||
<Compile Include="Control\Other\BacklogNotificatin.xaml.cs">
|
<Compile Include="Control\Other\BacklogNotificatin.xaml.cs">
|
||||||
<DependentUpon>BacklogNotificatin.xaml</DependentUpon>
|
<DependentUpon>BacklogNotificatin.xaml</DependentUpon>
|
||||||
@@ -102,6 +136,9 @@
|
|||||||
<Compile Include="Control\Other\CustomIconUrlDialog.xaml.cs">
|
<Compile Include="Control\Other\CustomIconUrlDialog.xaml.cs">
|
||||||
<DependentUpon>CustomIconUrlDialog.xaml</DependentUpon>
|
<DependentUpon>CustomIconUrlDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Control\Other\IconInfoUrlDialog.xaml.cs">
|
||||||
|
<DependentUpon>IconInfoUrlDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Control\UserControls\Config\OtherControl.xaml.cs">
|
<Compile Include="Control\UserControls\Config\OtherControl.xaml.cs">
|
||||||
<DependentUpon>OtherControl.xaml</DependentUpon>
|
<DependentUpon>OtherControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -123,9 +160,6 @@
|
|||||||
<Compile Include="Control\Other\IconInfoDialog.xaml.cs">
|
<Compile Include="Control\Other\IconInfoDialog.xaml.cs">
|
||||||
<DependentUpon>IconInfoDialog.xaml</DependentUpon>
|
<DependentUpon>IconInfoDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Control\Other\MenuGeometryDialog.xaml.cs">
|
|
||||||
<DependentUpon>MenuGeometryDialog.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Control\UserControls\Config\AboutControl.xaml.cs">
|
<Compile Include="Control\UserControls\Config\AboutControl.xaml.cs">
|
||||||
<DependentUpon>AboutControl.xaml</DependentUpon>
|
<DependentUpon>AboutControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -148,21 +182,26 @@
|
|||||||
<DependentUpon>UpdateWindow.xaml</DependentUpon>
|
<DependentUpon>UpdateWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Converts\DoubleToGridLength.cs" />
|
<Compile Include="Converts\DoubleToGridLength.cs" />
|
||||||
|
<Compile Include="Converts\TodoTaskExecConvert.cs" />
|
||||||
<Compile Include="Converts\IntToCornerRadius.cs" />
|
<Compile Include="Converts\IntToCornerRadius.cs" />
|
||||||
<Compile Include="Converts\OpcityConvert.cs" />
|
<Compile Include="Converts\OpcityConvert.cs" />
|
||||||
<Compile Include="Converts\UpdateTypeConvert.cs" />
|
<Compile Include="Converts\UpdateTypeConvert.cs" />
|
||||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
||||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
||||||
<Compile Include="Converts\HideTypeConvert.cs" />
|
<Compile Include="Converts\HideTypeConvert.cs" />
|
||||||
|
<Compile Include="Interface\IWindowCommon.cs" />
|
||||||
<Compile Include="Task\ToDoTask.cs" />
|
<Compile Include="Task\ToDoTask.cs" />
|
||||||
|
<Compile Include="Thread\MouseHookThread.cs" />
|
||||||
|
<Compile Include="Thread\DispatcherBuild.cs" />
|
||||||
<Compile Include="Thread\UpdateThread.cs" />
|
<Compile Include="Thread\UpdateThread.cs" />
|
||||||
<Compile Include="Util\AeroGlassHelper.cs" />
|
<Compile Include="Util\AeroGlassHelper.cs" />
|
||||||
|
<Compile Include="Util\GlobalHotKey.cs" />
|
||||||
<Compile Include="Util\CommonCode.cs" />
|
<Compile Include="Util\CommonCode.cs" />
|
||||||
<Compile Include="Util\ConsoleManager.cs" />
|
<Compile Include="Util\ConsoleManager.cs" />
|
||||||
<Compile Include="Util\DragAdorner.cs" />
|
<Compile Include="Util\DragAdorner.cs" />
|
||||||
<Compile Include="Util\FileIcon.cs" />
|
<Compile Include="Util\FileIcon.cs" />
|
||||||
<Compile Include="Util\FileUtil.cs" />
|
<Compile Include="Util\FileUtil.cs" />
|
||||||
<Compile Include="Util\HotKey.cs" />
|
<Compile Include="Util\MarginHide.cs" />
|
||||||
<Compile Include="Util\HttpUtil.cs" />
|
<Compile Include="Util\HttpUtil.cs" />
|
||||||
<Compile Include="Util\ImageUtil.cs" />
|
<Compile Include="Util\ImageUtil.cs" />
|
||||||
<Compile Include="Util\ListViewDragDropManager.cs" />
|
<Compile Include="Util\ListViewDragDropManager.cs" />
|
||||||
@@ -171,6 +210,7 @@
|
|||||||
<Compile Include="Util\MouseUtilities.cs" />
|
<Compile Include="Util\MouseUtilities.cs" />
|
||||||
<Compile Include="Util\RegisterUtil.cs" />
|
<Compile Include="Util\RegisterUtil.cs" />
|
||||||
<Compile Include="Util\ShellContextMenu.cs" />
|
<Compile Include="Util\ShellContextMenu.cs" />
|
||||||
|
<Compile Include="Util\ShowWindowFollowMouse.cs" />
|
||||||
<Compile Include="Util\StringUtil.cs" />
|
<Compile Include="Util\StringUtil.cs" />
|
||||||
<Compile Include="Util\SvgToGeometry.cs" />
|
<Compile Include="Util\SvgToGeometry.cs" />
|
||||||
<Compile Include="ViewModel\AppConfig.cs" />
|
<Compile Include="ViewModel\AppConfig.cs" />
|
||||||
@@ -187,6 +227,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Control\Other\IconInfoUrlDialog.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Control\UserControls\Config\OtherControl.xaml">
|
<Page Include="Control\UserControls\Config\OtherControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -215,10 +259,6 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Control\Other\MenuGeometryDialog.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
<Page Include="Control\UserControls\Config\AboutControl.xaml">
|
<Page Include="Control\UserControls\Config\AboutControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -263,6 +303,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Resource\Dictionary\CommonStyle.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
|||||||
15
Interface/IWindowCommon.cs
Normal file
15
Interface/IWindowCommon.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace GeekDesk.Interface
|
||||||
|
{
|
||||||
|
public interface IWindowCommon
|
||||||
|
{
|
||||||
|
void OnKeyDown(object sender, KeyEventArgs e);
|
||||||
|
}
|
||||||
|
}
|
||||||
170
MainWindow.xaml
170
MainWindow.xaml
@@ -9,18 +9,21 @@
|
|||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||||
x:Name="window"
|
x:Name="window"
|
||||||
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:AppData}"
|
||||||
Title="GeekDesk"
|
Title="GeekDesk"
|
||||||
d:DesignHeight="500" d:DesignWidth="700"
|
d:DesignHeight="500" d:DesignWidth="700"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
OpacityMask ="White"
|
ShowInTaskbar="False"
|
||||||
Deactivated="window_Deactivated"
|
Opacity="0"
|
||||||
SizeChanged="window_SizeChanged"
|
Deactivated="Window_Deactivated"
|
||||||
|
SizeChanged="Window_SizeChanged"
|
||||||
|
KeyDown="OnKeyDown"
|
||||||
|
Focusable="True"
|
||||||
>
|
>
|
||||||
<WindowChrome.WindowChrome>
|
<WindowChrome.WindowChrome>
|
||||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="10"/>
|
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
|
||||||
</WindowChrome.WindowChrome>
|
</WindowChrome.WindowChrome>
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
|
|
||||||
@@ -30,50 +33,59 @@
|
|||||||
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Window.Effect>
|
||||||
<Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
|
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||||
|
RenderingBias="Quality" ShadowDepth="2"/>
|
||||||
|
</Window.Effect>
|
||||||
|
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
|
||||||
Background="AliceBlue" LostFocus="App_LostFocus"
|
Background="AliceBlue" LostFocus="App_LostFocus"
|
||||||
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
|
||||||
<Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0">
|
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
<!--背景图片-->
|
hc:Dialog.Token="IconInfoDialog"
|
||||||
<Border.Background>
|
>
|
||||||
<VisualBrush>
|
<hc:DialogContainer>
|
||||||
<VisualBrush.Visual>
|
|
||||||
<Grid ClipToBounds="True">
|
<Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0">
|
||||||
<Image Source="{Binding AppConfig.BitmapImage}" Margin="-30" Opacity="{Binding AppConfig.BgOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
<!--背景图片-->
|
||||||
<Image.Effect>
|
<Border.Background>
|
||||||
<BlurEffect Radius="{Binding AppConfig.BlurValue}"/>
|
<VisualBrush>
|
||||||
</Image.Effect>
|
<VisualBrush.Visual>
|
||||||
</Image>
|
<Grid ClipToBounds="True">
|
||||||
</Grid>
|
<Image Source="{Binding AppConfig.BitmapImage}" Margin="-30" Opacity="{Binding AppConfig.BgOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
||||||
</VisualBrush.Visual>
|
<Image.Effect>
|
||||||
</VisualBrush>
|
<BlurEffect Radius="{Binding AppConfig.BlurValue}"/>
|
||||||
<!--<ImageBrush ImageSource="{Binding AppConfig.BitmapImage}" Opacity="{Binding AppConfig.BgOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"></ImageBrush>-->
|
</Image.Effect>
|
||||||
</Border.Background>
|
</Image>
|
||||||
<Grid>
|
</Grid>
|
||||||
<Grid.RowDefinitions>
|
</VisualBrush.Visual>
|
||||||
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
</VisualBrush>
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
</Border.Background>
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid>
|
||||||
<ColumnDefinition x:Name="LeftColumn" MinWidth="80" Width="{Binding AppConfig.MenuCardWidth, Mode=TwoWay, Converter={StaticResource DoubleToGridLength}}" MaxWidth="200"></ColumnDefinition>
|
<Grid.RowDefinitions>
|
||||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
||||||
</Grid.ColumnDefinitions>
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition x:Name="LeftColumn" MinWidth="80" Width="{Binding AppConfig.MenuCardWidth, Mode=TwoWay, Converter={StaticResource DoubleToGridLength}}" MaxWidth="200"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
|
||||||
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
|
||||||
<DockPanel.Background>
|
|
||||||
<SolidColorBrush Opacity="0.01"/>
|
|
||||||
</DockPanel.Background>
|
|
||||||
<Image Source="/Resource/Image/TitleLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/>
|
|
||||||
</DockPanel>
|
|
||||||
|
|
||||||
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
|
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
||||||
<DockPanel.Background>
|
<DockPanel.Background>
|
||||||
<SolidColorBrush Opacity="0.01"/>
|
<SolidColorBrush Opacity="0.01"/>
|
||||||
</DockPanel.Background>
|
</DockPanel.Background>
|
||||||
<hc:UniformSpacingPanel Spacing="0" Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
|
<Image Source="/Resource/Image/TitleLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/>
|
||||||
<Button Background="Transparent"
|
</DockPanel>
|
||||||
|
|
||||||
|
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">
|
||||||
|
<DockPanel.Background>
|
||||||
|
<SolidColorBrush Opacity="0.01"/>
|
||||||
|
</DockPanel.Background>
|
||||||
|
<hc:UniformSpacingPanel Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||||
|
<Button Background="Transparent"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
hc:IconElement.Geometry="M917.930667 512c0-57.6 36.181333-106.496 86.869333-125.952a505.429333 505.429333 0 0 0-55.210667-133.461333A134.826667 134.826667 0 0 1 771.413333 74.410667 507.733333 507.733333 0 0 0 637.952 19.2 135.168 135.168 0 0 1 512 106.069333 134.912 134.912 0 0 1 386.048 19.2 505.429333 505.429333 0 0 0 252.586667 74.410667c22.186667 49.749333 13.141333 109.824-27.562667 150.528a135.168 135.168 0 0 1-150.528 27.648 502.016 502.016 0 0 0-55.296 133.461333c50.688 19.626667 86.869333 68.437333 86.869333 125.952 0 57.6-36.181333 106.496-86.869333 125.952 12.117333 47.530667 30.72 92.330667 55.210667 133.461333a134.826667 134.826667 0 0 1 178.090666 178.176 507.733333 507.733333 0 0 0 133.546667 55.210667A135.168 135.168 0 0 1 512 917.930667c57.6 0 106.496 36.181333 125.952 86.869333a505.429333 505.429333 0 0 0 133.461333-55.210667 134.912 134.912 0 0 1 27.562667-150.528 135.168 135.168 0 0 1 150.528-27.648 502.016 502.016 0 0 0 55.296-133.461333A134.912 134.912 0 0 1 917.930667 512zM512 647.338667a135.338667 135.338667 0 1 1 0.085333-270.762667A135.338667 135.338667 0 0 1 512 647.338667z"
|
hc:IconElement.Geometry="M917.930667 512c0-57.6 36.181333-106.496 86.869333-125.952a505.429333 505.429333 0 0 0-55.210667-133.461333A134.826667 134.826667 0 0 1 771.413333 74.410667 507.733333 507.733333 0 0 0 637.952 19.2 135.168 135.168 0 0 1 512 106.069333 134.912 134.912 0 0 1 386.048 19.2 505.429333 505.429333 0 0 0 252.586667 74.410667c22.186667 49.749333 13.141333 109.824-27.562667 150.528a135.168 135.168 0 0 1-150.528 27.648 502.016 502.016 0 0 0-55.296 133.461333c50.688 19.626667 86.869333 68.437333 86.869333 125.952 0 57.6-36.181333 106.496-86.869333 125.952 12.117333 47.530667 30.72 92.330667 55.210667 133.461333a134.826667 134.826667 0 0 1 178.090666 178.176 507.733333 507.733333 0 0 0 133.546667 55.210667A135.168 135.168 0 0 1 512 917.930667c57.6 0 106.496 36.181333 125.952 86.869333a505.429333 505.429333 0 0 0 133.461333-55.210667 134.912 134.912 0 0 1 27.562667-150.528 135.168 135.168 0 0 1 150.528-27.648 502.016 502.016 0 0 0 55.296-133.461333A134.912 134.912 0 0 1 917.930667 512zM512 647.338667a135.338667 135.338667 0 1 1 0.085333-270.762667A135.338667 135.338667 0 0 1 512 647.338667z"
|
||||||
hc:IconElement.Height="18"
|
hc:IconElement.Height="18"
|
||||||
@@ -82,49 +94,55 @@
|
|||||||
Click="ConfigButtonClick"
|
Click="ConfigButtonClick"
|
||||||
Initialized="SettingButton_Initialized"
|
Initialized="SettingButton_Initialized"
|
||||||
x:Name="SettingButton"
|
x:Name="SettingButton"
|
||||||
|
FocusVisualStyle="{x:Null}"
|
||||||
>
|
>
|
||||||
<Button.ContextMenu>
|
<Button.ContextMenu>
|
||||||
<ContextMenu x:Name="SettingMenus" Width="130">
|
<ContextMenu x:Name="SettingMenus" Width="130">
|
||||||
<MenuItem Header="设置" Click="ConfigMenuClick"/>
|
<MenuItem Header="设置" Click="ConfigMenuClick"/>
|
||||||
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Button.ContextMenu>
|
</Button.ContextMenu>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
hc:IconElement.Geometry="M828.770654 148.714771C641.293737-20.89959 354.184117-19.590868 168.245698 152.630946c-212.062907 196.418185-212.062907 522.329912 0 718.748098 185.93842 172.221815 473.048039 173.520546 660.524956 3.916176 219.435707-198.536117 219.435707-528.054322 0-726.580449z m-121.880976 569.643707c-11.708566 11.708566-30.680039 11.708566-42.388605 0L502.729054 556.586459c-0.659356-0.659356-1.728312-0.659356-2.397659 0L338.609327 718.318517c-11.708566 11.708566-30.680039 11.708566-42.388605 0l-0.039961-0.039961c-11.708566-11.708566-11.708566-30.680039 0-42.388605l161.732059-161.732058c0.659356-0.659356 0.659356-1.728312 0-2.397659L296.1408 350.008195c-11.708566-11.708566-11.708566-30.680039 0-42.388605l0.039961-0.039961c11.708566-11.708566 30.680039-11.708566 42.388605 0l161.772019 161.77202c0.659356 0.659356 1.728312 0.659356 2.397659 0L664.551024 307.539668c11.708566-11.708566 30.680039-11.708566 42.388605 0l0.039961 0.039961c11.708566 11.708566 11.708566 30.680039 0 42.388605L545.15762 511.770224c-0.659356 0.659356-0.659356 1.728312 0 2.397659L706.919649 675.939902c11.708566 11.708566 11.708566 30.680039 0 42.388605l-0.029971 0.029971z"
|
hc:IconElement.Geometry="M828.770654 148.714771C641.293737-20.89959 354.184117-19.590868 168.245698 152.630946c-212.062907 196.418185-212.062907 522.329912 0 718.748098 185.93842 172.221815 473.048039 173.520546 660.524956 3.916176 219.435707-198.536117 219.435707-528.054322 0-726.580449z m-121.880976 569.643707c-11.708566 11.708566-30.680039 11.708566-42.388605 0L502.729054 556.586459c-0.659356-0.659356-1.728312-0.659356-2.397659 0L338.609327 718.318517c-11.708566 11.708566-30.680039 11.708566-42.388605 0l-0.039961-0.039961c-11.708566-11.708566-11.708566-30.680039 0-42.388605l161.732059-161.732058c0.659356-0.659356 0.659356-1.728312 0-2.397659L296.1408 350.008195c-11.708566-11.708566-11.708566-30.680039 0-42.388605l0.039961-0.039961c11.708566-11.708566 30.680039-11.708566 42.388605 0l161.772019 161.77202c0.659356 0.659356 1.728312 0.659356 2.397659 0L664.551024 307.539668c11.708566-11.708566 30.680039-11.708566 42.388605 0l0.039961 0.039961c11.708566 11.708566 11.708566 30.680039 0 42.388605L545.15762 511.770224c-0.659356 0.659356-0.659356 1.728312 0 2.397659L706.919649 675.939902c11.708566 11.708566 11.708566 30.680039 0 42.388605l-0.029971 0.029971z"
|
||||||
hc:IconElement.Height="18"
|
hc:IconElement.Height="18"
|
||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Click="CloseButtonClick"
|
Click="CloseButtonClick"
|
||||||
|
FocusVisualStyle="{x:Null}"
|
||||||
/>
|
/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
|
|
||||||
<uc:LeftCardControl Grid.Row="1" Grid.Column="0"/>
|
<uc:LeftCardControl Grid.Row="1" Grid.Column="0"/>
|
||||||
<!--分割线-->
|
|
||||||
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
|
|
||||||
|
|
||||||
<uc:RightCardControl Grid.Row="1" Grid.Column="1"/>
|
|
||||||
|
|
||||||
<hc:NotifyIcon Icon="/Taskbar.ico" Text="GeekDesk" Click="NotifyIcon_Click">
|
|
||||||
<hc:NotifyIcon.ContextMenu>
|
|
||||||
<ContextMenu Width="130">
|
|
||||||
<MenuItem Header="打开面板" Click="ShowApp"/>
|
|
||||||
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
|
||||||
<MenuItem Header="设置" Click="ConfigApp"/>
|
|
||||||
<MenuItem Header="退出" Click="ExitApp"/>
|
|
||||||
</ContextMenu>
|
|
||||||
</hc:NotifyIcon.ContextMenu>
|
|
||||||
|
|
||||||
</hc:NotifyIcon>
|
<!--分割线-->
|
||||||
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
|
||||||
</Grid>
|
|
||||||
</Border>
|
<uc:RightCardControl Grid.Row="1" Grid.Column="1"/>
|
||||||
|
|
||||||
|
<hc:NotifyIcon Icon="/Taskbar.ico" Click="NotifyIcon_Click" x:Name="BarIcon"
|
||||||
|
Visibility="{Binding AppConfig.ShowBarIcon, Mode=TwoWay, Converter={StaticResource Boolean2VisibilityConverter}}">
|
||||||
|
<hc:NotifyIcon.ContextMenu>
|
||||||
|
<ContextMenu Width="130">
|
||||||
|
<MenuItem Header="打开面板" Click="ShowApp"/>
|
||||||
|
<MenuItem Header="关闭图标" Click="CloseBarIcon"/>
|
||||||
|
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
||||||
|
<MenuItem Header="程序目录" Click="OpenThisDir"/>
|
||||||
|
<MenuItem Header="设置" Click="ConfigApp"/>
|
||||||
|
<MenuItem Header="重启" Click="ReStartApp"/>
|
||||||
|
<MenuItem Header="退出" Click="ExitApp"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</hc:NotifyIcon.ContextMenu>
|
||||||
|
|
||||||
|
</hc:NotifyIcon>
|
||||||
|
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</hc:DialogContainer>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ using GeekDesk.Constant;
|
|||||||
using GeekDesk.Control;
|
using GeekDesk.Control;
|
||||||
using GeekDesk.Control.UserControls.Config;
|
using GeekDesk.Control.UserControls.Config;
|
||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Control.Windows;
|
||||||
|
using GeekDesk.Interface;
|
||||||
using GeekDesk.Task;
|
using GeekDesk.Task;
|
||||||
using GeekDesk.Thread;
|
using GeekDesk.Thread;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
using Gma.System.MouseKeyHook;
|
||||||
using HandyControl.Data;
|
using HandyControl.Data;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -18,6 +21,8 @@ using System.Windows.Controls;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||||
|
|
||||||
namespace GeekDesk
|
namespace GeekDesk
|
||||||
{
|
{
|
||||||
@@ -25,15 +30,15 @@ namespace GeekDesk
|
|||||||
/// MainWindow.xaml 的交互逻辑
|
/// MainWindow.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
///
|
///
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window, IWindowCommon
|
||||||
{
|
{
|
||||||
|
|
||||||
public static AppData appData = CommonCode.GetAppDataByFile();
|
public static AppData appData = CommonCode.GetAppDataByFile();
|
||||||
//public static ToDoInfoWindow toDoInfoWindow = (ToDoInfoWindow)ToDoInfoWindow.GetThis();
|
|
||||||
public static ToDoInfoWindow toDoInfoWindow;
|
public static ToDoInfoWindow toDoInfoWindow;
|
||||||
public static int hotKeyId = -1;
|
public static int hotKeyId = -1;
|
||||||
public static int toDoHotKeyId = -1;
|
public static int toDoHotKeyId = -1;
|
||||||
public static MainWindow mainWindow;
|
public static MainWindow mainWindow;
|
||||||
|
public static MarginHide hide;
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
@@ -43,8 +48,18 @@ namespace GeekDesk
|
|||||||
this.Loaded += Window_Loaded;
|
this.Loaded += Window_Loaded;
|
||||||
this.SizeChanged += MainWindow_Resize;
|
this.SizeChanged += MainWindow_Resize;
|
||||||
ToDoTask.BackLogCheck();
|
ToDoTask.BackLogCheck();
|
||||||
|
|
||||||
|
////实例化隐藏 Hide类,进行时间timer设置
|
||||||
|
hide = new MarginHide(this);
|
||||||
|
if (appData.AppConfig.MarginHide)
|
||||||
|
{
|
||||||
|
hide.TimerSet();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载缓存数据
|
||||||
|
/// </summary>
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
this.DataContext = appData;
|
this.DataContext = appData;
|
||||||
@@ -54,28 +69,51 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.Width = appData.AppConfig.WindowWidth;
|
this.Width = appData.AppConfig.WindowWidth;
|
||||||
this.Height = appData.AppConfig.WindowHeight;
|
this.Height = appData.AppConfig.WindowHeight;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 窗口加载完毕 执行方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
void Window_Loaded(object sender, RoutedEventArgs e)
|
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!appData.AppConfig.StartedShowPanel)
|
if (!appData.AppConfig.StartedShowPanel)
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
if (appData.AppConfig.AppAnimation)
|
||||||
|
{
|
||||||
|
this.Opacity = 0;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
this.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
ShowApp();
|
ShowApp();
|
||||||
}
|
}
|
||||||
RegisterHotKey(true);
|
|
||||||
//RegisterCreateToDoHotKey(true);
|
|
||||||
|
|
||||||
if (!appData.AppConfig.SelfStartUped)
|
//给任务栏图标一个名字
|
||||||
|
BarIcon.Text = Constants.MY_NAME;
|
||||||
|
|
||||||
|
//注册热键
|
||||||
|
RegisterHotKey(true);
|
||||||
|
RegisterCreateToDoHotKey(true);
|
||||||
|
|
||||||
|
//注册自启动
|
||||||
|
if (!appData.AppConfig.SelfStartUped && !Constants.DEV)
|
||||||
{
|
{
|
||||||
RegisterUtil.SetSelfStarting(appData.AppConfig.SelfStartUp, Constants.MY_NAME);
|
RegisterUtil.SetSelfStarting(appData.AppConfig.SelfStartUp, Constants.MY_NAME);
|
||||||
}
|
}
|
||||||
UpdateThread.Update();
|
|
||||||
|
|
||||||
|
//注册鼠标中键监听事件
|
||||||
|
if (appData.AppConfig.MouseMiddleShow)
|
||||||
|
{
|
||||||
|
MouseHookThread.MiddleHook();
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新线程开启 检测更新
|
||||||
|
UpdateThread.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -87,18 +125,18 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
if (appData.AppConfig.HotkeyModifiers != 0)
|
if (appData.AppConfig.HotkeyModifiers != 0)
|
||||||
{
|
{
|
||||||
//加载完毕注册热键
|
|
||||||
hotKeyId = Hotkey.Regist(new WindowInteropHelper(MainWindow.mainWindow).Handle, appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
|
hotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
|
||||||
{
|
{
|
||||||
if (MotionControl.hotkeyFinished)
|
if (MotionControl.hotkeyFinished)
|
||||||
{
|
{
|
||||||
if (mainWindow.Visibility == Visibility.Collapsed)
|
if (mainWindow.Visibility == Visibility.Collapsed || mainWindow.Opacity == 0)
|
||||||
{
|
{
|
||||||
ShowApp();
|
ShowApp();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainWindow.Visibility = Visibility.Collapsed;
|
HideApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -122,6 +160,45 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 淡入淡出效果
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="opacity"></param>
|
||||||
|
/// <param name="milliseconds"></param>
|
||||||
|
/// <param name="visibility"></param>
|
||||||
|
public static void FadeStoryBoard(int opacity, int milliseconds, Visibility visibility)
|
||||||
|
{
|
||||||
|
if (appData.AppConfig.AppAnimation)
|
||||||
|
{
|
||||||
|
DoubleAnimation opacityAnimation = new DoubleAnimation
|
||||||
|
{
|
||||||
|
From = mainWindow.Opacity,
|
||||||
|
To = opacity,
|
||||||
|
Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
|
||||||
|
};
|
||||||
|
opacityAnimation.Completed += (s, e) =>
|
||||||
|
{
|
||||||
|
mainWindow.BeginAnimation(OpacityProperty, null);
|
||||||
|
if (visibility == Visibility.Visible)
|
||||||
|
{
|
||||||
|
mainWindow.Opacity = 1;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
mainWindow.Opacity = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Timeline.SetDesiredFrameRate(opacityAnimation, 30);
|
||||||
|
mainWindow.BeginAnimation(OpacityProperty, opacityAnimation);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//防止关闭动画后 窗体仍是0透明度
|
||||||
|
mainWindow.Opacity = 1;
|
||||||
|
mainWindow.Visibility = visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注册新建待办的热键
|
/// 注册新建待办的热键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -129,14 +206,15 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (appData.AppConfig.ToDoHotkeyModifiers!=0)
|
if (appData.AppConfig.ToDoHotkeyModifiers!=0)
|
||||||
{
|
{
|
||||||
//加载完毕注册热键
|
//加载完毕注册热键
|
||||||
toDoHotKeyId = Hotkey.Regist(new WindowInteropHelper(MainWindow.mainWindow).Handle, appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
|
toDoHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
|
||||||
{
|
{
|
||||||
if (MotionControl.hotkeyFinished)
|
if (MotionControl.hotkeyFinished)
|
||||||
{
|
{
|
||||||
ToDoInfoWindow.ShowNone();
|
ToDoInfoWindow.ShowOrHide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -158,23 +236,12 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void DisplayWindowHotKeyPress(object sender, KeyPressedEventArgs e)
|
|
||||||
//{
|
|
||||||
// if (e.HotKey.Key == Key.Y)
|
|
||||||
// {
|
|
||||||
// if (this.Visibility == Visibility.Collapsed)
|
|
||||||
// {
|
|
||||||
// ShowApp();
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// this.Visibility = Visibility.Collapsed;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重置窗体大小 写入缓存
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
void MainWindow_Resize(object sender, System.EventArgs e)
|
void MainWindow_Resize(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
if (this.DataContext != null)
|
if (this.DataContext != null)
|
||||||
@@ -187,13 +254,13 @@ namespace GeekDesk
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 程序窗体拖动
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void DragMove(object sender, MouseEventArgs e)
|
private void DragMove(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
//if (e.LeftButton == MouseButtonState.Pressed)
|
|
||||||
//{
|
|
||||||
// this.DragMove();
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (e.LeftButton == MouseButtonState.Pressed)
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
{
|
{
|
||||||
@@ -210,7 +277,6 @@ namespace GeekDesk
|
|||||||
(When clicking the drag area, make the window follow) */
|
(When clicking the drag area, make the window follow) */
|
||||||
DragMove();
|
DragMove();
|
||||||
|
|
||||||
|
|
||||||
if (this.ResizeMode != windowMode)
|
if (this.ResizeMode != windowMode)
|
||||||
{
|
{
|
||||||
this.ResizeMode = windowMode;
|
this.ResizeMode = windowMode;
|
||||||
@@ -230,7 +296,13 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void CloseButtonClick(object sender, RoutedEventArgs e)
|
private void CloseButtonClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
if (appData.AppConfig.AppAnimation)
|
||||||
|
{
|
||||||
|
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
this.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -258,66 +330,27 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
public static void ShowApp()
|
public static void ShowApp()
|
||||||
{
|
{
|
||||||
|
//有全屏化应用则不显示
|
||||||
|
//if (CommonCode.IsPrimaryFullScreen())
|
||||||
|
//{
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
if (appData.AppConfig.FollowMouse)
|
if (appData.AppConfig.FollowMouse)
|
||||||
{
|
{
|
||||||
ShowAppAndFollowMouse();
|
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
|
||||||
} else
|
|
||||||
{
|
|
||||||
mainWindow.Visibility = Visibility.Visible;
|
|
||||||
}
|
}
|
||||||
|
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
||||||
Keyboard.Focus(mainWindow);
|
Keyboard.Focus(mainWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static void HideApp()
|
||||||
/// 随鼠标位置显示面板 (鼠标始终在中间)
|
|
||||||
/// </summary>
|
|
||||||
private static void ShowAppAndFollowMouse()
|
|
||||||
{
|
{
|
||||||
//获取鼠标位置
|
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||||
System.Windows.Point p = MouseUtil.GetMousePosition();
|
|
||||||
double left = SystemParameters.VirtualScreenLeft;
|
|
||||||
double top = SystemParameters.VirtualScreenTop;
|
|
||||||
double width = SystemParameters.VirtualScreenWidth;
|
|
||||||
double height = SystemParameters.VirtualScreenHeight;
|
|
||||||
double right = width - Math.Abs(left);
|
|
||||||
double bottom = height - Math.Abs(top);
|
|
||||||
|
|
||||||
|
|
||||||
if (p.X - mainWindow.Width / 2 < left)
|
|
||||||
{
|
|
||||||
//判断是否在最左边缘
|
|
||||||
mainWindow.Left = left;
|
|
||||||
}
|
|
||||||
else if (p.X + mainWindow.Width / 2 > right)
|
|
||||||
{
|
|
||||||
//判断是否在最右边缘
|
|
||||||
mainWindow.Left = right - mainWindow.Width;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mainWindow.Left = p.X - mainWindow.Width / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (p.Y - mainWindow.Height / 2 < top)
|
|
||||||
{
|
|
||||||
//判断是否在最上边缘
|
|
||||||
mainWindow.Top = top;
|
|
||||||
}
|
|
||||||
else if (p.Y + mainWindow.Height / 2 > bottom)
|
|
||||||
{
|
|
||||||
//判断是否在最下边缘
|
|
||||||
mainWindow.Top = bottom - mainWindow.Height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mainWindow.Top = p.Y - mainWindow.Height / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow.Visibility = Visibility.Visible;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 图片图标单击事件
|
/// 图片图标单击事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -325,13 +358,13 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void NotifyIcon_Click(object sender, RoutedEventArgs e)
|
private void NotifyIcon_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.Visibility == Visibility.Collapsed)
|
if (this.Visibility == Visibility.Collapsed || this.Opacity == 0)
|
||||||
{
|
{
|
||||||
ShowApp();
|
ShowApp();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
HideApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,6 +378,20 @@ namespace GeekDesk
|
|||||||
ConfigWindow.Show(appData.AppConfig, this);
|
ConfigWindow.Show(appData.AppConfig, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 右键任务栏图标打开程序目录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OpenThisDir(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Process p = new Process();
|
||||||
|
p.StartInfo.FileName = "Explorer.exe";
|
||||||
|
p.StartInfo.Arguments = "/e,/select," + Constants.APP_DIR + Constants.MY_NAME + ".exe";
|
||||||
|
p.Start();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 右键任务栏图标退出
|
/// 右键任务栏图标退出
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -352,22 +399,15 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ExitApp(object sender, RoutedEventArgs e)
|
private void ExitApp(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (appData.AppConfig.MouseMiddleShow)
|
||||||
|
{
|
||||||
|
MouseHookThread.Dispose();
|
||||||
|
}
|
||||||
Application.Current.Shutdown();
|
Application.Current.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//public static void ShowContextMenu(IntPtr hAppWnd, Window taskBar, System.Windows.Point pt)
|
|
||||||
//{
|
|
||||||
// WindowInteropHelper helper = new WindowInteropHelper(taskBar);
|
|
||||||
// IntPtr callingTaskBarWindow = helper.Handle;
|
|
||||||
// IntPtr wMenu = GetSystemMenu(hAppWnd, false);
|
|
||||||
// // Display the menu
|
|
||||||
// uint command = TrackPopupMenuEx(wMenu, TPM.LEFTBUTTON | TPM.RETURNCMD, (int) pt.X, (int) pt.Y, callingTaskBarWindow, IntPtr.Zero);
|
|
||||||
// if (command == 0) return;
|
|
||||||
// PostMessage(hAppWnd, WM.SYSCOMMAND, new IntPtr(command), IntPtr.Zero);
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置图标
|
/// 设置图标
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -410,11 +450,15 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||||
|
if (appData.AppConfig.MarginHide && !hide.IsMargin())
|
||||||
|
{
|
||||||
|
this.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void window_Deactivated(object sender, EventArgs e)
|
private void Window_Deactivated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
||||||
{
|
{
|
||||||
@@ -422,7 +466,7 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.DataContext != null)
|
if (this.DataContext != null)
|
||||||
{
|
{
|
||||||
@@ -431,6 +475,42 @@ namespace GeekDesk
|
|||||||
appData.AppConfig.WindowHeight = this.Height;
|
appData.AppConfig.WindowHeight = this.Height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重启
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ReStartApp(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MouseHookThread.Dispose();
|
||||||
|
|
||||||
|
Process p = new Process();
|
||||||
|
p.StartInfo.FileName = Constants.APP_DIR + Constants.MY_NAME + ".exe";
|
||||||
|
p.StartInfo.WorkingDirectory = Constants.APP_DIR;
|
||||||
|
p.Start();
|
||||||
|
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 关闭托盘图标
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void CloseBarIcon(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
appData.AppConfig.ShowBarIcon = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
HideApp();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,5 +49,5 @@ using System.Windows;
|
|||||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
//通过使用 "*",如下所示:
|
//通过使用 "*",如下所示:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.0")]
|
[assembly: AssemblyVersion("2.3.2.1")]
|
||||||
[assembly: AssemblyFileVersion("2.0")]
|
[assembly: AssemblyFileVersion("2.3.2.1")]
|
||||||
|
|||||||
32
README.md
32
README.md
@@ -1,6 +1,16 @@
|
|||||||
# GeekDesk
|
# GeekDesk 极客桌面
|
||||||
小巧、美观的桌面快速启动工具
|
小巧、**美观**的桌面快速启动管理工具
|
||||||
|
|
||||||
|
谈一谈做GeekDesk的原因:
|
||||||
|
|
||||||
|
目前的市场上也有一部分桌面图标管理工具, 但是**界面好点的收费**, **免费的界面差**
|
||||||
|
**windows11**都来了, 难道还要用界面停留在**win7时代**的软件吗
|
||||||
|
|
||||||
|
所以就萌生了做这款软件的想法, **免费 / 美观 / 高度定制化** 是从GeekDesk诞生开始就有的需求和方向, 未来也会向着这些方向发展
|
||||||
|
目前GeekDesk只有一个人在开发, 大家如果有好的建议也可以提Issue
|
||||||
|
|
||||||
|
另外如果你喜欢 GeekDesk的话, 或许可以为作者购买防脱洗发水
|
||||||
|
<img src="https://z3.ax1x.com/2021/07/20/WYdfmR.jpg" alt="WYdfmR.jpg" border="0" width="400px"/>
|
||||||
## 开发框架
|
## 开发框架
|
||||||
- wpf
|
- wpf
|
||||||
- .net 4.7.2
|
- .net 4.7.2
|
||||||
@@ -9,7 +19,6 @@
|
|||||||
## 全局热键 鼠标跟随 快速启动 随时随地
|
## 全局热键 鼠标跟随 快速启动 随时随地
|
||||||
- 支持自定义热键
|
- 支持自定义热键
|
||||||
- 支持鼠标跟随
|
- 支持鼠标跟随
|
||||||
-
|
|
||||||
<img src="https://z3.ax1x.com/2021/07/19/WJt4hQ.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
|
<img src="https://z3.ax1x.com/2021/07/19/WJt4hQ.gif" alt="WJt4hQ.gif" border="0" width="800px"/>
|
||||||
|
|
||||||
## 自定义壁纸
|
## 自定义壁纸
|
||||||
@@ -21,13 +30,12 @@
|
|||||||
- 背景图片毛玻璃效果
|
- 背景图片毛玻璃效果
|
||||||
- 界面透明度
|
- 界面透明度
|
||||||
- 界面圆角
|
- 界面圆角
|
||||||
-
|
|
||||||
<img src="https://z3.ax1x.com/2021/07/19/WGOYSU.gif" alt="WGOYSU.gif" border="0" width="800px"/>
|
<img src="https://z3.ax1x.com/2021/07/19/WGOYSU.gif" alt="WGOYSU.gif" border="0" width="800px"/>
|
||||||
|
|
||||||
## 自定义菜单图标
|
## 自定义菜单图标
|
||||||
- 80多个系统图标可供选择
|
- 80多个系统图标可供选择
|
||||||
- 另支持在线导入阿里巴巴icon图标
|
- 另支持在线导入阿里巴巴icon图标
|
||||||
-
|
- 篇幅原因,公众号内回复 **自定义图标** 可以查看教程
|
||||||
<img src="https://z3.ax1x.com/2021/07/19/WJ3fDU.png" alt="WJ3fDU.png" border="0" width="450px"/>
|
<img src="https://z3.ax1x.com/2021/07/19/WJ3fDU.png" alt="WJ3fDU.png" border="0" width="450px"/>
|
||||||
|
|
||||||
## 定时提醒 永不忘记
|
## 定时提醒 永不忘记
|
||||||
@@ -36,15 +44,3 @@
|
|||||||
## LICENSE
|
## LICENSE
|
||||||
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
|
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
|
||||||
- 商用需联系作者
|
- 商用需联系作者
|
||||||
|
|
||||||
## 作者相关
|
|
||||||
主业Java程序员一枚(目前北京在职), 有好的工作请联系我 :smirk:
|
|
||||||
### 佛系公众号
|
|
||||||
不定期更新技术相关, 或者一些牢骚
|
|
||||||
|
|
||||||
<img src="https://z3.ax1x.com/2021/07/19/WJaI9e.jpg" alt="WJaI9e.jpg" border="0" />
|
|
||||||
|
|
||||||
### 佛系赞赏
|
|
||||||
我知道没人赞赏但我还是要放上来
|
|
||||||
|
|
||||||
<img src="https://z3.ax1x.com/2021/07/20/WYdfmR.jpg" alt="WYdfmR.jpg" border="0" width="500px"/>
|
|
||||||
|
|||||||
48
Resource/Dictionary/CommonStyle.xaml
Normal file
48
Resource/Dictionary/CommonStyle.xaml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<ResourceDictionary 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">
|
||||||
|
|
||||||
|
|
||||||
|
<Style x:Key="BorderBG" TargetType="Border">
|
||||||
|
<Style.Setters>
|
||||||
|
<Setter Property="Background">
|
||||||
|
<Setter.Value>
|
||||||
|
<LinearGradientBrush Opacity="0.97">
|
||||||
|
<GradientStop Color="#EBF7E3" Offset="0"/>
|
||||||
|
<GradientStop Color="#A8E4C0" Offset="1"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="CornerRadius" Value="8"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
</Style.Setters>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="Btn1" TargetType="Button" BasedOn="{StaticResource ButtonInfo}">
|
||||||
|
<Setter Property="Background">
|
||||||
|
<Setter.Value>
|
||||||
|
<LinearGradientBrush Opacity="0.97">
|
||||||
|
<GradientStop Color="#5BC0DE" Offset="0"/>
|
||||||
|
<GradientStop Color="#5BC0DE" Offset="1"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="Foreground" Value="White"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="MyMenuStyle" TargetType="hc:SideMenuItem" BasedOn="{StaticResource SideMenuItemBaseStyle}">
|
||||||
|
<Style.Setters>
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
</Style.Setters>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -7,6 +7,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -24,9 +25,11 @@ namespace GeekDesk.Task
|
|||||||
public static void BackLogCheck()
|
public static void BackLogCheck()
|
||||||
{
|
{
|
||||||
|
|
||||||
System.Timers.Timer timer = new System.Timers.Timer();
|
System.Timers.Timer timer = new System.Timers.Timer
|
||||||
timer.Enabled = true;
|
{
|
||||||
timer.Interval = 5000;
|
Enabled = true,
|
||||||
|
Interval = 5000
|
||||||
|
};
|
||||||
timer.Start();
|
timer.Start();
|
||||||
timer.Elapsed += new System.Timers.ElapsedEventHandler(Check);
|
timer.Elapsed += new System.Timers.ElapsedEventHandler(Check);
|
||||||
}
|
}
|
||||||
@@ -48,9 +51,27 @@ namespace GeekDesk.Task
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ClearMemory();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放内存
|
||||||
|
/// </summary>
|
||||||
|
public static void ClearMemory()
|
||||||
|
{
|
||||||
|
GC.Collect();
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
|
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||||
|
{
|
||||||
|
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 内存回收
|
||||||
|
[DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize")]
|
||||||
|
public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
34
Thread/DispatcherBuild.cs
Normal file
34
Thread/DispatcherBuild.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace GeekDesk.Thread
|
||||||
|
{
|
||||||
|
public class DispatcherBuild
|
||||||
|
{
|
||||||
|
|
||||||
|
//创建一个Dispatcher来单独使用ui线程
|
||||||
|
public static Dispatcher Build()
|
||||||
|
{
|
||||||
|
Dispatcher dispatcher = null;
|
||||||
|
var manualResetEvent = new ManualResetEvent(false);
|
||||||
|
var thread = new System.Threading.Thread(() =>
|
||||||
|
{
|
||||||
|
dispatcher = Dispatcher.CurrentDispatcher;
|
||||||
|
var synchronizationContext = new DispatcherSynchronizationContext(dispatcher);
|
||||||
|
SynchronizationContext.SetSynchronizationContext(synchronizationContext);
|
||||||
|
|
||||||
|
manualResetEvent.Set();
|
||||||
|
Dispatcher.Run();
|
||||||
|
});
|
||||||
|
thread.Start();
|
||||||
|
manualResetEvent.WaitOne();
|
||||||
|
manualResetEvent.Dispose();
|
||||||
|
return dispatcher;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
67
Thread/MouseHookThread.cs
Normal file
67
Thread/MouseHookThread.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using GeekDesk.Control.UserControls.Config;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using Gma.System.MouseKeyHook;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace GeekDesk.Thread
|
||||||
|
{
|
||||||
|
public class MouseHookThread
|
||||||
|
{
|
||||||
|
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
|
private static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
|
||||||
|
private static Dispatcher dispatcher;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void MiddleHook()
|
||||||
|
{
|
||||||
|
//使用dispatcher来单独监听UI线程 防止程序卡顿
|
||||||
|
dispatcher = DispatcherBuild.Build();
|
||||||
|
dispatcher.Invoke((Action)(() =>
|
||||||
|
{
|
||||||
|
m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Dispose()
|
||||||
|
{
|
||||||
|
m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt;
|
||||||
|
m_GlobalHook.Dispose();
|
||||||
|
dispatcher.InvokeShutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 鼠标中键呼出
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private static void M_GlobalHook_MouseDownExt(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (appConfig.MouseMiddleShow && e.Button == System.Windows.Forms.MouseButtons.Middle)
|
||||||
|
{
|
||||||
|
if (MotionControl.hotkeyFinished)
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.Dispatcher.Invoke((Action)(() =>
|
||||||
|
{
|
||||||
|
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
|
||||||
|
{
|
||||||
|
MainWindow.ShowApp();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindow.HideApp();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,6 +30,10 @@ namespace GeekDesk.Thread
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//等待1分钟后再检查更新 有的网络连接过慢
|
||||||
|
System.Threading.Thread.Sleep(60 * 1000);
|
||||||
|
|
||||||
string updateUrl;
|
string updateUrl;
|
||||||
string nowVersion = ConfigurationManager.AppSettings["Version"];
|
string nowVersion = ConfigurationManager.AppSettings["Version"];
|
||||||
switch (appConfig.UpdateType)
|
switch (appConfig.UpdateType)
|
||||||
@@ -55,7 +59,9 @@ namespace GeekDesk.Thread
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#pragma warning disable CS0168 // 声明了变量“e”,但从未使用过
|
||||||
} catch (Exception e)
|
} catch (Exception e)
|
||||||
|
#pragma warning restore CS0168 // 声明了变量“e”,但从未使用过
|
||||||
{
|
{
|
||||||
//不做处理
|
//不做处理
|
||||||
//MessageBox.Show(e.Message);
|
//MessageBox.Show(e.Message);
|
||||||
|
|||||||
14
Update.json
14
Update.json
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"title" : "<EFBFBD>汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
"title": "GeekDesk版本更新",
|
||||||
"subTitle" : "V2.0 <20><>ʽ<EFBFBD><CABD>",
|
"subTitle": "V2.3.21",
|
||||||
"msgTitle" : "<EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
"msgTitle": "本次更新内容如下",
|
||||||
"msg" : "['<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><EFBFBD>ٵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>','<27><EFBFBD><DEB8><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bug','<27><EFBFBD>ijЩͼ<D0A9><CDBC><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>С<EFBFBD><D0A1>bug','<27><><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>óɹ<C3B3><C9B9><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ','<27><><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>ϵͳ<CFB5>˵<EFBFBD>']",
|
"msg": "['所有窗口可Esc退出','修复一个测试遗留BUG,导致没有D盘的情况下无法添加项目','修复已知问题']",
|
||||||
"githubUrl" : "https://github.com/Demo-Liu/GeekDesk/releases/tag/2.0",
|
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
|
||||||
"giteeUrl" : "https://gitee.com/demo_liu/GeekDesk/releases/2.0",
|
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
|
||||||
"version": "2.0"
|
"version": "2.3.21"
|
||||||
}
|
}
|
||||||
9
Update.json.bak
Normal file
9
Update.json.bak
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"title": "GeekDesk<73>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>",
|
||||||
|
"subTitle": "V2.3.21",
|
||||||
|
"msgTitle": "<22><><EFBFBD>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
||||||
|
"msg": "['<27><><EFBFBD>д<EFBFBD><D0B4>ڿ<EFBFBD>Esc<73>˳<EFBFBD>','<27><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BUG,<2C><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>D<EFBFBD>̵<EFBFBD><CCB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ','<27><EFBFBD><DEB8><EFBFBD>֪<EFBFBD><D6AA><EFBFBD><EFBFBD>']",
|
||||||
|
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
|
||||||
|
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
|
||||||
|
"version": "2.3.21"
|
||||||
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 提取一些代码
|
/// 提取一些代码
|
||||||
@@ -52,6 +55,44 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断当前屏幕(鼠标最后活动屏幕)是否有全屏化应用
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsPrimaryFullScreen()
|
||||||
|
{
|
||||||
|
RECT rect = new RECT();
|
||||||
|
GetWindowRect(new HandleRef(null, GetForegroundWindow()), ref rect);
|
||||||
|
|
||||||
|
int windowHeight = rect.bottom - rect.top;
|
||||||
|
int screenHeight = (int)SystemParameters.PrimaryScreenHeight;
|
||||||
|
|
||||||
|
if (windowHeight >= screenHeight)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct RECT
|
||||||
|
{
|
||||||
|
public int left;
|
||||||
|
public int top;
|
||||||
|
public int right;
|
||||||
|
public int bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool GetWindowRect(HandleRef hWnd, [In, Out] ref RECT rect);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern IntPtr GetForegroundWindow();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
@@ -65,7 +66,14 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
Bitmap bmp = ico.ToBitmap();
|
Bitmap bmp = ico.ToBitmap();
|
||||||
MemoryStream strm = new MemoryStream();
|
MemoryStream strm = new MemoryStream();
|
||||||
bmp.Save(strm, System.Drawing.Imaging.ImageFormat.Png);
|
|
||||||
|
ImageCodecInfo myImageCodecInfo = GetEncoderInfo("image/png");
|
||||||
|
Encoder myEncoder = Encoder.Quality;
|
||||||
|
EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, 75L);
|
||||||
|
EncoderParameters myEncoderParameters = new EncoderParameters(1);
|
||||||
|
myEncoderParameters.Param[0] = myEncoderParameter;
|
||||||
|
|
||||||
|
bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
|
||||||
BitmapImage bmpImage = new BitmapImage();
|
BitmapImage bmpImage = new BitmapImage();
|
||||||
bmpImage.BeginInit();
|
bmpImage.BeginInit();
|
||||||
strm.Seek(0, SeekOrigin.Begin);
|
strm.Seek(0, SeekOrigin.Begin);
|
||||||
@@ -78,7 +86,20 @@ namespace GeekDesk.Util
|
|||||||
return bmpImage.Clone();
|
return bmpImage.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ImageCodecInfo GetEncoderInfo(String mimeType)
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
ImageCodecInfo[] encoders;
|
||||||
|
encoders = ImageCodecInfo.GetImageEncoders();
|
||||||
|
for (j = 0; j < encoders.Length; ++j)
|
||||||
|
{
|
||||||
|
if (encoders[j].MimeType == mimeType)
|
||||||
|
return encoders[j];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static int GetIconIndex(string pszFile)
|
public static int GetIconIndex(string pszFile)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ namespace GeekDesk.Util
|
|||||||
}
|
}
|
||||||
return shortcut.TargetPath;
|
return shortcut.TargetPath;
|
||||||
}
|
}
|
||||||
|
#pragma warning disable CS0168 // 声明了变量“e”,但从未使用过
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
#pragma warning restore CS0168 // 声明了变量“e”,但从未使用过
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
97
Util/GlobalHotKey.cs
Normal file
97
Util/GlobalHotKey.cs
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class GlobalHotKey
|
||||||
|
{
|
||||||
|
public enum HotkeyModifiers
|
||||||
|
{
|
||||||
|
MOD_ALT = 0x1,
|
||||||
|
MOD_CONTROL = 0x2,
|
||||||
|
MOD_SHIFT = 0x4,
|
||||||
|
MOD_WIN = 0x8
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int currentID;
|
||||||
|
private static readonly Dictionary<int, InvisibleWindowForMessages> handleTemp = new Dictionary<int, InvisibleWindowForMessages>();
|
||||||
|
|
||||||
|
public delegate void HotKeyCallBackHanlder();
|
||||||
|
/// <summary>
|
||||||
|
/// Registers a global hotkey
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="aKeyGestureString">e.g. Alt + Shift + Control + Win + S</param>
|
||||||
|
/// <param name="callback">Action to be called when hotkey is pressed</param>
|
||||||
|
/// <returns>true, if registration succeeded, otherwise false</returns>
|
||||||
|
public static int RegisterHotKey(string aKeyGestureString, HotKeyCallBackHanlder callback)
|
||||||
|
{
|
||||||
|
var c = new KeyGestureConverter();
|
||||||
|
KeyGesture aKeyGesture = (KeyGesture)c.ConvertFrom(aKeyGestureString);
|
||||||
|
return RegisterHotKey((HotkeyModifiers)aKeyGesture.Modifiers, aKeyGesture.Key, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int RegisterHotKey(HotkeyModifiers aModifier, Key key, HotKeyCallBackHanlder callback)
|
||||||
|
{
|
||||||
|
InvisibleWindowForMessages window = new InvisibleWindowForMessages(callback);
|
||||||
|
currentID += 1;
|
||||||
|
if (!RegisterHotKey(window.Handle, currentID, aModifier, (uint)KeyInterop.VirtualKeyFromKey(key)))
|
||||||
|
{
|
||||||
|
window.Dispose();
|
||||||
|
throw new Exception("RegisterHotKey Failed");
|
||||||
|
}
|
||||||
|
handleTemp.Add(currentID, window);
|
||||||
|
return currentID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Dispose(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UnregisterHotKey(handleTemp[id].Handle, id);
|
||||||
|
GlobalHotKey.handleTemp[id].Dispose();
|
||||||
|
GlobalHotKey.handleTemp.Remove(id);
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
//nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Registers a hot key with Windows.
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool RegisterHotKey(IntPtr hWnd, int id, HotkeyModifiers fsModifiers, uint vk);
|
||||||
|
// Unregisters the hot key with Windows.
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
|
||||||
|
|
||||||
|
private class InvisibleWindowForMessages : NativeWindow, IDisposable
|
||||||
|
{
|
||||||
|
public event HotKeyCallBackHanlder callback;
|
||||||
|
public InvisibleWindowForMessages(HotKeyCallBackHanlder callback)
|
||||||
|
{
|
||||||
|
CreateHandle(new CreateParams());
|
||||||
|
this.callback += callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly int WM_HOTKEY = 0x0312;
|
||||||
|
protected override void WndProc(ref Message m)
|
||||||
|
{
|
||||||
|
base.WndProc(ref m);
|
||||||
|
if (m.Msg == WM_HOTKEY)
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
this.DestroyHandle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Interop;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 热键注册
|
|
||||||
/// </summary>
|
|
||||||
namespace GeekDesk.Util
|
|
||||||
{
|
|
||||||
|
|
||||||
class Hotkey
|
|
||||||
{
|
|
||||||
#region 系统api
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
|
||||||
static extern bool RegisterHotKey(IntPtr hWnd, int id, HotkeyModifiers fsModifiers, uint vk);
|
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
static extern bool UnregisterHotKey(IntPtr hWnd, int id);
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 注册快捷键
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="window">持有快捷键窗口</param>
|
|
||||||
/// <param name="fsModifiers">组合键</param>
|
|
||||||
/// <param name="key">快捷键</param>
|
|
||||||
/// <param name="callBack">回调函数</param>
|
|
||||||
public static int Regist(IntPtr windowHandle, HotkeyModifiers fsModifiers, Key key, HotKeyCallBackHanlder callBack)
|
|
||||||
{
|
|
||||||
HwndSource hs = HwndSource.FromHwnd(windowHandle);
|
|
||||||
hs.AddHook(WndProc);
|
|
||||||
|
|
||||||
int id = keyid++;
|
|
||||||
int vk = KeyInterop.VirtualKeyFromKey(key);
|
|
||||||
keymap.Add(id, callBack);
|
|
||||||
if (!RegisterHotKey(windowHandle, id, fsModifiers, (uint)vk)) throw new Exception("RegisterHotKey Failed");
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 快捷键消息处理
|
|
||||||
/// </summary>
|
|
||||||
static IntPtr WndProc(IntPtr windowHandle, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
|
||||||
{
|
|
||||||
if (msg == WM_HOTKEY)
|
|
||||||
{
|
|
||||||
int id = wParam.ToInt32();
|
|
||||||
if (keymap.TryGetValue(id, out var callback))
|
|
||||||
{
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return IntPtr.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 注销快捷键
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hWnd">持有快捷键窗口的句柄</param>
|
|
||||||
/// <param name="callBack">回调函数</param>
|
|
||||||
public static void UnRegist(IntPtr windowHandle, HotKeyCallBackHanlder callBack)
|
|
||||||
{
|
|
||||||
List<int> list = new List<int>(keymap.Keys);
|
|
||||||
for (int i=0; i < list.Count; i++)
|
|
||||||
{
|
|
||||||
if (keymap[list[i]] == callBack)
|
|
||||||
{
|
|
||||||
HwndSource hs = HwndSource.FromHwnd(windowHandle);
|
|
||||||
hs.RemoveHook(WndProc);
|
|
||||||
UnregisterHotKey(windowHandle, list[i]);
|
|
||||||
keymap.Remove(list[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const int WM_HOTKEY = 0x312;
|
|
||||||
static int keyid = 10;
|
|
||||||
public static Dictionary<int, HotKeyCallBackHanlder> keymap = new Dictionary<int, HotKeyCallBackHanlder>();
|
|
||||||
|
|
||||||
public delegate void HotKeyCallBackHanlder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum HotkeyModifiers
|
|
||||||
{
|
|
||||||
MOD_ALT = 0x1,
|
|
||||||
MOD_CONTROL = 0x2,
|
|
||||||
MOD_SHIFT = 0x4,
|
|
||||||
MOD_WIN = 0x8
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -17,10 +17,12 @@ namespace GeekDesk.Util
|
|||||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||||
//创建Web访问对 象
|
//创建Web访问对 象
|
||||||
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
|
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
|
||||||
|
myRequest.ContentType = "text/plain; charset=utf-8";
|
||||||
//通过Web访问对象获取响应内容
|
//通过Web访问对象获取响应内容
|
||||||
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
|
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
|
||||||
|
|
||||||
//通过响应内容流创建StreamReader对象,因为StreamReader更高级更快
|
//通过响应内容流创建StreamReader对象,因为StreamReader更高级更快
|
||||||
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.GetEncoding("gbk"));
|
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.GetEncoding("utf-8"));
|
||||||
string returnStr = reader.ReadToEnd();//利用StreamReader就可以从响应内容从头读到尾
|
string returnStr = reader.ReadToEnd();//利用StreamReader就可以从响应内容从头读到尾
|
||||||
reader.Close();
|
reader.Close();
|
||||||
myResponse.Close();
|
myResponse.Close();
|
||||||
|
|||||||
@@ -4,14 +4,17 @@ using System.Drawing;
|
|||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
namespace GeekDesk.Util
|
namespace GeekDesk.Util
|
||||||
{
|
{
|
||||||
class ImageUtil
|
class ImageUtil
|
||||||
{
|
{
|
||||||
|
private static readonly string SYSTEM_ITEM = "::{.*}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 图片数组转 BitmapImage
|
/// 图片数组转 BitmapImage
|
||||||
@@ -22,9 +25,10 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
using (var ms = new System.IO.MemoryStream(array))
|
using (var ms = new System.IO.MemoryStream(array))
|
||||||
{
|
{
|
||||||
var image = new BitmapImage();
|
BitmapImage image = new BitmapImage();
|
||||||
image.BeginInit();
|
image.BeginInit();
|
||||||
image.CacheOption = BitmapCacheOption.OnLoad; // here
|
image.CacheOption = BitmapCacheOption.OnLoad; // here
|
||||||
|
RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.LowQuality);
|
||||||
image.StreamSource = ms;
|
image.StreamSource = ms;
|
||||||
image.EndInit();
|
image.EndInit();
|
||||||
return image;
|
return image;
|
||||||
@@ -82,7 +86,7 @@ namespace GeekDesk.Util
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static BitmapImage GetBitmapIconByPath(string filePath)
|
public static BitmapImage GetBitmapIconByPath(string filePath)
|
||||||
{
|
{
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath) || IsSystemItem(filePath))
|
||||||
{
|
{
|
||||||
if (IsImage(filePath)) {
|
if (IsImage(filePath)) {
|
||||||
//图片
|
//图片
|
||||||
@@ -184,7 +188,7 @@ namespace GeekDesk.Util
|
|||||||
Bitmap bmpOut = new Bitmap(lnNewWidth, lnNewHeight);
|
Bitmap bmpOut = new Bitmap(lnNewWidth, lnNewHeight);
|
||||||
Graphics g = Graphics.FromImage(bmpOut);
|
Graphics g = Graphics.FromImage(bmpOut);
|
||||||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
|
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
|
||||||
g.FillRectangle(Brushes.White, 0, 0, lnNewWidth, lnNewHeight);
|
g.FillRectangle(System.Drawing.Brushes.White, 0, 0, lnNewWidth, lnNewHeight);
|
||||||
g.DrawImage(loBMP, 0, 0, lnNewWidth, lnNewHeight);
|
g.DrawImage(loBMP, 0, 0, lnNewWidth, lnNewHeight);
|
||||||
loBMP.Dispose();
|
loBMP.Dispose();
|
||||||
string tempPath = Constants.APP_DIR + "\\temp";
|
string tempPath = Constants.APP_DIR + "\\temp";
|
||||||
@@ -211,6 +215,7 @@ namespace GeekDesk.Util
|
|||||||
BitmapImage bmImg = new BitmapImage();
|
BitmapImage bmImg = new BitmapImage();
|
||||||
bmImg.BeginInit();
|
bmImg.BeginInit();
|
||||||
bmImg.CacheOption = BitmapCacheOption.OnLoad;
|
bmImg.CacheOption = BitmapCacheOption.OnLoad;
|
||||||
|
RenderOptions.SetBitmapScalingMode(bmImg, BitmapScalingMode.LowQuality);
|
||||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
|
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
|
||||||
{
|
{
|
||||||
bmImg.StreamSource = fs;
|
bmImg.StreamSource = fs;
|
||||||
@@ -331,5 +336,15 @@ namespace GeekDesk.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断是否为系统项
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsSystemItem(string path)
|
||||||
|
{
|
||||||
|
return Regex.IsMatch(path, SYSTEM_ITEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
206
Util/MarginHide.cs
Normal file
206
Util/MarginHide.cs
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using System.Drawing; //添加引用
|
||||||
|
using System.Windows.Forms;//添加引用
|
||||||
|
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
|
||||||
|
enum HidePosition
|
||||||
|
{
|
||||||
|
TOP = 1,
|
||||||
|
LEFT = 2,
|
||||||
|
RIGHT = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MarginHide
|
||||||
|
{
|
||||||
|
readonly Window window;//定义使用该方法的窗体
|
||||||
|
|
||||||
|
private readonly int hideTime = 80;
|
||||||
|
|
||||||
|
private readonly int taskTime = 200;
|
||||||
|
|
||||||
|
private double showMarginWidth = 1;
|
||||||
|
|
||||||
|
#pragma warning disable CS0414 // 字段“MarginHide.isHide”已被赋值,但从未使用过它的值
|
||||||
|
private bool isHide;
|
||||||
|
#pragma warning restore CS0414 // 字段“MarginHide.isHide”已被赋值,但从未使用过它的值
|
||||||
|
|
||||||
|
public Timer timer;
|
||||||
|
//构造函数,传入将要匹配的窗体
|
||||||
|
public MarginHide(Window window)
|
||||||
|
{
|
||||||
|
this.window = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 窗体是否贴边
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool IsMargin()
|
||||||
|
{
|
||||||
|
double screenLeft = SystemParameters.VirtualScreenLeft;
|
||||||
|
double screenTop = SystemParameters.VirtualScreenTop;
|
||||||
|
double screenWidth = SystemParameters.VirtualScreenWidth;
|
||||||
|
|
||||||
|
double windowWidth = window.Width;
|
||||||
|
|
||||||
|
double windowTop = window.Top;
|
||||||
|
double windowLeft = window.Left;
|
||||||
|
|
||||||
|
//窗体是否贴边
|
||||||
|
return (windowLeft <= screenLeft
|
||||||
|
|| windowTop <= screenTop
|
||||||
|
|| windowLeft + windowWidth + Math.Abs(screenLeft) >= screenWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 窗体贴边隐藏功能
|
||||||
|
private void TimerDealy(object o, EventArgs e)
|
||||||
|
{
|
||||||
|
if (window.Visibility != Visibility.Visible) return;
|
||||||
|
|
||||||
|
double screenLeft = SystemParameters.VirtualScreenLeft;
|
||||||
|
double screenTop = SystemParameters.VirtualScreenTop;
|
||||||
|
double screenWidth = SystemParameters.VirtualScreenWidth;
|
||||||
|
|
||||||
|
double windowHeight = window.Height;
|
||||||
|
double windowWidth = window.Width;
|
||||||
|
|
||||||
|
double windowTop = window.Top;
|
||||||
|
double windowLeft = window.Left;
|
||||||
|
|
||||||
|
//获取鼠标位置
|
||||||
|
System.Windows.Point p = MouseUtil.GetMousePosition();
|
||||||
|
double mouseX = p.X;
|
||||||
|
double mouseY = p.Y;
|
||||||
|
|
||||||
|
//鼠标不在窗口上
|
||||||
|
if (mouseX < windowLeft || mouseX > windowLeft + windowWidth
|
||||||
|
|| mouseY < windowTop || mouseY > windowTop + windowHeight)
|
||||||
|
{
|
||||||
|
//上方隐藏条件
|
||||||
|
if (windowTop <= screenTop)
|
||||||
|
{
|
||||||
|
HideAnimation(windowTop, screenTop - windowHeight + showMarginWidth, Window.TopProperty);
|
||||||
|
isHide = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//左侧隐藏条件
|
||||||
|
if (windowLeft <= screenLeft)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenLeft - windowWidth + showMarginWidth, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//右侧隐藏条件
|
||||||
|
if (windowLeft + windowWidth + Math.Abs(screenLeft) >= screenWidth)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - showMarginWidth, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth
|
||||||
|
&& mouseY >= windowTop && mouseY <= windowTop + windowHeight)
|
||||||
|
{
|
||||||
|
//上方显示
|
||||||
|
if (windowTop <= screenTop - showMarginWidth)
|
||||||
|
{
|
||||||
|
HideAnimation(windowTop, screenTop, Window.TopProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//左侧显示
|
||||||
|
if (windowLeft <= screenLeft - showMarginWidth)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenLeft, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//右侧显示
|
||||||
|
if (windowLeft + Math.Abs(screenLeft) == screenWidth - showMarginWidth)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - windowWidth, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public void TimerSet()
|
||||||
|
{
|
||||||
|
if (timer != null) return;
|
||||||
|
timer = new Timer();//添加timer计时器,隐藏功能
|
||||||
|
#region 计时器设置,隐藏功能
|
||||||
|
timer.Interval = taskTime;
|
||||||
|
timer.Tick += TimerDealy;
|
||||||
|
timer.Start();
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TimerStop()
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
timer.Dispose();
|
||||||
|
timer = null;
|
||||||
|
//功能关闭 如果界面是隐藏状态 那么要显示界面 ↓
|
||||||
|
|
||||||
|
double screenLeft = SystemParameters.VirtualScreenLeft;
|
||||||
|
double screenTop = SystemParameters.VirtualScreenTop;
|
||||||
|
double screenWidth = SystemParameters.VirtualScreenWidth;
|
||||||
|
|
||||||
|
double windowWidth = window.Width;
|
||||||
|
|
||||||
|
double windowTop = window.Top;
|
||||||
|
double windowLeft = window.Left;
|
||||||
|
|
||||||
|
//左侧显示
|
||||||
|
if (windowLeft <= screenLeft - showMarginWidth)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenLeft, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//上方显示
|
||||||
|
if (windowTop <= screenTop - showMarginWidth)
|
||||||
|
{
|
||||||
|
HideAnimation(windowTop, screenTop, Window.TopProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//右侧显示
|
||||||
|
if (windowLeft + Math.Abs(screenLeft) == screenWidth - showMarginWidth)
|
||||||
|
{
|
||||||
|
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - windowWidth, Window.LeftProperty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void HideAnimation(double from, double to, DependencyProperty property)
|
||||||
|
{
|
||||||
|
DoubleAnimation da = new DoubleAnimation
|
||||||
|
{
|
||||||
|
From = from,
|
||||||
|
To = to,
|
||||||
|
Duration = new Duration(TimeSpan.FromMilliseconds(hideTime))
|
||||||
|
};
|
||||||
|
da.Completed += (s, e) =>
|
||||||
|
{
|
||||||
|
window.BeginAnimation(property, null);
|
||||||
|
};
|
||||||
|
Timeline.SetDesiredFrameRate(da, 60);
|
||||||
|
window.BeginAnimation(property, da);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,9 @@ namespace GeekDesk.Util
|
|||||||
key.Close();
|
key.Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -60,14 +62,18 @@ namespace GeekDesk.Util
|
|||||||
key.DeleteValue(exeName);//取消开机启动
|
key.DeleteValue(exeName);//取消开机启动
|
||||||
key.Close();
|
key.Close();
|
||||||
}
|
}
|
||||||
|
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
|
||||||
{
|
{
|
||||||
if (key != null)
|
if (key != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1509,7 +1509,9 @@ namespace GeekDesk.Util
|
|||||||
m_hookType,
|
m_hookType,
|
||||||
m_filterFunc,
|
m_filterFunc,
|
||||||
IntPtr.Zero,
|
IntPtr.Zero,
|
||||||
|
#pragma warning disable CS0618 // <20><>AppDomain.GetCurrentThreadId()<29><><EFBFBD>ѹ<EFBFBD>ʱ:<3A><>AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread. http://go.microsoft.com/fwlink/?linkid=14202<30><32>
|
||||||
(int)AppDomain.GetCurrentThreadId());
|
(int)AppDomain.GetCurrentThreadId());
|
||||||
|
#pragma warning restore CS0618 // <20><>AppDomain.GetCurrentThreadId()<29><><EFBFBD>ѹ<EFBFBD>ʱ:<3A><>AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread. http://go.microsoft.com/fwlink/?linkid=14202<30><32>
|
||||||
}
|
}
|
||||||
// ************************************************************************
|
// ************************************************************************
|
||||||
|
|
||||||
|
|||||||
111
Util/ShowWindowFollowMouse.cs
Normal file
111
Util/ShowWindowFollowMouse.cs
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class ShowWindowFollowMouse
|
||||||
|
{
|
||||||
|
|
||||||
|
public enum MousePosition
|
||||||
|
{
|
||||||
|
CENTER = 1,
|
||||||
|
LEFT_TOP = 2,
|
||||||
|
LEFT_BOTTOM = 3,
|
||||||
|
RIGHT_TOP = 4,
|
||||||
|
RIGHT_BOTTOM = 5,
|
||||||
|
LEFT_CENTER = 6,
|
||||||
|
RIGHT_CENTER = 7
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 随鼠标位置显示面板
|
||||||
|
/// </summary>
|
||||||
|
public static void Show(Window window, MousePosition position, double widthOffset = 0, double heightOffset = 0, bool visibility = true)
|
||||||
|
{
|
||||||
|
//获取鼠标位置
|
||||||
|
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);
|
||||||
|
|
||||||
|
double afterWidth;
|
||||||
|
double afterHeight;
|
||||||
|
|
||||||
|
switch (position)
|
||||||
|
{
|
||||||
|
|
||||||
|
case MousePosition.LEFT_BOTTOM:
|
||||||
|
afterWidth = 0;
|
||||||
|
afterHeight = window.Height;
|
||||||
|
break;
|
||||||
|
case MousePosition.LEFT_TOP:
|
||||||
|
afterWidth = 0;
|
||||||
|
afterHeight = 0;
|
||||||
|
break;
|
||||||
|
case MousePosition.LEFT_CENTER:
|
||||||
|
afterWidth = 0;
|
||||||
|
afterHeight = window.Height / 2;
|
||||||
|
break;
|
||||||
|
case MousePosition.RIGHT_BOTTOM:
|
||||||
|
afterWidth = window.Width;
|
||||||
|
afterHeight = window.Height;
|
||||||
|
break;
|
||||||
|
case MousePosition.RIGHT_TOP:
|
||||||
|
afterWidth = window.Width;
|
||||||
|
afterHeight = 0;
|
||||||
|
break;
|
||||||
|
case MousePosition.RIGHT_CENTER:
|
||||||
|
afterWidth = window.Width;
|
||||||
|
afterHeight = window.Height / 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
afterWidth = window.Width / 2;
|
||||||
|
afterHeight = window.Height / 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
afterWidth += widthOffset;
|
||||||
|
afterHeight -= heightOffset;
|
||||||
|
|
||||||
|
if (p.X - afterWidth < left)
|
||||||
|
{
|
||||||
|
//判断是否在最左边缘
|
||||||
|
window.Left = left;
|
||||||
|
}
|
||||||
|
else if (p.X + afterWidth > right)
|
||||||
|
{
|
||||||
|
//判断是否在最右边缘
|
||||||
|
window.Left = right - window.Width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.Left = p.X - afterWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (p.Y - afterHeight < top)
|
||||||
|
{
|
||||||
|
//判断是否在最上边缘
|
||||||
|
window.Top = top;
|
||||||
|
}
|
||||||
|
else if (p.Y + afterHeight > bottom)
|
||||||
|
{
|
||||||
|
//判断是否在最下边缘
|
||||||
|
window.Top = bottom - window.Height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.Top = p.Y - afterHeight;
|
||||||
|
}
|
||||||
|
if (visibility)
|
||||||
|
{
|
||||||
|
window.Opacity = 0;
|
||||||
|
window.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ using System.ComponentModel;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using static GeekDesk.Util.GlobalHotKey;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 程序设置
|
/// 程序设置
|
||||||
@@ -19,9 +20,9 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
private SortType menuSortType = SortType.CUSTOM; //菜单排序类型
|
private SortType menuSortType = SortType.CUSTOM; //菜单排序类型
|
||||||
private SortType iconSortType = SortType.CUSTOM; //图表排序类型
|
private SortType iconSortType = SortType.CUSTOM; //图表排序类型
|
||||||
private double windowWidth = (double)MainWindowEnum.WINDOW_WIDTH; //窗口宽度
|
private double windowWidth = (double)CommonEnum.WINDOW_WIDTH; //窗口宽度
|
||||||
private double windowHeight = (double)MainWindowEnum.WINDOW_HEIGHT; //窗口高度
|
private double windowHeight = (double)CommonEnum.WINDOW_HEIGHT; //窗口高度
|
||||||
private double menuCardWidth = (double)MainWindowEnum.MENU_CARD_WIDHT;//菜单栏宽度
|
private double menuCardWidth = (double)CommonEnum.MENU_CARD_WIDHT;//菜单栏宽度
|
||||||
private int selectedMenuIndex = 0; //上次选中菜单索引
|
private int selectedMenuIndex = 0; //上次选中菜单索引
|
||||||
private bool followMouse = true; //面板跟随鼠标 默认是
|
private bool followMouse = true; //面板跟随鼠标 默认是
|
||||||
private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
|
private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
|
||||||
@@ -42,9 +43,9 @@ namespace GeekDesk.ViewModel
|
|||||||
private HotkeyModifiers hotkeyModifiers = HotkeyModifiers.MOD_CONTROL; //默认启动面板快捷键
|
private HotkeyModifiers hotkeyModifiers = HotkeyModifiers.MOD_CONTROL; //默认启动面板快捷键
|
||||||
private Key hotkey = Key.Q; //默认启动面板快捷键
|
private Key hotkey = Key.Q; //默认启动面板快捷键
|
||||||
|
|
||||||
private string toDoHotkeyStr; //待办任务快捷键
|
private string toDoHotkeyStr = "Ctrl + Shift + Q"; //待办任务快捷键
|
||||||
private HotkeyModifiers toDoHotkeyModifiers; //待办任务快捷键
|
private HotkeyModifiers toDoHotkeyModifiers; //待办任务快捷键
|
||||||
private Key toDoHotkey; //待办任务快捷键
|
private Key toDoHotkey = Key.E; //待办任务快捷键
|
||||||
|
|
||||||
private string customIconUrl; //自定义图标url
|
private string customIconUrl; //自定义图标url
|
||||||
private string customIconJsonUrl; //自定义图标json信息url
|
private string customIconJsonUrl; //自定义图标json信息url
|
||||||
@@ -56,10 +57,196 @@ namespace GeekDesk.ViewModel
|
|||||||
|
|
||||||
private bool selfStartUp = true; //开机自启动设置
|
private bool selfStartUp = true; //开机自启动设置
|
||||||
private bool selfStartUped = false; //是否已设置
|
private bool selfStartUped = false; //是否已设置
|
||||||
|
|
||||||
private bool pmModel = false; //性能模式
|
private bool pmModel = false; //性能模式
|
||||||
|
private string textColor = "#000000"; //字体颜色
|
||||||
|
private double imgPanelWidth = (double)CommonEnum.IMAGE_PANEL_WIDTH;
|
||||||
|
private double imgPanelHeight = (double)CommonEnum.IMAGE_PANEL_HEIGHT;
|
||||||
|
private bool marginHide = false; //贴边隐藏
|
||||||
|
private bool appAnimation = false; //主窗口动画效果
|
||||||
|
private int imageWidth = (int)CommonEnum.IMAGE_WIDTH; //图片宽度
|
||||||
|
private int imageHeight = (int)CommonEnum.IMAGE_HEIGHT; //图片高度
|
||||||
|
|
||||||
|
private bool mouseMiddleShow = false; //鼠标中键呼出 默认不启用
|
||||||
|
|
||||||
|
private bool showBarIcon = true; //显示托盘图标 默认显示
|
||||||
|
|
||||||
#region GetSet
|
#region GetSet
|
||||||
|
public bool ShowBarIcon
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return showBarIcon;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
showBarIcon = value;
|
||||||
|
OnPropertyChanged("ShowBarIcon");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MouseMiddleShow
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return mouseMiddleShow;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
mouseMiddleShow = value;
|
||||||
|
OnPropertyChanged("MouseMiddleShow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ImageWidth
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// 为了兼容旧版 暂时使用默认
|
||||||
|
if (imageWidth == 0)
|
||||||
|
{
|
||||||
|
return (int)CommonEnum.IMAGE_WIDTH;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return imageWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
imageWidth = value;
|
||||||
|
//同时设置高度
|
||||||
|
ImageHeight = value;
|
||||||
|
|
||||||
|
|
||||||
|
//计算 容器宽度因子
|
||||||
|
double i = ((double)imageWidth - (double)CommonEnum.IMAGE_WIDTH) / 5d;
|
||||||
|
double s = 2.44;
|
||||||
|
i *= 2d;
|
||||||
|
while (i > 1)
|
||||||
|
{
|
||||||
|
i /= 10d;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i > 0d)
|
||||||
|
{
|
||||||
|
s -= i;
|
||||||
|
}
|
||||||
|
if (s < 2.2)
|
||||||
|
{
|
||||||
|
s = 2.2;
|
||||||
|
}
|
||||||
|
//设置容器宽度
|
||||||
|
ImgPanelWidth = (int)(ImageWidth * s);
|
||||||
|
|
||||||
|
OnPropertyChanged("ImageWidth");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ImageHeight
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
//都使用宽度来确定大小
|
||||||
|
// 为了兼容旧版 暂时使用默认
|
||||||
|
if (imageHeight == 0)
|
||||||
|
{
|
||||||
|
return (int)CommonEnum.IMAGE_HEIGHT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return imageHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
imageHeight = value;
|
||||||
|
|
||||||
|
//计算容器高度因子
|
||||||
|
double i = ((double)imageHeight - (double)CommonEnum.IMAGE_HEIGHT) / 5d;
|
||||||
|
while (i > 1)
|
||||||
|
{
|
||||||
|
i /= 10d;
|
||||||
|
}
|
||||||
|
double s = 2.00;
|
||||||
|
if (i > 0d)
|
||||||
|
{
|
||||||
|
s -= i;
|
||||||
|
}
|
||||||
|
if (s < 1.5) s = 1.5;
|
||||||
|
|
||||||
|
//设置容器高度
|
||||||
|
ImgPanelHeight = ImageHeight * s;
|
||||||
|
OnPropertyChanged("ImageHeight");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AppAnimation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return appAnimation;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
appAnimation = value;
|
||||||
|
OnPropertyChanged("AppAnimation");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MarginHide
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return marginHide;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
marginHide = value;
|
||||||
|
OnPropertyChanged("MarginHide");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double ImgPanelWidth
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (imgPanelWidth == 0d) return (double)CommonEnum.IMAGE_PANEL_WIDTH;
|
||||||
|
return imgPanelWidth;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
imgPanelWidth = value;
|
||||||
|
OnPropertyChanged("ImgPanelWidth");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double ImgPanelHeight
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (imgPanelHeight == 0d) return (double)CommonEnum.IMAGE_PANEL_HEIGHT;
|
||||||
|
return imgPanelHeight;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
imgPanelHeight = value;
|
||||||
|
OnPropertyChanged("ImgPanelHeight");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TextColor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (textColor == null) return "#000000";
|
||||||
|
return textColor;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
textColor = value;
|
||||||
|
OnPropertyChanged("TextColor");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool PMModel
|
public bool PMModel
|
||||||
{
|
{
|
||||||
@@ -105,6 +292,11 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
//兼容老版本
|
||||||
|
if (toDoHotkey == Key.None)
|
||||||
|
{
|
||||||
|
toDoHotkey = Key.Q;
|
||||||
|
}
|
||||||
return toDoHotkey;
|
return toDoHotkey;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -119,6 +311,10 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (toDoHotkeyModifiers == 0)
|
||||||
|
{
|
||||||
|
toDoHotkeyModifiers = HotkeyModifiers.MOD_CONTROL | HotkeyModifiers.MOD_SHIFT;
|
||||||
|
}
|
||||||
return toDoHotkeyModifiers;
|
return toDoHotkeyModifiers;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -132,6 +328,11 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
//兼容老版本
|
||||||
|
if (toDoHotkeyStr == null)
|
||||||
|
{
|
||||||
|
toDoHotkeyStr = "Ctrl + Shift + Q";
|
||||||
|
}
|
||||||
return toDoHotkeyStr;
|
return toDoHotkeyStr;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -238,6 +439,10 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (hotkeyModifiers == 0)
|
||||||
|
{
|
||||||
|
hotkeyModifiers = HotkeyModifiers.MOD_CONTROL;
|
||||||
|
}
|
||||||
return hotkeyModifiers;
|
return hotkeyModifiers;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
|
|||||||
@@ -20,13 +20,26 @@ namespace GeekDesk.ViewModel
|
|||||||
private BitmapImage bitmapImage; //位图
|
private BitmapImage bitmapImage; //位图
|
||||||
private byte[] imageByteArr; //图片 byte数组
|
private byte[] imageByteArr; //图片 byte数组
|
||||||
private string content; //显示信息
|
private string content; //显示信息
|
||||||
private int imageWidth = (int)MainWindowEnum.IMAGE_WIDTH; //图片宽度
|
|
||||||
private int imageHeight = (int)MainWindowEnum.IMAGE_HEIGHT; //图片高度
|
|
||||||
private bool adminStartUp = false; //始终管理员方式启动 默认否
|
private bool adminStartUp = false; //始终管理员方式启动 默认否
|
||||||
private byte[] defaultImage; //默认图标
|
private byte[] defaultImage; //默认图标
|
||||||
|
|
||||||
|
private IconType iconType = IconType.OTHER;
|
||||||
|
|
||||||
|
|
||||||
|
public IconType IconType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (iconType == 0) return IconType.OTHER;
|
||||||
|
return iconType;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
iconType = value;
|
||||||
|
OnPropertyChanged("IconType");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] DefaultImage
|
public byte[] DefaultImage
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -137,33 +150,7 @@ namespace GeekDesk.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ImageWidth
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// 为了兼容旧版 暂时使用默认
|
|
||||||
return (int)MainWindowEnum.IMAGE_WIDTH;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
imageWidth = value;
|
|
||||||
OnPropertyChanged("ImageWidth");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ImageHeight
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// 为了兼容旧版 暂时使用默认
|
|
||||||
return (int)MainWindowEnum.IMAGE_HEIGHT;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
imageHeight = value;
|
|
||||||
OnPropertyChanged("ImageHeight");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GeekDesk.Util;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -17,8 +18,38 @@ namespace GeekDesk.ViewModel
|
|||||||
private string msg; //事项详情
|
private string msg; //事项详情
|
||||||
private string exeTime; //待办时间
|
private string exeTime; //待办时间
|
||||||
private string doneTime; //完成时间
|
private string doneTime; //完成时间
|
||||||
|
private TodoTaskExecType execType = TodoTaskExecType.SET_TIME;
|
||||||
|
private string cron; //cron表达式
|
||||||
//private int status; //状态 0 未处理 1 已处理
|
//private int status; //状态 0 未处理 1 已处理
|
||||||
|
|
||||||
|
public string Cron
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return cron;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
cron = value;
|
||||||
|
OnPropertyChanged("Cron");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TodoTaskExecType ExecType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
//兼容老版本 需要给个默认值
|
||||||
|
if (execType == 0) return TodoTaskExecType.SET_TIME;
|
||||||
|
return execType;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
execType = value;
|
||||||
|
OnPropertyChanged("ExecType");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string DoneTime
|
public string DoneTime
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
|
<package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
|
||||||
<package id="HandyControl" version="3.1.0" targetFramework="net472" />
|
<package id="HandyControl" version="3.3.0" targetFramework="net472" />
|
||||||
|
<package id="KeyMouseHook" version="1.0.6" targetFramework="net472" developmentDependency="true" />
|
||||||
|
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" />
|
||||||
|
<package id="MouseKeyHook" version="5.6.0" targetFramework="net472" />
|
||||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
||||||
|
<package id="Quartz" version="3.3.3" targetFramework="net472" />
|
||||||
|
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
|
||||||
|
<package id="System.Diagnostics.DiagnosticSource" version="4.7.1" targetFramework="net472" />
|
||||||
<package id="System.Drawing.Common" version="6.0.0-preview.6.21352.12" targetFramework="net472" />
|
<package id="System.Drawing.Common" version="6.0.0-preview.6.21352.12" targetFramework="net472" />
|
||||||
|
<package id="System.Memory" version="4.5.4" targetFramework="net472" />
|
||||||
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||||
|
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
||||||
Reference in New Issue
Block a user