Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
240008ce2c | ||
|
|
8f043ffd05 | ||
|
|
6e58afcdea | ||
|
|
896dc26f11 | ||
|
|
d44cc90100 | ||
|
|
da7588273e | ||
|
|
c7ef24a5b1 | ||
|
|
6b6372847c | ||
|
|
3995084776 | ||
|
|
7d061abadc | ||
|
|
9d174ed2fc | ||
|
|
444697b457 | ||
|
|
2ecad2fea2 | ||
|
|
e46d64193b | ||
|
|
e42f2c3c73 | ||
|
|
0aa7969e4a | ||
|
|
1a88194d26 | ||
|
|
b47dd0fbf7 |
11
App.config
11
App.config
@@ -19,13 +19,14 @@
|
|||||||
<add key="Services" value="服务" />
|
<add key="Services" value="服务" />
|
||||||
</SystemIcons>
|
</SystemIcons>
|
||||||
<SystemBGs>
|
<SystemBGs>
|
||||||
<GradientBGParam Color1="#FCCF31" Color2="#F55555" Name="诸神黄昏"/>
|
<GradientBGParam Color1="#FCCF31" Color2="#F55555" Name="诸神黄昏" />
|
||||||
</SystemBGs>
|
</SystemBGs>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
</startup>
|
</startup>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<probing privatePath="lib" />
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0" />
|
<bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0" />
|
||||||
@@ -46,15 +47,19 @@
|
|||||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.1.1.0" newVersion="2.1.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="Version" value="2.4.16" />
|
<add key="Version" value="2.5.10" />
|
||||||
<add key="GitHubUrl" value="https://github.com/BookerLiu/GeekDesk" />
|
<add key="GitHubUrl" value="https://github.com/BookerLiu/GeekDesk" />
|
||||||
<add key="GiteeUrl" value="https://gitee.com/BookerLiu/GeekDesk/tree/master" />
|
<add key="GiteeUrl" value="https://gitee.com/BookerLiu/GeekDesk/tree/master" />
|
||||||
<add key="GitHubUpdateUrl" value="https://raw.githubusercontent.com/BookerLiu/GeekDesk/master/Update.json" />
|
<add key="GitHubUpdateUrl" value="https://raw.githubusercontent.com/BookerLiu/GeekDesk/master/Update.json" />
|
||||||
<add key="GiteeUpdateUrl" value="https://gitee.com/BookerLiu/GeekDesk/raw/master/Update.json" />
|
<add key="GiteeUpdateUrl" value="https://gitee.com/BookerLiu/GeekDesk/raw/master/Update.json" />
|
||||||
<!--<add key="GiteeUpdateUrl" value="file:///C:/Users/Fei/Desktop/GeekDesk/Update.json" />-->
|
<!--<add key="GiteeUpdateUrl" value="file:///D:/WorkSpace/workspace-VS/GeekDesk/Update.json" />-->
|
||||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||||
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
|
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
|
|||||||
2
App.xaml
2
App.xaml
@@ -13,6 +13,8 @@
|
|||||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
||||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
||||||
<ResourceDictionary Source="/GeekDesk;component/Resource/Dictionary/CommonStyle.xaml"/>
|
<ResourceDictionary Source="/GeekDesk;component/Resource/Dictionary/CommonStyle.xaml"/>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/XamlFlair.WPF;component/DefaultAnimations.xaml"/>
|
||||||
|
<ResourceDictionary Source="/GeekDesk;component/Resource/Dictionary/XamlFlairSettings.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|||||||
@@ -13,14 +13,22 @@ namespace GeekDesk.Constant
|
|||||||
|
|
||||||
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
|
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// app数据文件路径
|
/// app数据文件路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string DATA_FILE_PATH = APP_DIR + "Data"; //app数据文件路径
|
public static string DATA_FILE_PATH = APP_DIR + "Data"; //app数据文件路径
|
||||||
|
|
||||||
public static string LOG_FILE_PATH = APP_DIR + "Log.log";
|
/// <summary>
|
||||||
|
/// 备份文件路径
|
||||||
|
/// </summary>
|
||||||
|
public static string DATA_FILE_BAK_PATH = APP_DIR + "bak\\Data.bak"; //app备份数据文件路径
|
||||||
|
|
||||||
public static string ERROR_FILE_PATH = APP_DIR + "Error.log";
|
public static string PW_FILE_BAK_PATH = APP_DIR + "bak\\pw.txt"; //密码文件路径
|
||||||
|
|
||||||
|
public static string LOG_FILE_PATH = APP_DIR + "logs\\log.log"; //日志文件
|
||||||
|
|
||||||
|
public static string ERROR_FILE_PATH = APP_DIR + "logs\\error.log"; // 错误日志
|
||||||
|
|
||||||
public static int SHADOW_WIDTH = 20;
|
public static int SHADOW_WIDTH = 20;
|
||||||
|
|
||||||
|
|||||||
16
Constant/PasswordType.cs
Normal file
16
Constant/PasswordType.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GeekDesk.Constant
|
||||||
|
{
|
||||||
|
public enum PasswordType
|
||||||
|
{
|
||||||
|
INPUT = 0, //键入密码
|
||||||
|
CREATE = 1, //新建密码
|
||||||
|
ALTER = 2, //修改密码
|
||||||
|
CANCEL = 3, //取消密码
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,25 @@
|
|||||||
public static bool LOCK_APP_PANEL = false;
|
public static bool LOCK_APP_PANEL = false;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否弹出了菜单密码框
|
||||||
|
/// </summary>
|
||||||
|
public static bool SHOW_MENU_PASSWORDBOX = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否弹出了右键菜单
|
||||||
|
/// </summary>
|
||||||
|
public static bool SHOW_RIGHT_BTN_MENU = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否点击了面板功能按钮
|
||||||
|
/// </summary>
|
||||||
|
public static bool APP_BTN_IS_DOWN = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否正在编辑菜单
|
||||||
|
/// </summary>
|
||||||
|
public static bool IS_MENU_EDIT = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace GeekDesk.Control.Other
|
|||||||
}
|
}
|
||||||
ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
|
ToDoTask.activityBacklog[info].Close(); //关闭桌面通知
|
||||||
ToDoTask.activityBacklog.Remove(info);//激活任务删除
|
ToDoTask.activityBacklog.Remove(info);//激活任务删除
|
||||||
CommonCode.SaveAppData(appData);
|
CommonCode.SaveAppData(appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
54
Control/Other/GlobalMsgNotification.xaml
Normal file
54
Control/Other/GlobalMsgNotification.xaml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<Border x:Class="GeekDesk.Control.Other.GlobalMsgNotification"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
BorderThickness="0"
|
||||||
|
Style="{StaticResource BorderBG}"
|
||||||
|
Margin="15"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}"
|
||||||
|
Width="320"
|
||||||
|
Height="400">
|
||||||
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="AliceBlue" Opacity="0.96"/>
|
||||||
|
</Border.Background>
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
<StackPanel>
|
||||||
|
<Image Source="/Resource/Image/BacklogImg.png" Width="260" Margin="0,20,0,0"/>
|
||||||
|
<hc:Card Width="260" Height="220" BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="0,20,0,0">
|
||||||
|
|
||||||
|
<Border CornerRadius="4,4,0,0" Height="160" Padding="10,0,10,0">
|
||||||
|
<ScrollViewer>
|
||||||
|
<TextBlock TextOptions.TextFormattingMode="Display"
|
||||||
|
TextOptions.TextHintingMode="Animated"
|
||||||
|
UseLayoutRounding="True"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
FontStyle="Normal"
|
||||||
|
FontSize="15"
|
||||||
|
LineHeight="22"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Text="{Binding Msg}"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
|
<!--<hc:Card.Footer>
|
||||||
|
<StackPanel Margin="10" Width="160">
|
||||||
|
|
||||||
|
<TextBlock TextWrapping="NoWrap" FontSize="20" Style="{DynamicResource TextBlockLargeBold}" TextTrimming="CharacterEllipsis"
|
||||||
|
Text="{Binding Title}"
|
||||||
|
HorizontalAlignment="Left"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock TextWrapping="NoWrap" Style="{DynamicResource TextBlockDefault}" TextTrimming="CharacterEllipsis"
|
||||||
|
Margin="0,6,0,0"
|
||||||
|
HorizontalAlignment="Left"/>
|
||||||
|
</StackPanel>
|
||||||
|
</hc:Card.Footer>-->
|
||||||
|
</hc:Card>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<Button Click="Close_Click" Content="朕已阅" Margin="10,0,10,20" Width="298" VerticalAlignment="Bottom"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
61
Control/Other/GlobalMsgNotification.xaml.cs
Normal file
61
Control/Other/GlobalMsgNotification.xaml.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Task;
|
||||||
|
using GeekDesk.Util;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using HandyControl.Controls;
|
||||||
|
using Quartz;
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace GeekDesk.Control.Other
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// BacklogNotificatin.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class GlobalMsgNotification
|
||||||
|
{
|
||||||
|
|
||||||
|
public Notification ntf;
|
||||||
|
public GlobalMsgNotification(DialogMsg msg)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.DataContext = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class DialogMsg
|
||||||
|
{
|
||||||
|
public string msg;
|
||||||
|
public string title;
|
||||||
|
|
||||||
|
public string Msg
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
msg = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
title = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Close_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ntf.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
CornerRadius="4"
|
CornerRadius="4"
|
||||||
Width="350"
|
Width="350"
|
||||||
Height="450"
|
Height="450"
|
||||||
@@ -10,29 +11,39 @@
|
|||||||
<Border.Resources>
|
<Border.Resources>
|
||||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||||
<Setter Property="Width" Value="75"/>
|
<Setter Property="Width" Value="75"/>
|
||||||
<Setter Property="TextAlignment" Value="Center"/>
|
<Setter Property="TextAlignment" Value="Left"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
<Setter Property="Margin" Value="0,8,0,0"/>
|
<Setter Property="Margin" Value="5,8,0,0"/>
|
||||||
<Setter Property="FontSize" Value="14"/>
|
<Setter Property="FontSize" Value="14"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||||
</Border.Resources>
|
</Border.Resources>
|
||||||
<hc:SimplePanel Margin="10" VerticalAlignment="Center">
|
<hc:SimplePanel Margin="10" VerticalAlignment="Center">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top"/>
|
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||||
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="名称:" Style="{StaticResource LeftTB}"/>
|
||||||
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
|
<TextBox x:Name="IconName" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<TextBlock Text="相对路径:" Style="{StaticResource LeftTB}"/>
|
||||||
|
<TextBlock Text="{Binding RelativePath, Mode=OneWay}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Margin="0,8,0,0"
|
||||||
|
Width="230"
|
||||||
|
FontSize="14"
|
||||||
|
TextTrimming="WordEllipsis"
|
||||||
|
hc:Poptip.Placement="Bottom"
|
||||||
|
hc:Poptip.Content="{Binding RelativePath, Mode=OneWay, Converter={StaticResource StringAppendConvert}, ConverterParameter='\{\}\\\n(同盘符下才会建立相对路径)'}"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,15,0,0">
|
||||||
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="图标:" Style="{StaticResource LeftTB}"/>
|
||||||
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
|
<Image x:Name="IconImg" Source="{Binding BitmapImage, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" Width="60" Height="60"/>
|
||||||
<Button Content="修改" Click="EditImage"/>
|
<Button Content="修改" Click="EditImage"/>
|
||||||
<Button Content="重置" Click="ReStoreImage"/>
|
<Button Content="重置" Click="ReStoreImage"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="4,15,0,0">
|
||||||
<hc:UniformSpacingPanel Spacing="10">
|
|
||||||
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
|
<CheckBox x:Name="IconIsAdmin" Content="始终以管理员方式启动" IsChecked="{Binding AdminStartUp, Mode=OneWay}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -41,12 +52,11 @@
|
|||||||
</CheckBox.Background>
|
</CheckBox.Background>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||||
<hc:UniformSpacingPanel Spacing="10">
|
|
||||||
<TextBlock Text="启动参数:" Style="{StaticResource LeftTB}"/>
|
<TextBlock Text="启动参数:" Style="{StaticResource LeftTB}"/>
|
||||||
<TextBox x:Name="StartArg" Text="{Binding StartArg, Mode=OneWay}" Width="230" Height="100" TextWrapping="Wrap" FontSize="14"/>
|
<TextBox x:Name="StartArg" Text="{Binding StartArg, Mode=OneWay}" Width="230" Height="100" TextWrapping="Wrap" FontSize="14"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Margin="0,25,0,0" Spacing="10" Grid.ColumnSpan="4">
|
||||||
<Button Content="保存" Style="{StaticResource Btn1}" Click="SaveProperty" Margin="265,10,0,0"/>
|
<Button Content="保存" Style="{StaticResource Btn1}" Click="SaveProperty" Margin="265,10,0,0"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
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;
|
||||||
@@ -38,7 +39,7 @@ namespace GeekDesk.Control.Other
|
|||||||
info.Name = IconName.Text;
|
info.Name = IconName.Text;
|
||||||
info.AdminStartUp = IconIsAdmin.IsChecked.Value;
|
info.AdminStartUp = IconIsAdmin.IsChecked.Value;
|
||||||
info.StartArg = StartArg.Text;
|
info.StartArg = StartArg.Text;
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
dialog.Close();
|
dialog.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
IconInfo info = this.DataContext as IconInfo;
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -72,7 +73,7 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
IconInfo info = this.DataContext as IconInfo;
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e1)
|
catch (Exception e1)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList.Add(info);
|
MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList.Add(info);
|
||||||
}
|
}
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
dialog.Close();
|
dialog.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
IconInfo info = this.DataContext as IconInfo;
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -86,7 +86,7 @@ namespace GeekDesk.Control.Other
|
|||||||
{
|
{
|
||||||
IconInfo info = this.DataContext as IconInfo;
|
IconInfo info = this.DataContext as IconInfo;
|
||||||
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
75
Control/Other/PasswordDialog.xaml
Normal file
75
Control/Other/PasswordDialog.xaml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<Border x:Class="GeekDesk.Control.Other.PasswordDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||||
|
CornerRadius="6"
|
||||||
|
Width="300"
|
||||||
|
Height="150"
|
||||||
|
BorderThickness="0"
|
||||||
|
>
|
||||||
|
<Border.Resources>
|
||||||
|
<Style x:Key="PassBox" TargetType="PasswordBox" BasedOn="{StaticResource PasswordBoxBaseStyle}">
|
||||||
|
<Setter Property="Height" Value="40"/>
|
||||||
|
<Setter Property="Width" Value="40"/>
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||||
|
<Setter Property="FontSize" Value="18"/>
|
||||||
|
<Setter Property="Focusable" Value="True"/>
|
||||||
|
<Setter Property="MaxLength" Value="1"/>
|
||||||
|
<EventSetter Event="PasswordChanged" Handler="PasswordBox_PasswordChanged"/>
|
||||||
|
<EventSetter Event="PreviewKeyDown" Handler="PasswordBox_KeyDown"/>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="NextTB" TargetType="TextBlock">
|
||||||
|
<Setter Property="Foreground" Value="#408CCB"/>
|
||||||
|
<Setter Property="TextDecorations" Value="Underline"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Foreground" Value="Red"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Resources>
|
||||||
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="White" Opacity="0.7"/>
|
||||||
|
</Border.Background>
|
||||||
|
<StackPanel VerticalAlignment="Center">
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||||
|
<TextBlock x:Name="Title" Text="请输入密码"
|
||||||
|
FontSize="15"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<Grid Height="65" x:Name="PasswordGrid" Visibility="Visible" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
|
||||||
|
<TextBlock x:Name="HintMsg"
|
||||||
|
Visibility="Hidden"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Width="250"
|
||||||
|
TextAlignment="Center"
|
||||||
|
Margin="0,3,0,0"
|
||||||
|
Text="提示:"
|
||||||
|
hc:Poptip.Content="{Binding ElementName=HintMsg, Path=Text}"
|
||||||
|
Foreground="Gray"/>
|
||||||
|
<hc:UniformSpacingPanel Margin="0,20,0,0" Spacing="10" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||||
|
<PasswordBox x:Name="P1" Tag="P1" Style="{StaticResource PassBox}"/>
|
||||||
|
<PasswordBox x:Name="P2" Tag="P2" Style="{StaticResource PassBox}"/>
|
||||||
|
<PasswordBox x:Name="P3" Tag="P3" Style="{StaticResource PassBox}"/>
|
||||||
|
<PasswordBox x:Name="P4" Tag="P4" Style="{StaticResource PassBox}"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<TextBlock HorizontalAlignment="Right"
|
||||||
|
x:Name="ErrorMsg"
|
||||||
|
Margin="0,65,37,-65"
|
||||||
|
Foreground="Red"
|
||||||
|
Text="密码输入错误"
|
||||||
|
Visibility="Visible"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid Height="65" x:Name="HintGrid" Visibility="Collapsed" Margin="0,20,0,0" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, Event=Visibility}">
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" VerticalAlignment="Top" HorizontalAlignment="Center">
|
||||||
|
<hc:TextBox x:Name="HintBox" TextAlignment="Left" Width="220"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="202,35,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||||
|
<TextBlock Text="跳过" MouseLeftButtonDown="NextTB_MouseLeftButtonDown" Style="{StaticResource NextTB}"/>
|
||||||
|
<TextBlock Text="完成" MouseLeftButtonDown="DoneTB_MouseLeftButtonDown" Style="{StaticResource NextTB}"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
280
Control/Other/PasswordDialog.xaml.cs
Normal file
280
Control/Other/PasswordDialog.xaml.cs
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace GeekDesk.Control.Other
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TextDialog.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class PasswordDialog
|
||||||
|
{
|
||||||
|
private AppData appData = MainWindow.appData;
|
||||||
|
|
||||||
|
public PasswordType type;
|
||||||
|
public MenuInfo menuInfo;
|
||||||
|
public int count = 0;
|
||||||
|
private string tempPassword = null;
|
||||||
|
private PasswordType tempType;
|
||||||
|
public PasswordDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
PasswordBox pb = sender as PasswordBox;
|
||||||
|
if (!string.IsNullOrEmpty(pb.Password))
|
||||||
|
{
|
||||||
|
char c = pb.Password.ToCharArray()[0];
|
||||||
|
if (c > '9' || c < '0')
|
||||||
|
{
|
||||||
|
pb.Password = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string tag = pb.Tag.ToString();
|
||||||
|
switch (tag)
|
||||||
|
{
|
||||||
|
case "P1":
|
||||||
|
if (!string.IsNullOrEmpty(pb.Password))
|
||||||
|
{
|
||||||
|
P2.Focus();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "P2":
|
||||||
|
if (!string.IsNullOrEmpty(pb.Password))
|
||||||
|
{
|
||||||
|
P3.Focus();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "P3":
|
||||||
|
if (!string.IsNullOrEmpty(pb.Password))
|
||||||
|
{
|
||||||
|
P4.Focus();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "P4":
|
||||||
|
if (string.IsNullOrEmpty(pb.Password))
|
||||||
|
{
|
||||||
|
P3.Focus();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(P1.Password)
|
||||||
|
&& !string.IsNullOrEmpty(P2.Password)
|
||||||
|
&& !string.IsNullOrEmpty(P3.Password)
|
||||||
|
&& !string.IsNullOrEmpty(P4.Password))
|
||||||
|
{
|
||||||
|
string pw = P1.Password
|
||||||
|
+ P2.Password
|
||||||
|
+ P3.Password
|
||||||
|
+ P4.Password;
|
||||||
|
pw = MD5Util.CreateMD5(pw);
|
||||||
|
if (type == PasswordType.INPUT || type == PasswordType.CANCEL)
|
||||||
|
{
|
||||||
|
if (pw.Equals(appData.AppConfig.MenuPassword))
|
||||||
|
{
|
||||||
|
//隐藏弹框
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Collapsed;
|
||||||
|
//赋值
|
||||||
|
MainWindow.appData.AppConfig.SelectedMenuIcons
|
||||||
|
= appData.MenuList[
|
||||||
|
MainWindow.mainWindow.LeftCard.MenuListBox.SelectedIndex
|
||||||
|
].IconList;
|
||||||
|
//显示数据托盘
|
||||||
|
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Visible;
|
||||||
|
//取消加密操作
|
||||||
|
if (type == PasswordType.CANCEL)
|
||||||
|
{
|
||||||
|
menuInfo.IsEncrypt = false;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//密码比对不一致
|
||||||
|
ErrorMsg.Text = "密码输入错误";
|
||||||
|
ErrorMsg.Visibility = Visibility.Visible;
|
||||||
|
if (!string.IsNullOrEmpty(appData.AppConfig.PasswordHint))
|
||||||
|
{
|
||||||
|
//显示提示信息
|
||||||
|
HintMsg.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (type == PasswordType.CREATE)
|
||||||
|
{
|
||||||
|
//创建密码
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
tempPassword = pw;
|
||||||
|
Title.Text = "再次输入密码";
|
||||||
|
ClearVal();
|
||||||
|
SetFocus(0);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (tempPassword.Equals(pw))
|
||||||
|
{
|
||||||
|
//两次密码设置一致 显示提示输入框
|
||||||
|
Title.Text = "填写密码提示";
|
||||||
|
PasswordGrid.Visibility = Visibility.Collapsed;
|
||||||
|
HintGrid.Visibility = Visibility.Visible;
|
||||||
|
HintBox.Focus();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
ErrorMsg.Text = "两次密码输入不一致";
|
||||||
|
ErrorMsg.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (type == PasswordType.ALTER)
|
||||||
|
{
|
||||||
|
//修改密码
|
||||||
|
if (appData.AppConfig.MenuPassword.Equals(pw))
|
||||||
|
{
|
||||||
|
tempType = type;
|
||||||
|
type = PasswordType.CREATE;
|
||||||
|
Title.Text = "设置新密码";
|
||||||
|
ClearVal();
|
||||||
|
SetFocus(0);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//密码比对不一致
|
||||||
|
ErrorMsg.Text = "密码输入错误";
|
||||||
|
ErrorMsg.Visibility = Visibility.Visible;
|
||||||
|
HintMsg.Text = MainWindow.appData.AppConfig.PasswordHint;
|
||||||
|
HintMsg.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//密码未输入完全 隐藏错误信息
|
||||||
|
if (ErrorMsg.IsVisible)
|
||||||
|
{
|
||||||
|
ErrorMsg.Visibility = Visibility.Hidden;
|
||||||
|
HintMsg.Visibility = Visibility.Hidden;
|
||||||
|
HintMsg.Visibility = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetFocus(int time = 100)
|
||||||
|
{
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
Thread.Sleep(time);
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(P1.Password))
|
||||||
|
{
|
||||||
|
P1.Focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(P2.Password))
|
||||||
|
{
|
||||||
|
P2.Focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(P3.Password))
|
||||||
|
{
|
||||||
|
P3.Focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
P4.Focus();
|
||||||
|
});
|
||||||
|
}).Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearVal()
|
||||||
|
{
|
||||||
|
P1.Clear();
|
||||||
|
P2.Clear();
|
||||||
|
P3.Clear();
|
||||||
|
P4.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 跳过设置密码提示
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void NextTB_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
appData.AppConfig.PasswordHint = "";
|
||||||
|
DonePassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DoneTB_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
string hint = HintBox.Text.Trim();
|
||||||
|
appData.AppConfig.PasswordHint = hint;
|
||||||
|
DonePassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DonePassword()
|
||||||
|
{
|
||||||
|
appData.AppConfig.MenuPassword = tempPassword;
|
||||||
|
CommonCode.SavePassword(tempPassword);
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Collapsed;
|
||||||
|
PasswordGrid.Visibility = Visibility.Visible;
|
||||||
|
HintGrid.Visibility = Visibility.Collapsed;
|
||||||
|
if (tempType == PasswordType.ALTER)
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.Success("密码修改成功!", "MainWindowGrowl");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
menuInfo.IsEncrypt = true;
|
||||||
|
HandyControl.Controls.Growl.Success(menuInfo.MenuName + " 已加密!", "MainWindowGrowl");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PasswordBox_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Back)
|
||||||
|
{
|
||||||
|
if (P2.IsKeyboardFocused)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(P2.Password))
|
||||||
|
{
|
||||||
|
P1.Password = "";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
P2.Password = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (P3.IsKeyboardFocused)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(P3.Password))
|
||||||
|
{
|
||||||
|
P2.Password = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
P3.Password = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (P4.IsKeyboardFocused)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(P4.Password))
|
||||||
|
{
|
||||||
|
P3.Password = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
P4.Password = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetFocus(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
@@ -16,7 +17,11 @@
|
|||||||
<Grid MouseDown="DragMove">
|
<Grid MouseDown="DragMove">
|
||||||
<hc:SimplePanel Margin="20,50,20,20" >
|
<hc:SimplePanel Margin="20,50,20,20" >
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
<Image Source="/Resource/Image/About.png" Width="400" Height="100"/>
|
<Image Source="/Resource/Image/About.png"
|
||||||
|
Width="400"
|
||||||
|
Height="100"
|
||||||
|
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndContract}, Delay=250}"
|
||||||
|
/>
|
||||||
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk V"/>
|
<TextBlock x:Name="AppInfo" TextAlignment="Center" Text="Copyright © 2021 GeekDesk V"/>
|
||||||
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
|
<hc:UniformSpacingPanel Spacing="5" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Center">
|
||||||
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
||||||
|
|||||||
@@ -84,15 +84,7 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
|
||||||
<CheckBox Content="主窗口动画效果" IsChecked="{Binding AppAnimation}" Click="Animation_Checked">
|
|
||||||
<CheckBox.Background>
|
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
|
||||||
<GradientStop Color="#FF9EA3A6"/>
|
|
||||||
</LinearGradientBrush>
|
|
||||||
</CheckBox.Background>
|
|
||||||
</CheckBox>
|
|
||||||
</hc:UniformSpacingPanel>
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
|
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void HotKeyDown(object sender, KeyEventArgs e)
|
private void HotKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
Console.WriteLine("downKey:" + e.Key.ToString());
|
|
||||||
|
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
|
HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
|
||||||
@@ -50,8 +48,6 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
if (!CheckIsEnable(hkType)) return;
|
if (!CheckIsEnable(hkType)) return;
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine("prevKeyTemp:" + prevKeyTemp.ToString());
|
|
||||||
|
|
||||||
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
|
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
|
||||||
{
|
{
|
||||||
if (hotkeyFinished)
|
if (hotkeyFinished)
|
||||||
@@ -101,7 +97,6 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
appConfig.ColorPickerHotkeyModifiers = GetModifierKeys(downKey);
|
appConfig.ColorPickerHotkeyModifiers = GetModifierKeys(downKey);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Console.WriteLine("进入设置" + downKey.ToString());
|
|
||||||
prevKeyTemp = downKey;
|
prevKeyTemp = downKey;
|
||||||
keysTemp.Add(e);
|
keysTemp.Add(e);
|
||||||
}
|
}
|
||||||
@@ -119,7 +114,10 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
KeyUtil.KeyProp keyProp = new KeyUtil.KeyProp();
|
KeyUtil.KeyProp keyProp = new KeyUtil.KeyProp();
|
||||||
KeyUtil.KeyToChar(downKey, ref keyProp, true);
|
KeyUtil.KeyToChar(downKey, ref keyProp, true);
|
||||||
string downKeyStr = keyProp.character.ToString();
|
string downKeyStr = keyProp.character.ToString();
|
||||||
//string downKeyStr = "";
|
if (keyProp.character == '\x00')
|
||||||
|
{
|
||||||
|
downKeyStr = downKey.ToString();
|
||||||
|
}
|
||||||
switch (hkType)
|
switch (hkType)
|
||||||
{
|
{
|
||||||
case HotKeyType.Main:
|
case HotKeyType.Main:
|
||||||
@@ -308,15 +306,6 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Animation_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed)
|
|
||||||
{
|
|
||||||
MainWindow.mainWindow.Visibility = Visibility.Visible;
|
|
||||||
// 执行一下动画 防止太过突兀
|
|
||||||
MainWindow.FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -93,6 +93,16 @@
|
|||||||
Foreground="Black"
|
Foreground="Black"
|
||||||
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<TextBlock Text="其它" Margin="0,25,0,0"/>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
|
||||||
|
<Button Content="备份数据"
|
||||||
|
hc:Poptip.Content="当数据文件损坏时, 以便能够恢复部分数据 (损坏时将有操作提示)"
|
||||||
|
hc:Poptip.Placement="TopLeft"
|
||||||
|
hc:Poptip.Offset="10"
|
||||||
|
Style="{StaticResource Btn1}"
|
||||||
|
Click="BakDataFile"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -107,5 +107,10 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
CountLowSort.Visibility = Visibility.Visible;
|
CountLowSort.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BakDataFile(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CommonCode.BakAppData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,24 @@
|
|||||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,0,0,0" Height="20" LineStroke="Black" Grid.ColumnSpan="1"/>
|
<hc:Divider LineStrokeDashArray="3,3" Margin="0,0,0,0" Height="20" LineStroke="Black" Grid.ColumnSpan="1"/>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="5,-10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="5,-10,0,0" Grid.ColumnSpan="4">
|
||||||
|
<CheckBox Content="主窗口动画" IsChecked="{Binding AppAnimation}" Click="Animation_Checked">
|
||||||
|
<CheckBox.Background>
|
||||||
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</CheckBox.Background>
|
||||||
|
</CheckBox>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
|
||||||
|
<CheckBox Content="列表展开动画" IsChecked="{Binding ItemSpradeAnimation}">
|
||||||
|
<CheckBox.Background>
|
||||||
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</CheckBox.Background>
|
||||||
|
</CheckBox>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
|
||||||
<CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
|
<CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -120,7 +138,7 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="5,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
|
||||||
<CheckBox Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}">
|
<CheckBox Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -149,7 +167,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
<TextBlock Text="背景不透明度" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
||||||
@@ -164,7 +182,7 @@
|
|||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<!--<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
@@ -177,7 +195,7 @@
|
|||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
</hc:PreviewSlider.PreviewContent>
|
||||||
</hc:PreviewSlider>
|
</hc:PreviewSlider>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>-->
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
||||||
|
|||||||
@@ -157,5 +157,16 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
GradientBGDialog gbg = new GradientBGDialog();
|
GradientBGDialog gbg = new GradientBGDialog();
|
||||||
gbg.dialog = HandyControl.Controls.Dialog.Show(gbg, "ConfigWindowDialog");
|
gbg.dialog = HandyControl.Controls.Dialog.Show(gbg, "ConfigWindowDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Animation_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed)
|
||||||
|
{
|
||||||
|
appConfig.IsShow = true;
|
||||||
|
}
|
||||||
|
appConfig.IsShow = null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
|
xmlns:cst="clr-namespace:GeekDesk.Constant"
|
||||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
@@ -21,9 +22,15 @@
|
|||||||
<SolidColorBrush Color="Black" Opacity="0.01"/>
|
<SolidColorBrush Color="Black" Opacity="0.01"/>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
<Setter Property="AllowDrop" Value="True"/>
|
||||||
|
<EventSetter Event="Drop" Handler="Menu_Drop"/>
|
||||||
|
<EventSetter Event="PreviewDragEnter" Handler="Menu_PreviewDragEnter"/>
|
||||||
|
<EventSetter Event="PreviewDragLeave" Handler="Menu_PreviewDragLeave"/>
|
||||||
|
<EventSetter Event="MouseLeave" Handler="Menu_MouseLeave"/>
|
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
<EventSetter Event="MouseEnter" Handler="Menu_MouseEnter"/>
|
<EventSetter Event="MouseEnter" Handler="Menu_MouseEnter"/>
|
||||||
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_MouseDown"/>
|
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_MouseDown"/>
|
||||||
|
<EventSetter Event="PreviewMouseRightButtonDown" Handler="ListBoxItem_PreviewMouseRightButtonDown"/>
|
||||||
<!--<EventSetter Event="Unselected" Handler="Lbi_Unselected"/>-->
|
<!--<EventSetter Event="Unselected" Handler="Lbi_Unselected"/>-->
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<MultiTrigger>
|
<MultiTrigger>
|
||||||
@@ -71,22 +78,55 @@
|
|||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
</Trigger>-->
|
</Trigger>-->
|
||||||
<Trigger Property="IsMouseOver" Value="False">
|
<Trigger Property="IsMouseOver" Value="False">
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="#00FFFFFF"/>
|
||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
|
|
||||||
|
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style x:Key="MyPoptipStyle" TargetType="Border">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="Background" Value="White"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||||
|
<Setter Property="CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
||||||
|
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
|
||||||
|
<!--<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="hc:Poptip">
|
||||||
|
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
||||||
|
<ContentPresenter Margin="{TemplateBinding Padding}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>-->
|
||||||
|
</Style>
|
||||||
|
|
||||||
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
|
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
<Grid Background="Transparent">
|
||||||
|
<Popup Name="MyPoptip" FlowDirection="LeftToRight"
|
||||||
|
PopupAnimation="None" Placement="Mouse" IsOpen="False"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
>
|
||||||
|
<Grid Background="Transparent">
|
||||||
|
<Border Style="{StaticResource MyPoptipStyle}">
|
||||||
|
<TextBlock Name="MyPoptipContent" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" Text="Test" FontSize="14"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Popup>
|
||||||
|
|
||||||
<!--左侧栏-->
|
<!--左侧栏-->
|
||||||
<hc:Card x:Name="MyCard"
|
<hc:Card x:Name="MyCard"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
Margin="5,0,0,5"
|
Margin="5,0,0,5"
|
||||||
MouseDown="MyCard_MouseDown"
|
MouseDown="MyCard_MouseDown"
|
||||||
|
PreviewMouseRightButtonDown="MyCard_PreviewMouseRightButtonDown"
|
||||||
>
|
>
|
||||||
<hc:Card.Background>
|
<hc:Card.Background>
|
||||||
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
||||||
@@ -99,8 +139,10 @@
|
|||||||
<hc:Card.ContextMenu>
|
<hc:Card.ContextMenu>
|
||||||
<ContextMenu Width="200">
|
<ContextMenu Width="200">
|
||||||
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
||||||
|
<MenuItem x:Name="AlterPW1" Header="修改密码" Click="AlterPassword"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</hc:Card.ContextMenu>
|
</hc:Card.ContextMenu>
|
||||||
|
|
||||||
<WrapPanel Orientation="Horizontal">
|
<WrapPanel Orientation="Horizontal">
|
||||||
<ListBox x:Name="MenuListBox"
|
<ListBox x:Name="MenuListBox"
|
||||||
Padding="2,3,0,2"
|
Padding="2,3,0,2"
|
||||||
@@ -111,11 +153,14 @@
|
|||||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
SelectionChanged="Menu_SelectionChanged"
|
SelectionChanged="Menu_SelectionChanged"
|
||||||
PreviewMouseWheel="Menu_MouseWheel"
|
PreviewMouseWheel="Menu_MouseWheel"
|
||||||
|
PreviewMouseRightButtonDown="MyCard_PreviewMouseRightButtonDown"
|
||||||
>
|
>
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<ContextMenu x:Key="MenuDialog" Width="200">
|
<ContextMenu x:Key="MenuDialog" Width="200">
|
||||||
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
||||||
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
|
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
|
||||||
|
<MenuItem Header="加密此列表" Click="EncryptMenu" Tag="{Binding}"/>
|
||||||
|
<MenuItem x:Name="AlterPW2" Header="修改密码" Click="AlterPassword"/>
|
||||||
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
|
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
|
||||||
<MenuItem Header="删除" Click="DeleteMenu" Tag="{Binding}"/>
|
<MenuItem Header="删除" Click="DeleteMenu" Tag="{Binding}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
@@ -177,4 +222,5 @@
|
|||||||
</ListBox>
|
</ListBox>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using DraggAnimatedPanelExample;
|
using DraggAnimatedPanelExample;
|
||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Control.Other;
|
||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Control.Windows;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
@@ -24,9 +25,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
|
private SolidColorBrush bac = new SolidColorBrush(Color.FromRgb(236, 236, 236));
|
||||||
|
|
||||||
|
|
||||||
//是否正在修改菜单
|
|
||||||
public bool IS_EDIT = false;
|
|
||||||
|
|
||||||
public LeftCardControl()
|
public LeftCardControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -205,7 +203,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void RenameMenu(object sender, RoutedEventArgs e)
|
private void RenameMenu(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
IS_EDIT = true;
|
RunTimeStatus.IS_MENU_EDIT = true;
|
||||||
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
||||||
menuInfo.MenuEdit = (int)Visibility.Visible;
|
menuInfo.MenuEdit = (int)Visibility.Visible;
|
||||||
}
|
}
|
||||||
@@ -275,7 +273,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
menuInfo.MenuName = text;
|
menuInfo.MenuName = text;
|
||||||
menuInfo.MenuEdit = Visibility.Collapsed;
|
menuInfo.MenuEdit = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
IS_EDIT = false;
|
RunTimeStatus.IS_MENU_EDIT = false;
|
||||||
//为了解决无法修改菜单的问题
|
//为了解决无法修改菜单的问题
|
||||||
MainWindow.mainWindow.SearchBox.Focus();
|
MainWindow.mainWindow.SearchBox.Focus();
|
||||||
MenuListBox.SelectedIndex = menuSelectIndexTemp;
|
MenuListBox.SelectedIndex = menuSelectIndexTemp;
|
||||||
@@ -311,7 +309,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
|
|
||||||
private void Menu_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void Menu_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (IS_EDIT) return;
|
if (RunTimeStatus.IS_MENU_EDIT) return;
|
||||||
|
|
||||||
|
if (appData.AppConfig.ItemSpradeAnimation)
|
||||||
|
{
|
||||||
|
//是否启用列表展开动画
|
||||||
|
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
//设置对应菜单的图标列表
|
//设置对应菜单的图标列表
|
||||||
if (MenuListBox.SelectedIndex == -1)
|
if (MenuListBox.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
@@ -319,9 +324,21 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (appData.MenuList[MenuListBox.SelectedIndex].IsEncrypt)
|
||||||
|
{
|
||||||
|
appData.AppConfig.SelectedMenuIcons = null;
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入密码";
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Collapsed;
|
||||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
|
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -331,7 +348,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void Menu_MouseEnter(object sender, MouseEventArgs e)
|
private void Menu_MouseEnter(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.HoverMenu && !IS_EDIT)
|
if (appData.AppConfig.HoverMenu && !RunTimeStatus.IS_MENU_EDIT)
|
||||||
{
|
{
|
||||||
Thread t = new Thread(() =>
|
Thread t = new Thread(() =>
|
||||||
{
|
{
|
||||||
@@ -402,6 +419,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
|
|
||||||
private void Menu_MouseWheel(object sender, MouseWheelEventArgs e)
|
private void Menu_MouseWheel(object sender, MouseWheelEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (RunTimeStatus.IS_MENU_EDIT) return;
|
||||||
if (e.Delta < 0)
|
if (e.Delta < 0)
|
||||||
{
|
{
|
||||||
int index = MenuListBox.SelectedIndex;
|
int index = MenuListBox.SelectedIndex;
|
||||||
@@ -427,5 +445,134 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
MenuListBox.SelectedIndex = index;
|
MenuListBox.SelectedIndex = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Menu_PreviewDragLeave(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
MyPoptip.IsOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Menu_PreviewDragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
MenuInfo mi = (sender as ListBoxItem).DataContext as MenuInfo;
|
||||||
|
MyPoptipContent.Text = "移动至:" + mi.MenuName;
|
||||||
|
MyPoptip.VerticalOffset = 30;
|
||||||
|
MyPoptip.IsOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Menu_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
MyPoptip.IsOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Menu_Drop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
MyPoptip.IsOpen = false;
|
||||||
|
|
||||||
|
MenuInfo mi = (sender as ListBoxItem).DataContext as MenuInfo;
|
||||||
|
IconInfo iconInfo = (IconInfo)e.Data.GetData(typeof(IconInfo));
|
||||||
|
|
||||||
|
appData.MenuList[MenuListBox.SelectedIndex].IconList.Remove(iconInfo);
|
||||||
|
appData.MenuList[MenuListBox.Items.IndexOf(mi)].IconList.Add(iconInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EncryptMenu(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
||||||
|
if (menuInfo.IsEncrypt)
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.menuInfo = menuInfo;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入密码";
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.CANCEL;
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||||
|
//单独设置焦点
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.SetFocus();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.menuInfo = menuInfo;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "设置新密码";
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.CREATE;
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menuInfo.IsEncrypt = true;
|
||||||
|
HandyControl.Controls.Growl.Success(menuInfo.MenuName + " 已加密!", "MainWindowGrowl");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AlterPassword(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入旧密码";
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.ALTER;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||||
|
//单独设置焦点
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 右键点击进行处理
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void MyCard_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
RunTimeStatus.SHOW_RIGHT_BTN_MENU = true;
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
Thread.Sleep(50);
|
||||||
|
RunTimeStatus.SHOW_RIGHT_BTN_MENU = false;
|
||||||
|
}).Start();
|
||||||
|
|
||||||
|
//在没有设置密码的情况下不弹出修改密码菜单
|
||||||
|
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
|
||||||
|
{
|
||||||
|
AlterPW1.Visibility = Visibility.Collapsed;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
AlterPW1.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ListBoxItem_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ListBoxItem lbi = sender as ListBoxItem;
|
||||||
|
MenuInfo info = lbi.DataContext as MenuInfo;
|
||||||
|
|
||||||
|
ItemCollection ics = lbi.ContextMenu.Items;
|
||||||
|
|
||||||
|
foreach (object obj in ics)
|
||||||
|
{
|
||||||
|
MenuItem mi = (MenuItem)obj;
|
||||||
|
if (mi.Header.Equals("修改密码"))
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(appData.AppConfig.MenuPassword))
|
||||||
|
{
|
||||||
|
mi.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mi.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mi.Header.Equals("加密此列表") || mi.Header.Equals("取消加密此列表"))
|
||||||
|
{
|
||||||
|
if (info.IsEncrypt)
|
||||||
|
{
|
||||||
|
mi.Header = "取消加密此列表";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
mi.Header = "加密此列表";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||||
|
xmlns:ot="clr-namespace:GeekDesk.Control.Other"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
>
|
>
|
||||||
@@ -19,15 +21,6 @@
|
|||||||
</Trigger>
|
</Trigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>-->
|
</Style>-->
|
||||||
|
|
||||||
<Storyboard x:Key="Custom1Transition" x:Shared="False">
|
|
||||||
<DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
|
|
||||||
<DoubleAnimation.EasingFunction>
|
|
||||||
<ElasticEase Oscillations="1"/>
|
|
||||||
</DoubleAnimation.EasingFunction>
|
|
||||||
</DoubleAnimation>
|
|
||||||
</Storyboard>
|
|
||||||
|
|
||||||
<Style x:Key="ImageStyle" TargetType="Image">
|
<Style x:Key="ImageStyle" TargetType="Image">
|
||||||
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
||||||
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||||
@@ -46,6 +39,48 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="SearchListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||||
|
<Border>
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Storyboard x:Key="Custom1Transition1" x:Shared="False">
|
||||||
|
<DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
|
||||||
|
<DoubleAnimation.EasingFunction>
|
||||||
|
<ElasticEase Oscillations="1"/>
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
|
</Storyboard>
|
||||||
|
<Storyboard x:Key="Custom2Transition2" x:Shared="False">
|
||||||
|
<DoubleAnimation From="10" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
|
||||||
|
<DoubleAnimation.EasingFunction>
|
||||||
|
<ElasticEase Oscillations="1"/>
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
|
</Storyboard>
|
||||||
|
|
||||||
|
<Storyboard x:Key="Custom3Transition3" x:Shared="False">
|
||||||
|
<DoubleAnimation From=".8" To="1" Duration="0:0:0.4">
|
||||||
|
<DoubleAnimation.EasingFunction>
|
||||||
|
<ElasticEase Oscillations="1"/>
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
|
</Storyboard>
|
||||||
|
|
||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
<cvt:SearchResWidth x:Key="SearchResWidth"/>
|
<cvt:SearchResWidth x:Key="SearchResWidth"/>
|
||||||
<temp:SearchIconList x:Key="SearchIconList"/>
|
<temp:SearchIconList x:Key="SearchIconList"/>
|
||||||
@@ -59,7 +94,9 @@
|
|||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
Margin="5,0,5,5" Grid.ColumnSpan="2"
|
Margin="5,0,5,5" Grid.ColumnSpan="2"
|
||||||
PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown">
|
PreviewMouseRightButtonDown="WrapCard_PreviewMouseRightButtonDown"
|
||||||
|
hc:Dialog.Token="RightWrapCardDialog"
|
||||||
|
>
|
||||||
<hc:Card.Background>
|
<hc:Card.Background>
|
||||||
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||||
</hc:Card.Background>
|
</hc:Card.Background>
|
||||||
@@ -73,13 +110,23 @@
|
|||||||
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
|
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</hc:Card.ContextMenu>
|
</hc:Card.ContextMenu>
|
||||||
|
<hc:DialogContainer>
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Panel.ZIndex="1" Margin="0,-10,-300,0" hc:Growl.GrowlParent="True" hc:Growl.Token="MainWindowGrowl"/>
|
<ot:PasswordDialog xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility, Duration=50, Delay=0}"
|
||||||
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
x:Name="PDDialog"
|
||||||
|
Panel.ZIndex="99"
|
||||||
|
IsVisibleChanged="PDDialog_IsVisibleChanged"
|
||||||
|
Margin="0,-100,0,0"/>
|
||||||
|
<StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
|
||||||
|
<WrapPanel Orientation="Horizontal"
|
||||||
|
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
VirtualizingPanel.IsVirtualizing="True"
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
>
|
>
|
||||||
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
<UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
|
||||||
|
<!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
|
||||||
|
<ListBox x:Name="IconListBox"
|
||||||
|
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Padding="0,10,0,0"
|
Padding="0,10,0,0"
|
||||||
>
|
>
|
||||||
@@ -88,11 +135,12 @@
|
|||||||
</ListBox.Background>
|
</ListBox.Background>
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
|
<!--<DraggAnimatedPanel:DraggAnimatedPanel Background="#00FFFFFF"
|
||||||
ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||||
ItemsHeight="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
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}}}"/>-->
|
||||||
|
<WrapPanel />
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
@@ -116,6 +164,7 @@
|
|||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
|
||||||
<hc:SimpleStackPanel Tag="{Binding}"
|
<hc:SimpleStackPanel Tag="{Binding}"
|
||||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||||
@@ -150,10 +199,11 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
<!--</hc:TransitioningContentControl>-->
|
||||||
|
</UniformGrid>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</hc:DialogContainer>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
|
|
||||||
<hc:Card x:Name="VerticalCard"
|
<hc:Card x:Name="VerticalCard"
|
||||||
@@ -172,16 +222,17 @@
|
|||||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||||
</hc:Card.BorderBrush>
|
</hc:Card.BorderBrush>
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Panel.ZIndex="1" Margin="0,-10,-300,0" hc:Growl.GrowlParent="True" hc:Growl.Token="MainWindowGrowl"/>
|
|
||||||
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
VirtualizingPanel.IsVirtualizing="True"
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
>
|
>
|
||||||
<UniformGrid x:Name="VerticalUFG">
|
<UniformGrid x:Name="VerticalUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, OffsetY= -10, Event=Visibility}">
|
||||||
<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">
|
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
|
||||||
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Padding="0,10,0,0"
|
Padding="0,10,0,0"
|
||||||
|
x:Name="SearchListBox"
|
||||||
|
SelectionChanged="SearchListBox_SelectionChanged"
|
||||||
>
|
>
|
||||||
<ListBox.Background>
|
<ListBox.Background>
|
||||||
<SolidColorBrush Opacity="0"/>
|
<SolidColorBrush Opacity="0"/>
|
||||||
@@ -199,7 +250,7 @@
|
|||||||
</ListBox.Resources>
|
</ListBox.Resources>
|
||||||
|
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource SearchListBoxItemStyle}">
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
@@ -214,10 +265,27 @@
|
|||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
<Border CornerRadius="8">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem }}}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="Background">
|
||||||
|
<Setter.Value>
|
||||||
|
<SolidColorBrush Color="White" Opacity="0.68"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
<WrapPanel Tag="{Binding}"
|
<WrapPanel Tag="{Binding}"
|
||||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
|
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=2}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=2}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="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}"
|
||||||
@@ -225,7 +293,7 @@
|
|||||||
Background="#00FFFFFF"
|
Background="#00FFFFFF"
|
||||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||||
Margin="25,20,0,0"
|
Margin="25,10,0,10"
|
||||||
>
|
>
|
||||||
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
@@ -239,11 +307,12 @@
|
|||||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||||
Text="{Binding Name}"/>
|
Text="{Binding Name}"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|
||||||
</hc:TransitioningContentControl>
|
<!--</hc:TransitioningContentControl>-->
|
||||||
</UniformGrid>
|
</UniformGrid>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using System.Threading;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
@@ -25,68 +26,76 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
private AppData appData = MainWindow.appData;
|
private AppData appData = MainWindow.appData;
|
||||||
|
|
||||||
private volatile static bool DROP_ICON = false;
|
ListBoxDragDropManager<IconInfo> dragMgr;
|
||||||
private Thread dropCheckThread = null;
|
|
||||||
|
//private Thread dropCheckThread = null;
|
||||||
|
|
||||||
public RightCardControl()
|
public RightCardControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.Loaded += RightCardControl_Loaded;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RightCardControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.dragMgr = new ListBoxDragDropManager<IconInfo>(this.IconListBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region 图标拖动
|
//#region 图标拖动
|
||||||
DelegateCommand<int[]> _swap;
|
//DelegateCommand<int[]> _swap;
|
||||||
public DelegateCommand<int[]> SwapCommand
|
//public DelegateCommand<int[]> SwapCommand
|
||||||
{
|
//{
|
||||||
get
|
// get
|
||||||
{
|
// {
|
||||||
if (_swap == null)
|
// if (_swap == null)
|
||||||
_swap = new DelegateCommand<int[]>(
|
// _swap = new DelegateCommand<int[]>(
|
||||||
(indexes) =>
|
// (indexes) =>
|
||||||
{
|
// {
|
||||||
DROP_ICON = true;
|
// DROP_ICON = true;
|
||||||
if (appData.AppConfig.IconSortType != SortType.CUSTOM
|
// if (appData.AppConfig.IconSortType != SortType.CUSTOM
|
||||||
&& (dropCheckThread == null || !dropCheckThread.IsAlive))
|
// && (dropCheckThread == null || !dropCheckThread.IsAlive))
|
||||||
{
|
// {
|
||||||
dropCheckThread = new Thread(() =>
|
// dropCheckThread = new Thread(() =>
|
||||||
{
|
// {
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
DROP_ICON = false;
|
// DROP_ICON = false;
|
||||||
Thread.Sleep(1000);
|
// Thread.Sleep(1000);
|
||||||
} while (DROP_ICON);
|
// } while (DROP_ICON);
|
||||||
|
|
||||||
MainWindow.appData.AppConfig.IconSortType = SortType.CUSTOM;
|
// MainWindow.appData.AppConfig.IconSortType = SortType.CUSTOM;
|
||||||
App.Current.Dispatcher.Invoke(() =>
|
// App.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
// {
|
||||||
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
|
// if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
|
||||||
|| MainWindow.mainWindow.Opacity != 1)
|
// || MainWindow.mainWindow.Opacity != 1)
|
||||||
{
|
// {
|
||||||
Growl.WarningGlobal("已将图标排序规则重置为自定义!");
|
// Growl.WarningGlobal("已将图标排序规则重置为自定义!");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Growl.Warning("已将图标排序规则重置为自定义!", "MainWindowGrowl");
|
// Growl.Warning("已将图标排序规则重置为自定义!", "MainWindowGrowl");
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
dropCheckThread.Start();
|
// dropCheckThread.Start();
|
||||||
}
|
// }
|
||||||
int fromS = indexes[0];
|
// int fromS = indexes[0];
|
||||||
int to = indexes[1];
|
// int to = indexes[1];
|
||||||
ObservableCollection<IconInfo> iconList = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
// ObservableCollection<IconInfo> iconList = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
||||||
var elementSource = iconList[to];
|
// var elementSource = iconList[to];
|
||||||
var dragged = iconList[fromS];
|
// var dragged = iconList[fromS];
|
||||||
|
|
||||||
iconList.Remove(dragged);
|
// iconList.Remove(dragged);
|
||||||
iconList.Insert(to, dragged);
|
// iconList.Insert(to, dragged);
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
return _swap;
|
// return _swap;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
#endregion 图标拖动
|
//#endregion 图标拖动
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -163,8 +172,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
|
StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartIconApp(IconInfo icon, IconStartType type)
|
private void StartIconApp(IconInfo icon, IconStartType type, bool useRelativePath = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Process p = new Process())
|
using (Process p = new Process())
|
||||||
@@ -177,19 +187,36 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.StartInfo.FileName = icon.Path;
|
string path;
|
||||||
|
if (useRelativePath)
|
||||||
|
{
|
||||||
|
string fullPath = Path.Combine(Constants.APP_DIR, icon.RelativePath);
|
||||||
|
path = Path.GetFullPath(fullPath);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
path = icon.Path;
|
||||||
|
}
|
||||||
|
p.StartInfo.FileName = path;
|
||||||
if (!StringUtil.IsEmpty(startArg))
|
if (!StringUtil.IsEmpty(startArg))
|
||||||
{
|
{
|
||||||
p.StartInfo.Arguments = startArg;
|
p.StartInfo.Arguments = startArg;
|
||||||
}
|
}
|
||||||
if (icon.IconType == IconType.OTHER)
|
if (icon.IconType == IconType.OTHER)
|
||||||
{
|
{
|
||||||
if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
|
if (!File.Exists(path) && !Directory.Exists(path))
|
||||||
|
{
|
||||||
|
//如果没有使用相对路径 那么使用相对路径启动一次
|
||||||
|
if (!useRelativePath)
|
||||||
|
{
|
||||||
|
StartIconApp(icon, type, true);
|
||||||
|
return;
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p.StartInfo.WorkingDirectory = icon.Path.Substring(0, icon.Path.LastIndexOf("\\"));
|
}
|
||||||
|
p.StartInfo.WorkingDirectory = path.Substring(0, path.LastIndexOf("\\"));
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case IconStartType.ADMIN_STARTUP:
|
case IconStartType.ADMIN_STARTUP:
|
||||||
@@ -257,6 +284,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.Start();
|
p.Start();
|
||||||
|
if (useRelativePath)
|
||||||
|
{
|
||||||
|
//如果使用相对路径启动成功 那么重新设置程序绝对路径
|
||||||
|
icon.Path = path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
icon.Count++;
|
icon.Count++;
|
||||||
@@ -269,10 +301,17 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(不支持的启动方式)!");
|
if (!useRelativePath)
|
||||||
|
{
|
||||||
|
StartIconApp(icon, type, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(可能为不支持的启动方式)!");
|
||||||
LogUtil.WriteErrorLog(e, "程序启动失败:path=" + icon.Path + ",type=" + type);
|
LogUtil.WriteErrorLog(e, "程序启动失败:path=" + icon.Path + ",type=" + type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -368,7 +407,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
|
MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
|
||||||
}
|
}
|
||||||
CommonCode.SortIconList();
|
CommonCode.SortIconList();
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -405,11 +444,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
case IconType.URL:
|
case IconType.URL:
|
||||||
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog(info);
|
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog(info);
|
||||||
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "IconInfoDialog");
|
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "MainWindowDialog");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
IconInfoDialog dialog = new IconInfoDialog(info);
|
IconInfoDialog dialog = new IconInfoDialog(info);
|
||||||
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "IconInfoDialog");
|
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "MainWindowDialog");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -636,7 +675,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
private void AddUrlIcon(object sender, RoutedEventArgs e)
|
private void AddUrlIcon(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog();
|
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog();
|
||||||
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "IconInfoDialog");
|
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "MainWindowDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -716,5 +755,68 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
CardLockCM.Header = "锁定主面板";
|
CardLockCM.Header = "锁定主面板";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SearchListBoxIndexAdd()
|
||||||
|
{
|
||||||
|
if (SearchListBox.Items.Count > 0)
|
||||||
|
{
|
||||||
|
if (SearchListBox.SelectedIndex < SearchListBox.Items.Count - 1)
|
||||||
|
{
|
||||||
|
SearchListBox.SelectedIndex += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SearchListBoxIndexSub()
|
||||||
|
{
|
||||||
|
if (SearchListBox.Items.Count > 0)
|
||||||
|
{
|
||||||
|
if (SearchListBox.SelectedIndex > 0)
|
||||||
|
{
|
||||||
|
SearchListBox.SelectedIndex -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartupSelectionItem()
|
||||||
|
{
|
||||||
|
if (SearchListBox.SelectedItem != null)
|
||||||
|
{
|
||||||
|
IconInfo icon = SearchListBox.SelectedItem as IconInfo;
|
||||||
|
if (icon.AdminStartUp)
|
||||||
|
{
|
||||||
|
StartIconApp(icon, IconStartType.ADMIN_STARTUP);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SearchListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
SearchListBox.ScrollIntoView(SearchListBox.SelectedItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PDDialog_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (PDDialog.Visibility == Visibility.Visible)
|
||||||
|
{
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||||
|
PDDialog.ClearVal();
|
||||||
|
PDDialog.ErrorMsg.Visibility = Visibility.Collapsed;
|
||||||
|
PDDialog.PasswordGrid.Visibility = Visibility.Visible;
|
||||||
|
PDDialog.HintGrid.Visibility = Visibility.Collapsed;
|
||||||
|
PDDialog.count = 0;
|
||||||
|
PDDialog.SetFocus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = false;
|
||||||
|
PDDialog.ClearVal();
|
||||||
|
MainWindow.mainWindow.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace GeekDesk.Control.UserControls.SystemItem
|
|||||||
iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite);
|
iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite);
|
||||||
}
|
}
|
||||||
menuInfo.IconList.Add(iconInfo);
|
menuInfo.IconList.Add(iconInfo);
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:ToDoInfo}"
|
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"
|
||||||
xmlns:cst="clr-namespace:GeekDesk.Converts"
|
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GeekDesk.Control.Windows;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Control.Windows;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
@@ -42,7 +43,7 @@ namespace GeekDesk.Control.UserControls.Backlog
|
|||||||
{
|
{
|
||||||
MainWindow.appData.HiToDoList.Remove(info);
|
MainWindow.appData.HiToDoList.Remove(info);
|
||||||
}
|
}
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}, "DeleteConfirm");
|
}, "DeleteConfirm");
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||||
xmlns:local="clr-namespace:GeekDesk"
|
xmlns:local="clr-namespace:GeekDesk"
|
||||||
Title="Setting"
|
Title="Setting"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
@@ -109,14 +110,14 @@
|
|||||||
</hc:SideMenu>
|
</hc:SideMenu>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
<hc:ScrollViewer Grid.Row="0" Grid.Column="1" BorderThickness="0" Margin="0,5,1,5">
|
<hc:ScrollViewer Grid.Row="0" Grid.Column="1" BorderThickness="0" Margin="0,5,1,5">
|
||||||
<UniformGrid x:Name="UFG">
|
<UniformGrid x:Name="UFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeIn}, Event=Visibility, Delay=0}">
|
||||||
<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">
|
<!--<hc:TransitioningContentControl TransitionMode="Left2RightWithFade">-->
|
||||||
<hc:Card x:Name="RightCard" BorderThickness="0" MouseDown="DragMove">
|
<hc:Card x:Name="RightCard" BorderThickness="0" MouseDown="DragMove">
|
||||||
<hc:Card.Background>
|
<hc:Card.Background>
|
||||||
<SolidColorBrush Opacity="0"/>
|
<SolidColorBrush Opacity="0"/>
|
||||||
</hc:Card.Background>
|
</hc:Card.Background>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
</hc:TransitioningContentControl>
|
<!--</hc:TransitioningContentControl>-->
|
||||||
</UniformGrid>
|
</UniformGrid>
|
||||||
</hc:ScrollViewer>
|
</hc:ScrollViewer>
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ namespace GeekDesk.Control.Windows
|
|||||||
RightCard.Content = about;
|
RightCard.Content = about;
|
||||||
this.Topmost = true;
|
this.Topmost = true;
|
||||||
this.mainWindow = mainWindow;
|
this.mainWindow = mainWindow;
|
||||||
|
UFG.Visibility = Visibility.Collapsed;
|
||||||
|
UFG.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
}
|
}
|
||||||
window.Show();
|
window.Show();
|
||||||
Keyboard.Focus(window);
|
Keyboard.Focus(window);
|
||||||
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0, false);
|
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CustomButton_Click(object sender, RoutedEventArgs e)
|
private void CustomButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
}
|
}
|
||||||
window.Show();
|
window.Show();
|
||||||
Keyboard.Focus(window);
|
Keyboard.Focus(window);
|
||||||
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0, false);
|
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ namespace GeekDesk.Control.Windows
|
|||||||
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + minutes + " 分钟后提醒您!");
|
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + minutes + " 分钟后提醒您!");
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,21 @@ namespace GeekDesk.Converts
|
|||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
int val = int.Parse(value.ToString());
|
int val = int.Parse(value.ToString());
|
||||||
|
var param = 0;
|
||||||
|
if (parameter != null)
|
||||||
|
{
|
||||||
|
param = int.Parse(parameter.ToString());
|
||||||
|
}
|
||||||
|
if (val + param > 0)
|
||||||
|
{
|
||||||
|
val += param;
|
||||||
|
}
|
||||||
return new CornerRadius(val);
|
return new CornerRadius(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
Converts/ReverseBoolConvert.cs
Normal file
22
Converts/ReverseBoolConvert.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
internal class ReverseBoolConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null) return null;
|
||||||
|
bool val = (bool)value;
|
||||||
|
return !val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,10 @@ namespace GeekDesk.Converts
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if (value == null) return null;
|
if (value == null)
|
||||||
|
{
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
if (parameter == null)
|
if (parameter == null)
|
||||||
{
|
{
|
||||||
return value.ToString();
|
return value.ToString();
|
||||||
@@ -16,7 +19,14 @@ namespace GeekDesk.Converts
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
string val = value.ToString();
|
string val = value.ToString();
|
||||||
|
if (string.IsNullOrEmpty(val))
|
||||||
|
{
|
||||||
|
return parameter.ToString()
|
||||||
|
.Replace("\\n", "")
|
||||||
|
.Replace("{}", "");
|
||||||
|
}
|
||||||
string param = parameter.ToString();
|
string param = parameter.ToString();
|
||||||
|
param = param.Replace("\\n", "\n");
|
||||||
return param.Replace("{}", val);
|
return param.Replace("{}", val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace DraggAnimatedPanel
|
|||||||
#endregion
|
#endregion
|
||||||
static DraggAnimatedPanel()
|
static DraggAnimatedPanel()
|
||||||
{
|
{
|
||||||
|
|
||||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(DraggAnimatedPanel), new FrameworkPropertyMetadata(typeof(DraggAnimatedPanel)));
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DraggAnimatedPanel), new FrameworkPropertyMetadata(typeof(DraggAnimatedPanel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props" Condition="Exists('packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props')" />
|
||||||
|
<Import Project="packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props" Condition="Exists('packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props')" />
|
||||||
|
<Import Project="packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props" Condition="Exists('packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -30,6 +33,8 @@
|
|||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -44,7 +49,7 @@
|
|||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
@@ -52,6 +57,8 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<StartupObject>GeekDesk.App</StartupObject>
|
<StartupObject>GeekDesk.App</StartupObject>
|
||||||
@@ -113,12 +120,19 @@
|
|||||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive, Version=5.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Reactive.5.0.0\lib\net472\System.Reactive.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Runtime.Remoting" />
|
<Reference Include="System.Runtime.Remoting" />
|
||||||
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Web.Extensions" />
|
<Reference Include="System.Web.Extensions" />
|
||||||
|
<Reference Include="System.Windows" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@@ -132,6 +146,9 @@
|
|||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="XamlFlair.WPF, Version=1.2.13.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\XamlFlair.WPF.1.2.13\lib\net472\XamlFlair.WPF.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ApplicationDefinition Include="App.xaml">
|
<ApplicationDefinition Include="App.xaml">
|
||||||
@@ -146,12 +163,16 @@
|
|||||||
<Compile Include="Constant\IconType.cs" />
|
<Compile Include="Constant\IconType.cs" />
|
||||||
<Compile Include="Constant\CommonEnum.cs" />
|
<Compile Include="Constant\CommonEnum.cs" />
|
||||||
<Compile Include="Constant\IconStartType.cs" />
|
<Compile Include="Constant\IconStartType.cs" />
|
||||||
|
<Compile Include="Constant\PasswordType.cs" />
|
||||||
<Compile Include="Constant\RunTimeStatus.cs" />
|
<Compile Include="Constant\RunTimeStatus.cs" />
|
||||||
<Compile Include="Constant\SearchType.cs" />
|
<Compile Include="Constant\SearchType.cs" />
|
||||||
<Compile Include="Constant\SortType.cs" />
|
<Compile Include="Constant\SortType.cs" />
|
||||||
<Compile Include="Constant\TodoTaskExecType.cs" />
|
<Compile Include="Constant\TodoTaskExecType.cs" />
|
||||||
<Compile Include="Constant\BGStyle.cs" />
|
<Compile Include="Constant\BGStyle.cs" />
|
||||||
<Compile Include="Constant\UpdateType.cs" />
|
<Compile Include="Constant\UpdateType.cs" />
|
||||||
|
<Compile Include="Control\Other\GlobalMsgNotification.xaml.cs">
|
||||||
|
<DependentUpon>GlobalMsgNotification.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Control\Other\BacklogNotificatin.xaml.cs">
|
<Compile Include="Control\Other\BacklogNotificatin.xaml.cs">
|
||||||
<DependentUpon>BacklogNotificatin.xaml</DependentUpon>
|
<DependentUpon>BacklogNotificatin.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -161,6 +182,9 @@
|
|||||||
<Compile Include="Control\Other\GradientBGDialog.xaml.cs">
|
<Compile Include="Control\Other\GradientBGDialog.xaml.cs">
|
||||||
<DependentUpon>GradientBGDialog.xaml</DependentUpon>
|
<DependentUpon>GradientBGDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Control\Other\PasswordDialog.xaml.cs">
|
||||||
|
<DependentUpon>PasswordDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Control\Other\MyColorPickerDialog.xaml.cs">
|
<Compile Include="Control\Other\MyColorPickerDialog.xaml.cs">
|
||||||
<DependentUpon>MyColorPickerDialog.xaml</DependentUpon>
|
<DependentUpon>MyColorPickerDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -234,30 +258,37 @@
|
|||||||
<Compile Include="Converts\OpcityConvert.cs" />
|
<Compile Include="Converts\OpcityConvert.cs" />
|
||||||
<Compile Include="Converts\BGStyleConvert.cs" />
|
<Compile Include="Converts\BGStyleConvert.cs" />
|
||||||
<Compile Include="Converts\UpdateTypeConvert.cs" />
|
<Compile Include="Converts\UpdateTypeConvert.cs" />
|
||||||
|
<Compile Include="Converts\ReverseBoolConvert.cs" />
|
||||||
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
|
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
|
||||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
||||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
||||||
<Compile Include="Converts\HideTypeConvert.cs" />
|
<Compile Include="Converts\HideTypeConvert.cs" />
|
||||||
<Compile Include="Interface\IWindowCommon.cs" />
|
<Compile Include="Interface\IWindowCommon.cs" />
|
||||||
|
<Compile Include="MyThread\RelativePathThread.cs" />
|
||||||
<Compile Include="Task\ToDoTask.cs" />
|
<Compile Include="Task\ToDoTask.cs" />
|
||||||
<Compile Include="MyThread\MouseHookThread.cs" />
|
<Compile Include="MyThread\MouseHookThread.cs" />
|
||||||
<Compile Include="MyThread\DispatcherBuild.cs" />
|
<Compile Include="MyThread\DispatcherBuild.cs" />
|
||||||
<Compile Include="MyThread\UpdateThread.cs" />
|
<Compile Include="MyThread\UpdateThread.cs" />
|
||||||
<Compile Include="Util\AeroGlassHelper.cs" />
|
<Compile Include="Util\AeroGlassHelper.cs" />
|
||||||
<Compile Include="Util\BGSettingUtil.cs" />
|
<Compile Include="Util\BGSettingUtil.cs" />
|
||||||
|
<Compile Include="Util\BlurGlassUtil.cs" />
|
||||||
<Compile Include="Util\ColorUtil.cs" />
|
<Compile Include="Util\ColorUtil.cs" />
|
||||||
|
<Compile Include="Util\DragAdorner.cs" />
|
||||||
<Compile Include="Util\GlobalHotKey.cs" />
|
<Compile Include="Util\GlobalHotKey.cs" />
|
||||||
<Compile Include="Util\CommonCode.cs" />
|
<Compile Include="Util\CommonCode.cs" />
|
||||||
<Compile Include="Util\FileIcon.cs" />
|
<Compile Include="Util\FileIcon.cs" />
|
||||||
<Compile Include="Util\FileUtil.cs" />
|
<Compile Include="Util\FileUtil.cs" />
|
||||||
<Compile Include="Util\KeyUtil.cs" />
|
<Compile Include="Util\KeyUtil.cs" />
|
||||||
|
<Compile Include="Util\ListBoxDragDropManager.cs" />
|
||||||
<Compile Include="Util\LogUtil.cs" />
|
<Compile Include="Util\LogUtil.cs" />
|
||||||
<Compile Include="Util\MarginHide.cs" />
|
<Compile Include="Util\MarginHide.cs" />
|
||||||
<Compile Include="Util\HttpUtil.cs" />
|
<Compile Include="Util\HttpUtil.cs" />
|
||||||
<Compile Include="Util\ImageUtil.cs" />
|
<Compile Include="Util\ImageUtil.cs" />
|
||||||
<Compile Include="Converts\MenuWidthConvert.cs" />
|
<Compile Include="Converts\MenuWidthConvert.cs" />
|
||||||
|
<Compile Include="Util\MD5Util.cs" />
|
||||||
<Compile Include="Util\MouseUtil.cs" />
|
<Compile Include="Util\MouseUtil.cs" />
|
||||||
<Compile Include="Util\RegisterUtil.cs" />
|
<Compile Include="Util\RegisterUtil.cs" />
|
||||||
|
<Compile Include="Util\RelayCommand.cs" />
|
||||||
<Compile Include="Util\ShellContextMenu.cs" />
|
<Compile Include="Util\ShellContextMenu.cs" />
|
||||||
<Compile Include="Util\ShowWindowFollowMouse.cs" />
|
<Compile Include="Util\ShowWindowFollowMouse.cs" />
|
||||||
<Compile Include="Util\StringUtil.cs" />
|
<Compile Include="Util\StringUtil.cs" />
|
||||||
@@ -272,6 +303,10 @@
|
|||||||
<Compile Include="ViewModel\IconfontInfo.cs" />
|
<Compile Include="ViewModel\IconfontInfo.cs" />
|
||||||
<Compile Include="ViewModel\IconInfo.cs" />
|
<Compile Include="ViewModel\IconInfo.cs" />
|
||||||
<Compile Include="ViewModel\MenuInfo.cs" />
|
<Compile Include="ViewModel\MenuInfo.cs" />
|
||||||
|
<Page Include="Control\Other\GlobalMsgNotification.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Control\Other\BacklogNotificatin.xaml">
|
<Page Include="Control\Other\BacklogNotificatin.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -284,6 +319,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Control\Other\PasswordDialog.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Control\Other\MyColorPickerDialog.xaml">
|
<Page Include="Control\Other\MyColorPickerDialog.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@@ -384,6 +423,11 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Resource\Dictionary\XamlFlairSettings.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
@@ -475,7 +519,30 @@
|
|||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<VisualStudio>
|
||||||
<UserProperties update_1json__JsonSchema="https://typedoc.org/schema.json" />
|
<UserProperties update_1json__JsonSchema="https://beaujs.com/schema.json" />
|
||||||
</VisualStudio>
|
</VisualStudio>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props'))" />
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets'))" />
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props'))" />
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets'))" />
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props'))" />
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets" Condition="Exists('packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets')" />
|
||||||
|
<Import Project="packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets" Condition="Exists('packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets')" />
|
||||||
|
<Import Project="packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets" Condition="Exists('packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>; Move all assemblies and related files to lib folder
|
||||||
|
ROBOCOPY "$(TargetDir) " "$(TargetDir)lib\ " /XF Data *.exe *.config *.manifest /XD lib logs bak /E /IS /MOVE
|
||||||
|
if %25errorlevel%25 leq 4 exit 0 else exit %25errorlevel%25</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
xmlns:cn="clr-namespace:GeekDesk.Constant"
|
xmlns:cn="clr-namespace:GeekDesk.Constant"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
|
||||||
|
xmlns:local="clr-namespace:GeekDesk"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
x:Name="AppWindow"
|
x:Name="AppWindow"
|
||||||
@@ -17,18 +19,17 @@
|
|||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
Opacity="0"
|
Opacity="1"
|
||||||
Deactivated="AppWindow_Deactivated"
|
Deactivated="AppWindow_Deactivated"
|
||||||
SizeChanged="Window_SizeChanged"
|
SizeChanged="Window_SizeChanged"
|
||||||
KeyDown="OnKeyDown"
|
PreviewKeyDown="OnKeyDown"
|
||||||
Focusable="True"
|
Focusable="True"
|
||||||
MouseDown="MainWindow_MouseDown"
|
MouseDown="MainWindow_MouseDown"
|
||||||
MouseEnter="MainWindow_MouseEnter"
|
MouseEnter="MainWindow_MouseEnter"
|
||||||
GotFocus="Window_GotFocus"
|
GotFocus="Window_GotFocus"
|
||||||
|
Loaded="Window_Loaded"
|
||||||
>
|
>
|
||||||
<WindowChrome.WindowChrome>
|
|
||||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
|
|
||||||
</WindowChrome.WindowChrome>
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<RoutedUICommand x:Key="SearchHotKeyDown" Text="SearchHotKeyDown"/>
|
<RoutedUICommand x:Key="SearchHotKeyDown" Text="SearchHotKeyDown"/>
|
||||||
|
|
||||||
@@ -36,37 +37,38 @@
|
|||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
|
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
|
||||||
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
||||||
<Style x:Key="BorderBacStyle" TargetType="Border">
|
<cvt:ReverseBoolConvert x:Key="ReverseBoolConvert"/>
|
||||||
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
|
||||||
|
<WindowChrome.WindowChrome>
|
||||||
|
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="15"/>
|
||||||
|
</WindowChrome.WindowChrome>
|
||||||
|
|
||||||
<Window.InputBindings>
|
<Window.InputBindings>
|
||||||
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchHotKeyDown}"/>
|
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchHotKeyDown}"/>
|
||||||
</Window.InputBindings>
|
</Window.InputBindings>
|
||||||
<Window.CommandBindings>
|
<Window.CommandBindings>
|
||||||
<CommandBinding Command="{StaticResource SearchHotKeyDown}" CanExecute="SearchHotKeyDown"/>
|
<CommandBinding Command="{StaticResource SearchHotKeyDown}" CanExecute="SearchHotKeyDown"/>
|
||||||
<!--<CommandBinding Command="ChangeImgBG" Executed="ChangeImgBG_Executed" CanExecute="ChangeImgBG_CanExecute" />-->
|
|
||||||
|
|
||||||
</Window.CommandBindings>
|
</Window.CommandBindings>
|
||||||
|
|
||||||
<Window.Effect>
|
<!--Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"-->
|
||||||
|
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
|
||||||
|
BorderThickness="0"
|
||||||
|
Focusable="True"
|
||||||
|
x:Name="BGBorder"
|
||||||
|
hc:Dialog.Token="MainWindowDialog"
|
||||||
|
xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=None}"
|
||||||
|
xf:Animations.PrimaryBinding="{Binding AppConfig.IsShow, Mode=OneWay}"
|
||||||
|
xf:Animations.Secondary="{xf:Animate BasedOn={StaticResource FadeOut}, Event=None}"
|
||||||
|
xf:Animations.SecondaryBinding="{Binding AppConfig.IsShow, Mode=OneWay, Converter={StaticResource ReverseBoolConvert}}"
|
||||||
|
xf:Animations.SecondaryCompletionCommand="{Binding HideCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
|
||||||
|
xf:Animations.AllowOpacityReset="False"
|
||||||
|
>
|
||||||
|
<Border.Effect>
|
||||||
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||||
RenderingBias="Quality" ShadowDepth="2"/>
|
RenderingBias="Quality" ShadowDepth="2"/>
|
||||||
</Window.Effect>
|
</Border.Effect>
|
||||||
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
|
|
||||||
Background="AliceBlue"
|
|
||||||
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
|
|
||||||
hc:Dialog.Token="IconInfoDialog"
|
|
||||||
Focusable="True"
|
|
||||||
>
|
|
||||||
<hc:DialogContainer Focusable="True">
|
<hc:DialogContainer Focusable="True">
|
||||||
<!-- -1是为了解决圆角白线的问题-->
|
|
||||||
<Border x:Name="BGBorder"
|
|
||||||
CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
|
|
||||||
BorderThickness="0"
|
|
||||||
Margin="-1"
|
|
||||||
>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
||||||
@@ -77,9 +79,10 @@
|
|||||||
<ColumnDefinition x:Name="RightColumn" Width="*"></ColumnDefinition>
|
<ColumnDefinition x:Name="RightColumn" Width="*"></ColumnDefinition>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<!--获取焦点用-->
|
<CheckBox x:Name="ShowBox" Visibility="Hidden" Panel.ZIndex="2"/>
|
||||||
<TextBox x:Name="EmptyTextBox" Width="0"/>
|
<CheckBox x:Name="HideBox" Visibility="Hidden" Panel.ZIndex="2"/>
|
||||||
|
|
||||||
|
<StackPanel HorizontalAlignment="Right" Panel.ZIndex="99" hc:Growl.GrowlParent="False" hc:Growl.Token="MainWindowGrowl" Grid.Column="1" Grid.Row="1"/>
|
||||||
|
|
||||||
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
||||||
<DockPanel.Background>
|
<DockPanel.Background>
|
||||||
@@ -101,6 +104,7 @@
|
|||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Click="ConfigButtonClick"
|
Click="ConfigButtonClick"
|
||||||
Initialized="SettingButton_Initialized"
|
Initialized="SettingButton_Initialized"
|
||||||
|
PreviewMouseLeftButtonDown="AppButton_PreviewMouseLeftButtonDown"
|
||||||
x:Name="SettingButton"
|
x:Name="SettingButton"
|
||||||
FocusVisualStyle="{x:Null}"
|
FocusVisualStyle="{x:Null}"
|
||||||
>
|
>
|
||||||
@@ -118,10 +122,10 @@
|
|||||||
hc:IconElement.Width="18"
|
hc:IconElement.Width="18"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Click="CloseButtonClick"
|
Click="CloseButtonClick"
|
||||||
|
PreviewMouseLeftButtonDown="AppButton_PreviewMouseLeftButtonDown"
|
||||||
FocusVisualStyle="{x:Null}"
|
FocusVisualStyle="{x:Null}"
|
||||||
/>
|
/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
|
|
||||||
@@ -148,6 +152,7 @@
|
|||||||
<ContextMenu Width="130" x:Name="TaskbarContextMenu">
|
<ContextMenu Width="130" x:Name="TaskbarContextMenu">
|
||||||
<MenuItem Header="打开面板" Click="ShowApp"/>
|
<MenuItem Header="打开面板" Click="ShowApp"/>
|
||||||
<MenuItem Header="拾色器" Click="ColorPicker"/>
|
<MenuItem Header="拾色器" Click="ColorPicker"/>
|
||||||
|
<MenuItem Header="备份" Click="BakDataFile"/>
|
||||||
<MenuItem Header="隐藏图标" Click="CloseBarIcon"/>
|
<MenuItem Header="隐藏图标" Click="CloseBarIcon"/>
|
||||||
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
<MenuItem Header="待办" Click="BacklogMenuClick"/>
|
||||||
<MenuItem Header="程序目录" Click="OpenThisDir"/>
|
<MenuItem Header="程序目录" Click="OpenThisDir"/>
|
||||||
@@ -162,7 +167,6 @@
|
|||||||
|
|
||||||
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
|
||||||
</hc:DialogContainer>
|
</hc:DialogContainer>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using GeekDesk.Task;
|
|||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using GeekDesk.ViewModel.Temp;
|
using GeekDesk.ViewModel.Temp;
|
||||||
|
using Microsoft.Win32;
|
||||||
using NPinyin;
|
using NPinyin;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -16,6 +17,7 @@ using System.Threading;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using static GeekDesk.Util.ShowWindowFollowMouse;
|
using static GeekDesk.Util.ShowWindowFollowMouse;
|
||||||
@@ -37,14 +39,18 @@ namespace GeekDesk
|
|||||||
public static MainWindow mainWindow;
|
public static MainWindow mainWindow;
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
|
//加载数据
|
||||||
LoadData();
|
LoadData();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
mainWindow = this;
|
|
||||||
this.Topmost = true;
|
|
||||||
this.Loaded += Window_Loaded;
|
|
||||||
this.SizeChanged += MainWindow_Resize;
|
|
||||||
ToDoTask.BackLogCheck();
|
|
||||||
|
|
||||||
|
//用于其他类访问
|
||||||
|
mainWindow = this;
|
||||||
|
|
||||||
|
//置于顶层
|
||||||
|
this.Topmost = true;
|
||||||
|
|
||||||
|
//执行待办提醒
|
||||||
|
ToDoTask.BackLogCheck();
|
||||||
|
|
||||||
////实例化隐藏 Hide类,进行时间timer设置
|
////实例化隐藏 Hide类,进行时间timer设置
|
||||||
MarginHide.ReadyHide(this);
|
MarginHide.ReadyHide(this);
|
||||||
@@ -52,11 +58,14 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
MarginHide.StartHide();
|
MarginHide.StartHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示搜索框
|
/// 搜索快捷键按下
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
@@ -68,6 +77,9 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示搜索框
|
||||||
|
/// </summary>
|
||||||
private void ShowSearchBox()
|
private void ShowSearchBox()
|
||||||
{
|
{
|
||||||
RunTimeStatus.SEARCH_BOX_SHOW = true;
|
RunTimeStatus.SEARCH_BOX_SHOW = true;
|
||||||
@@ -117,9 +129,16 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
SearchIconList.IconList.Clear();
|
SearchIconList.IconList.Clear();
|
||||||
}
|
}
|
||||||
|
if (RightCard.SearchListBox.Items.Count > 0)
|
||||||
|
{
|
||||||
|
RightCard.SearchListBox.SelectedIndex = 0;
|
||||||
|
}
|
||||||
RightCard.VerticalUFG.Visibility = Visibility.Visible;
|
RightCard.VerticalUFG.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 隐藏搜索框
|
||||||
|
/// </summary>
|
||||||
public void HidedSearchBox()
|
public void HidedSearchBox()
|
||||||
{
|
{
|
||||||
RunTimeStatus.SEARCH_BOX_SHOW = false;
|
RunTimeStatus.SEARCH_BOX_SHOW = false;
|
||||||
@@ -159,16 +178,9 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
BGSettingUtil.BGSetting();
|
BGSettingUtil.BGSetting();
|
||||||
if (!appData.AppConfig.StartedShowPanel)
|
if (!appData.AppConfig.StartedShowPanel)
|
||||||
{
|
|
||||||
if (appData.AppConfig.AppAnimation)
|
|
||||||
{
|
|
||||||
this.Opacity = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
this.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowApp();
|
ShowApp();
|
||||||
@@ -206,6 +218,12 @@ namespace GeekDesk
|
|||||||
|
|
||||||
//更新线程开启 检测更新
|
//更新线程开启 检测更新
|
||||||
UpdateThread.Update();
|
UpdateThread.Update();
|
||||||
|
|
||||||
|
//建立相对路径
|
||||||
|
RelativePathThread.MakeRelativePath();
|
||||||
|
|
||||||
|
//毛玻璃 暂时未解决阴影问题
|
||||||
|
//BlurGlassUtil.EnableBlur(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -330,21 +348,6 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 重置窗体大小 写入缓存
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
void MainWindow_Resize(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
if (this.DataContext != null)
|
|
||||||
{
|
|
||||||
AppData appData = this.DataContext as AppData;
|
|
||||||
appData.AppConfig.WindowWidth = this.Width;
|
|
||||||
appData.AppConfig.WindowHeight = this.Height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -424,6 +427,15 @@ namespace GeekDesk
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
MainWindow.mainWindow.Activate();
|
MainWindow.mainWindow.Activate();
|
||||||
|
mainWindow.Show();
|
||||||
|
//mainWindow.Visibility = Visibility.Visible;
|
||||||
|
if (appData.AppConfig.AppAnimation)
|
||||||
|
{
|
||||||
|
appData.AppConfig.IsShow = true;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
appData.AppConfig.IsShow = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (MarginHide.ON_HIDE)
|
if (MarginHide.ON_HIDE)
|
||||||
{
|
{
|
||||||
@@ -438,35 +450,53 @@ namespace GeekDesk
|
|||||||
|
|
||||||
if (appData.AppConfig.FollowMouse)
|
if (appData.AppConfig.FollowMouse)
|
||||||
{
|
{
|
||||||
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
|
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
|
||||||
|
//FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
||||||
|
|
||||||
Keyboard.Focus(mainWindow);
|
Keyboard.Focus(mainWindow);
|
||||||
|
if (RunTimeStatus.SHOW_MENU_PASSWORDBOX)
|
||||||
|
{
|
||||||
|
mainWindow.RightCard.PDDialog.SetFocus();
|
||||||
|
} else
|
||||||
|
{
|
||||||
Keyboard.Focus(mainWindow.SearchBox);
|
Keyboard.Focus(mainWindow.SearchBox);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void HideApp()
|
public static void HideApp()
|
||||||
{
|
{
|
||||||
if (!MarginHide.IS_HIDE)
|
if (appData.AppConfig.AppAnimation)
|
||||||
|
{
|
||||||
|
appData.AppConfig.IsShow = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
appData.AppConfig.IsShow = null;
|
||||||
|
HideAppVis();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void HideAppVis()
|
||||||
{
|
{
|
||||||
//关闭锁定
|
//关闭锁定
|
||||||
RunTimeStatus.LOCK_APP_PANEL = false;
|
RunTimeStatus.LOCK_APP_PANEL = false;
|
||||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||||
{
|
{
|
||||||
mainWindow.HidedSearchBox();
|
mainWindow.HidedSearchBox();
|
||||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ShowApp();
|
|
||||||
}
|
}
|
||||||
|
mainWindow.Visibility = Visibility.Collapsed;
|
||||||
|
//if (!MarginHide.IS_HIDE)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// ShowApp();
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -677,16 +707,24 @@ namespace GeekDesk
|
|||||||
{
|
{
|
||||||
HideApp();
|
HideApp();
|
||||||
}
|
}
|
||||||
//else if (
|
|
||||||
// appData.AppConfig.SearchType == SearchType.KEY_DOWN &&
|
if (RunTimeStatus.SEARCH_BOX_SHOW && (e.Key == Key.Up
|
||||||
// (
|
|| e.Key == Key.Down
|
||||||
// (e.Key >= Key.D0 && e.Key <= Key.Z)
|
|| e.Key == Key.Tab
|
||||||
// || (e.Key >= Key.NumPad0 && e.Key < Key.NumPad9)
|
|| e.Key == Key.Enter
|
||||||
// )
|
))
|
||||||
// )
|
{
|
||||||
//{
|
if (e.Key == Key.Down || e.Key == Key.Tab)
|
||||||
// ShowSearchBox();
|
{
|
||||||
//}
|
RightCard.SearchListBoxIndexAdd();
|
||||||
|
} else if (e.Key == Key.Up)
|
||||||
|
{
|
||||||
|
RightCard.SearchListBoxIndexSub();
|
||||||
|
} else if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
RightCard.StartupSelectionItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -723,14 +761,26 @@ namespace GeekDesk
|
|||||||
GlobalColorPickerWindow.CreateNoShow();
|
GlobalColorPickerWindow.CreateNoShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Window_GotFocus(object sender, RoutedEventArgs e)
|
private void Window_GotFocus(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!LeftCard.IS_EDIT)
|
// 如果没有在修改菜单 并且不是右键点击了面板
|
||||||
|
if (!RunTimeStatus.IS_MENU_EDIT
|
||||||
|
&& !RunTimeStatus.SHOW_RIGHT_BTN_MENU
|
||||||
|
&& !RunTimeStatus.APP_BTN_IS_DOWN)
|
||||||
{
|
{
|
||||||
//if判断是为了能够使修改菜单时 菜单能够获得焦点
|
if (RunTimeStatus.SHOW_MENU_PASSWORDBOX)
|
||||||
|
{
|
||||||
|
//必须在其它文本框没有工作的时候才给密码框焦点
|
||||||
|
RightCard.PDDialog.SetFocus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//必须在其它文本框没有工作的时候才给搜索框焦点
|
||||||
Keyboard.Focus(SearchBox);
|
Keyboard.Focus(SearchBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AppWindow_Deactivated(object sender, EventArgs e)
|
private void AppWindow_Deactivated(object sender, EventArgs e)
|
||||||
@@ -738,5 +788,56 @@ namespace GeekDesk
|
|||||||
AppWindowLostFocus();
|
AppWindowLostFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备份数据文件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
[Obsolete]
|
||||||
|
private void BakDataFile(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Thread t = new Thread(() =>
|
||||||
|
{
|
||||||
|
CommonCode.BakAppData();
|
||||||
|
});
|
||||||
|
t.ApartmentState = ApartmentState.STA;
|
||||||
|
t.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AppButton_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
//点击了面板
|
||||||
|
RunTimeStatus.APP_BTN_IS_DOWN = true;
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
Thread.Sleep(50);
|
||||||
|
RunTimeStatus.APP_BTN_IS_DOWN = false;
|
||||||
|
}).Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ICommand _hideCommand;
|
||||||
|
public ICommand HideCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_hideCommand == null)
|
||||||
|
{
|
||||||
|
_hideCommand = new RelayCommand(
|
||||||
|
p =>
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
p =>
|
||||||
|
{
|
||||||
|
HideAppVis();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return _hideCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# BookerLiu
|
||||||
diff a/MainWindow.xaml b/MainWindow.xaml (rejected hunks)
|
diff a/MainWindow.xaml b/MainWindow.xaml (rejected hunks)
|
||||||
@@ -20,6 +20,7 @@
|
@@ -20,6 +20,7 @@
|
||||||
SizeChanged="Window_SizeChanged"
|
SizeChanged="Window_SizeChanged"
|
||||||
|
|||||||
42
MyThread/RelativePathThread.cs
Normal file
42
MyThread/RelativePathThread.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GeekDesk.MyThread
|
||||||
|
{
|
||||||
|
public class RelativePathThread
|
||||||
|
{
|
||||||
|
public static void MakeRelativePath()
|
||||||
|
{
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
ObservableCollection<MenuInfo> menuList = MainWindow.appData.MenuList;
|
||||||
|
|
||||||
|
string myExePath = Constants.APP_DIR + "GeekDesk.exe";
|
||||||
|
foreach (MenuInfo mi in menuList)
|
||||||
|
{
|
||||||
|
ObservableCollection<IconInfo> iconList = mi.IconList;
|
||||||
|
foreach (IconInfo icon in iconList)
|
||||||
|
{
|
||||||
|
string relativePath = FileUtil.MakeRelativePath(myExePath, icon.Path);
|
||||||
|
if (File.Exists(icon.Path)
|
||||||
|
&& !string.IsNullOrEmpty(relativePath)
|
||||||
|
&& !relativePath.Equals(icon.Path)) {
|
||||||
|
icon.RelativePath_NoWrite = relativePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_BAK_PATH);
|
||||||
|
}).Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,5 +49,5 @@ using System.Windows;
|
|||||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
//通过使用 "*",如下所示:
|
//通过使用 "*",如下所示:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.4.1.6")]
|
[assembly: AssemblyVersion("2.5.1.0")]
|
||||||
[assembly: AssemblyFileVersion("2.4.1.6")]
|
[assembly: AssemblyFileVersion("2.5.1.0")]
|
||||||
|
|||||||
7
Resource/Dictionary/XamlFlairSettings.xaml
Normal file
7
Resource/Dictionary/XamlFlairSettings.xaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF">
|
||||||
|
<!--组合动画-->
|
||||||
|
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"title": "GeekDesk版本更新",
|
"title": "GeekDesk版本更新",
|
||||||
"subTitle": "V2.4.16",
|
"subTitle": "V2.5.10",
|
||||||
"msgTitle": "本次更新内容如下",
|
"msgTitle": "本次更新内容如下",
|
||||||
"msg": "['兄弟萌求Star, 求Star, 由于功能越来越多, 之后的更新我会测试一周再发布, 尽量做到没有BUG, 见谅', '这个版本没有功能性改变, 主要是为了修复上个版本的bug', '修复无法修改菜单名称的问题', '修复通过任务栏图标打开拾色器, 图标菜单消失问题']",
|
"msg": "['依旧耗费了我大量精力开发,希望大家去给我点个免费的Star', '这个版本有一些优化点, 大家可以自行探索, 另外征集新Logo的设计, 要求美观并能体现\\'极客\\'风格','本次重新打包了程序文件(文件目录更清爽了,注意,这次不要使用覆盖升级), 可以将旧版本根目录下的Data文件复制到新版本根目录, 然后使用新版本启动','增加可拖动图标到其它菜单的功能,取消了拖动时的动画','增加了列表展开动画的开关','增加了数据备份功能','优化大部分动画','优化搜索功能(达到了可只用键盘或只用鼠标启动所需目标)','增加了相对路径(实验性,可能有bug)','增加列表加密功能(实验性,可能有bug)','其它已知问题修复']",
|
||||||
"githubUrl": "https://github.com/BookerLiu/GeekDesk/releases",
|
"githubUrl": "https://github.com/BookerLiu/GeekDesk/releases",
|
||||||
"giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases",
|
"giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases",
|
||||||
"version": "2.4.16"
|
"version": "2.5.10"
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ namespace GeekDesk.Util
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LinearGradientBrush lgb = new LinearGradientBrush();
|
LinearGradientBrush lgb = new LinearGradientBrush();
|
||||||
|
lgb.Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2));
|
||||||
GradientStop gs = new GradientStop
|
GradientStop gs = new GradientStop
|
||||||
{
|
{
|
||||||
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color1),
|
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color1),
|
||||||
|
|||||||
77
Util/BlurGlassUtil.cs
Normal file
77
Util/BlurGlassUtil.cs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class BlurGlassUtil
|
||||||
|
{
|
||||||
|
internal enum AccentState
|
||||||
|
{
|
||||||
|
ACCENT_DISABLED = 1,
|
||||||
|
ACCENT_ENABLE_GRADIENT = 0,
|
||||||
|
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
|
||||||
|
ACCENT_ENABLE_BLURBEHIND = 3,
|
||||||
|
ACCENT_INVALID_STATE = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct AccentPolicy
|
||||||
|
{
|
||||||
|
public AccentState AccentState;
|
||||||
|
public int AccentFlags;
|
||||||
|
public int GradientColor;
|
||||||
|
public int AnimationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct WindowCompositionAttributeData
|
||||||
|
{
|
||||||
|
public WindowCompositionAttribute Attribute;
|
||||||
|
public IntPtr Data;
|
||||||
|
public int SizeOfData;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal enum WindowCompositionAttribute
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
WCA_ACCENT_POLICY = 19
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
|
||||||
|
|
||||||
|
|
||||||
|
public static void EnableBlur(Window window)
|
||||||
|
{
|
||||||
|
WindowInteropHelper windowHelper = new WindowInteropHelper(window);
|
||||||
|
|
||||||
|
AccentPolicy accent = new AccentPolicy
|
||||||
|
{
|
||||||
|
AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND
|
||||||
|
};
|
||||||
|
|
||||||
|
int accentStructSize = Marshal.SizeOf(accent);
|
||||||
|
|
||||||
|
IntPtr accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||||
|
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||||
|
|
||||||
|
WindowCompositionAttributeData data = new WindowCompositionAttributeData
|
||||||
|
{
|
||||||
|
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
|
||||||
|
SizeOfData = accentStructSize,
|
||||||
|
Data = accentPtr
|
||||||
|
};
|
||||||
|
|
||||||
|
SetWindowCompositionAttribute(windowHelper.Handle, ref data);
|
||||||
|
|
||||||
|
Marshal.FreeHGlobal(accentPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
using GeekDesk.Constant;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Control.Other;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
using HandyControl.Data;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -8,6 +12,7 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using static GeekDesk.Control.Other.GlobalMsgNotification;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 提取一些代码
|
/// 提取一些代码
|
||||||
@@ -28,10 +33,11 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
using (FileStream fs = File.Create(Constants.DATA_FILE_PATH)) { }
|
using (FileStream fs = File.Create(Constants.DATA_FILE_PATH)) { }
|
||||||
appData = new AppData();
|
appData = new AppData();
|
||||||
SaveAppData(appData);
|
SaveAppData(appData, Constants.DATA_FILE_PATH);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using (FileStream fs = new FileStream(Constants.DATA_FILE_PATH, FileMode.Open))
|
using (FileStream fs = new FileStream(Constants.DATA_FILE_PATH, FileMode.Open))
|
||||||
{
|
{
|
||||||
@@ -39,21 +45,102 @@ namespace GeekDesk.Util
|
|||||||
appData = bf.Deserialize(fs) as AppData;
|
appData = bf.Deserialize(fs) as AppData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
if (File.Exists(Constants.DATA_FILE_BAK_PATH))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (FileStream fs = new FileStream(Constants.DATA_FILE_BAK_PATH, FileMode.Open))
|
||||||
|
{
|
||||||
|
BinaryFormatter bf = new BinaryFormatter();
|
||||||
|
appData = bf.Deserialize(fs) as AppData;
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogMsg msg = new DialogMsg();
|
||||||
|
msg.msg = "不幸的是, GeekDesk当前的数据文件已经损坏, " +
|
||||||
|
"现在已经启用系统自动备份的数据\n\n" +
|
||||||
|
"如果你有较新的备份, " +
|
||||||
|
"请退出GeekDesk, " +
|
||||||
|
"将备份文件重命名为:Data, " +
|
||||||
|
"然后将Data覆盖到GeekDesk的根目录即可\n\n" +
|
||||||
|
"系统上次备份时间: \n" + appData.AppConfig.SysBakTime +
|
||||||
|
"\n\n如果当前数据就是你想要的数据, 那么请不用管它";
|
||||||
|
GlobalMsgNotification gm = new GlobalMsgNotification(msg);
|
||||||
|
HandyControl.Controls.Notification ntf = HandyControl.Controls.Notification.Show(gm, ShowAnimation.Fade, true);
|
||||||
|
gm.ntf = ntf;
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MessageBox.Show("不幸的是, GeekDesk当前的数据文件已经损坏\n如果你有备份, 请将备份文件重命名为:Data 然后将Data覆盖到GeekDesk的根目录即可!");
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
return appData;
|
return appData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly static object _MyLock = new object();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存app 数据
|
/// 保存app 数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appData"></param>
|
/// <param name="appData"></param>
|
||||||
public static void SaveAppData(AppData appData)
|
public static void SaveAppData(AppData appData, string filePath)
|
||||||
{
|
{
|
||||||
using (FileStream fs = new FileStream(Constants.DATA_FILE_PATH, FileMode.Create))
|
lock (_MyLock)
|
||||||
|
{
|
||||||
|
if (filePath.Equals(Constants.DATA_FILE_BAK_PATH))
|
||||||
|
{
|
||||||
|
appData.AppConfig.SysBakTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
if (!Directory.Exists(filePath.Substring(0, filePath.LastIndexOf("\\"))))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(filePath.Substring(0, filePath.LastIndexOf("\\")));
|
||||||
|
}
|
||||||
|
using (FileStream fs = new FileStream(filePath, FileMode.Create))
|
||||||
{
|
{
|
||||||
BinaryFormatter bf = new BinaryFormatter();
|
BinaryFormatter bf = new BinaryFormatter();
|
||||||
bf.Serialize(fs, appData);
|
bf.Serialize(fs, appData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void SavePassword(string password)
|
||||||
|
{
|
||||||
|
using (StreamWriter sw = new StreamWriter(Constants.PW_FILE_BAK_PATH))
|
||||||
|
{
|
||||||
|
sw.Write(password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void BakAppData()
|
||||||
|
{
|
||||||
|
|
||||||
|
SaveFileDialog sfd = new SaveFileDialog
|
||||||
|
{
|
||||||
|
Title = "备份文件",
|
||||||
|
Filter = "bak文件(*.bak)|*.bak",
|
||||||
|
FileName = "Data-GD-" + DateTime.Now.ToString("yyMMdd") + ".bak",
|
||||||
|
};
|
||||||
|
if (sfd.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
using (FileStream fs = new FileStream(sfd.FileName, FileMode.Create))
|
||||||
|
{
|
||||||
|
BinaryFormatter bf = new BinaryFormatter();
|
||||||
|
bf.Serialize(fs, MainWindow.appData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -92,7 +179,7 @@ namespace GeekDesk.Util
|
|||||||
// ext = System.IO.Path.GetExtension(path).ToLower();
|
// ext = System.IO.Path.GetExtension(path).ToLower();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
string iconPath = null;
|
string iconPath;
|
||||||
//if (".lnk".Equals(ext))
|
//if (".lnk".Equals(ext))
|
||||||
//{
|
//{
|
||||||
|
|
||||||
@@ -111,16 +198,21 @@ namespace GeekDesk.Util
|
|||||||
BitmapImage bi = ImageUtil.GetBitmapIconByPath(iconPath);
|
BitmapImage bi = ImageUtil.GetBitmapIconByPath(iconPath);
|
||||||
IconInfo iconInfo = new IconInfo
|
IconInfo iconInfo = new IconInfo
|
||||||
{
|
{
|
||||||
Path = path,
|
Path_NoWrite = path,
|
||||||
LnkPath = tempPath,
|
LnkPath_NoWrite = tempPath,
|
||||||
BitmapImage = bi,
|
BitmapImage_NoWrite = bi,
|
||||||
StartArg = FileUtil.GetArgByLnk(tempPath)
|
StartArg_NoWrite = FileUtil.GetArgByLnk(tempPath)
|
||||||
};
|
};
|
||||||
iconInfo.DefaultImage = iconInfo.ImageByteArr;
|
iconInfo.DefaultImage_NoWrite = iconInfo.ImageByteArr;
|
||||||
iconInfo.Name = System.IO.Path.GetFileNameWithoutExtension(tempPath);
|
iconInfo.Name_NoWrite = System.IO.Path.GetFileNameWithoutExtension(tempPath);
|
||||||
if (StringUtil.IsEmpty(iconInfo.Name))
|
if (StringUtil.IsEmpty(iconInfo.Name))
|
||||||
{
|
{
|
||||||
iconInfo.Name = path;
|
iconInfo.Name_NoWrite = path;
|
||||||
|
}
|
||||||
|
string relativePath = FileUtil.MakeRelativePath(Constants.APP_DIR + "GeekDesk.exe", iconInfo.Path);
|
||||||
|
if (!string.IsNullOrEmpty(relativePath) && !relativePath.Equals(iconInfo.Path))
|
||||||
|
{
|
||||||
|
iconInfo.RelativePath_NoWrite = relativePath;
|
||||||
}
|
}
|
||||||
return iconInfo;
|
return iconInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
175
Util/DragAdorner.cs
Normal file
175
Util/DragAdorner.cs
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
// Copyright (C) Josh Smith - January 2007
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Renders a visual which can follow the mouse cursor,
|
||||||
|
/// such as during a drag-and-drop operation.
|
||||||
|
/// </summary>
|
||||||
|
public class DragAdorner : Adorner
|
||||||
|
{
|
||||||
|
#region Data
|
||||||
|
|
||||||
|
private Rectangle child = null;
|
||||||
|
private double offsetLeft = 0;
|
||||||
|
private double offsetTop = 0;
|
||||||
|
|
||||||
|
#endregion // Data
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of DragVisualAdorner.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="adornedElement">The element being adorned.</param>
|
||||||
|
/// <param name="size">The size of the adorner.</param>
|
||||||
|
/// <param name="brush">A brush to with which to paint the adorner.</param>
|
||||||
|
public DragAdorner( UIElement adornedElement, Size size, Brush brush )
|
||||||
|
: base( adornedElement )
|
||||||
|
{
|
||||||
|
Rectangle rect = new Rectangle();
|
||||||
|
rect.Fill = brush;
|
||||||
|
rect.Width = size.Width;
|
||||||
|
rect.Height = size.Height;
|
||||||
|
rect.IsHitTestVisible = false;
|
||||||
|
this.child = rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // Constructor
|
||||||
|
|
||||||
|
#region Public Interface
|
||||||
|
|
||||||
|
#region GetDesiredTransform
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="transform"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override GeneralTransform GetDesiredTransform( GeneralTransform transform )
|
||||||
|
{
|
||||||
|
GeneralTransformGroup result = new GeneralTransformGroup();
|
||||||
|
result.Children.Add( base.GetDesiredTransform( transform ) );
|
||||||
|
result.Children.Add( new TranslateTransform( this.offsetLeft, this.offsetTop ) );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // GetDesiredTransform
|
||||||
|
|
||||||
|
#region OffsetLeft
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets the horizontal offset of the adorner.
|
||||||
|
/// </summary>
|
||||||
|
public double OffsetLeft
|
||||||
|
{
|
||||||
|
get { return this.offsetLeft; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.offsetLeft = value;
|
||||||
|
UpdateLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // OffsetLeft
|
||||||
|
|
||||||
|
#region SetOffsets
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the location of the adorner in one atomic operation.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left"></param>
|
||||||
|
/// <param name="top"></param>
|
||||||
|
public void SetOffsets( double left, double top )
|
||||||
|
{
|
||||||
|
this.offsetLeft = left;
|
||||||
|
this.offsetTop = top;
|
||||||
|
this.UpdateLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // SetOffsets
|
||||||
|
|
||||||
|
#region OffsetTop
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets the vertical offset of the adorner.
|
||||||
|
/// </summary>
|
||||||
|
public double OffsetTop
|
||||||
|
{
|
||||||
|
get { return this.offsetTop; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.offsetTop = value;
|
||||||
|
UpdateLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // OffsetTop
|
||||||
|
|
||||||
|
#endregion // Public Interface
|
||||||
|
|
||||||
|
#region Protected Overrides
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="constraint"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override Size MeasureOverride( Size constraint )
|
||||||
|
{
|
||||||
|
this.child.Measure( constraint );
|
||||||
|
return this.child.DesiredSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="finalSize"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override Size ArrangeOverride( Size finalSize )
|
||||||
|
{
|
||||||
|
this.child.Arrange( new Rect( finalSize ) );
|
||||||
|
return finalSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override Visual GetVisualChild( int index )
|
||||||
|
{
|
||||||
|
return this.child;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override. Always returns 1.
|
||||||
|
/// </summary>
|
||||||
|
protected override int VisualChildrenCount
|
||||||
|
{
|
||||||
|
get { return 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // Protected Overrides
|
||||||
|
|
||||||
|
#region Private Helpers
|
||||||
|
|
||||||
|
private void UpdateLocation()
|
||||||
|
{
|
||||||
|
AdornerLayer adornerLayer = this.Parent as AdornerLayer;
|
||||||
|
if( adornerLayer != null )
|
||||||
|
adornerLayer.Update( this.AdornedElement );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // Private Helpers
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
@@ -10,16 +11,31 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
public class FileIcon
|
public class FileIcon
|
||||||
{
|
{
|
||||||
|
static List<string> blurExtsList;
|
||||||
private static List<string> GetBlurExts()
|
static List<int[]> pixelList;
|
||||||
|
static FileIcon() {
|
||||||
|
blurExtsList = new List<string>
|
||||||
{
|
{
|
||||||
List<string> list = new List<string>();
|
".exe",
|
||||||
list.Add(".exe");
|
".cer",
|
||||||
list.Add(".cer");
|
".lnk",
|
||||||
list.Add(".lnk");
|
".chm"
|
||||||
return list;
|
};
|
||||||
|
pixelList = new List<int[]>
|
||||||
|
{
|
||||||
|
new int[]{ 256 / 4, 256 / 4 },
|
||||||
|
new int[]{ 256 / 2, 256 / 4 },
|
||||||
|
new int[]{ 256 / 4 * 3, 256 / 4 },
|
||||||
|
new int[]{ 256 / 4, 256 / 2 },
|
||||||
|
new int[]{ 256 / 4, 256 / 4 * 3 },
|
||||||
|
new int[]{ 256 / 4 * 3, 256 / 2 },
|
||||||
|
new int[]{ 256 / 4 * 3, 256 / 4 * 3 },
|
||||||
|
new int[]{ 256 / 2, 256 / 4 * 3 },
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[DllImport("User32.dll")]
|
[DllImport("User32.dll")]
|
||||||
public static extern int PrivateExtractIcons(
|
public static extern int PrivateExtractIcons(
|
||||||
string lpszFile, //文件名可以是exe,dll,ico,cur,ani,bmp
|
string lpszFile, //文件名可以是exe,dll,ico,cur,ani,bmp
|
||||||
@@ -53,7 +69,7 @@ namespace GeekDesk.Util
|
|||||||
ip = hIcons[0];
|
ip = hIcons[0];
|
||||||
ico = Icon.FromHandle(ip);
|
ico = Icon.FromHandle(ip);
|
||||||
}
|
}
|
||||||
else if (GetBlurExts().Contains(ext))
|
else if (blurExtsList.Contains(ext))
|
||||||
{
|
{
|
||||||
ico = Icon.ExtractAssociatedIcon(filePath);
|
ico = Icon.ExtractAssociatedIcon(filePath);
|
||||||
}
|
}
|
||||||
@@ -61,7 +77,13 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
ip = GetJumboIcon(GetIconIndex(filePath));
|
ip = GetJumboIcon(GetIconIndex(filePath));
|
||||||
ico = Icon.FromHandle(ip);
|
ico = Icon.FromHandle(ip);
|
||||||
|
if (CheckIsSmallIco(ico.ToBitmap()))
|
||||||
|
{
|
||||||
|
ico = Icon.ExtractAssociatedIcon(filePath);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Bitmap bmp = ico.ToBitmap();
|
Bitmap bmp = ico.ToBitmap();
|
||||||
MemoryStream strm = new MemoryStream();
|
MemoryStream strm = new MemoryStream();
|
||||||
@@ -73,6 +95,7 @@ namespace GeekDesk.Util
|
|||||||
myEncoderParameters.Param[0] = myEncoderParameter;
|
myEncoderParameters.Param[0] = myEncoderParameter;
|
||||||
|
|
||||||
bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
|
bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
|
||||||
|
|
||||||
BitmapImage bmpImage = new BitmapImage();
|
BitmapImage bmpImage = new BitmapImage();
|
||||||
bmpImage.BeginInit();
|
bmpImage.BeginInit();
|
||||||
strm.Seek(0, SeekOrigin.Begin);
|
strm.Seek(0, SeekOrigin.Begin);
|
||||||
@@ -82,6 +105,7 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
Shell32.DestroyIcon(ip);
|
Shell32.DestroyIcon(ip);
|
||||||
}
|
}
|
||||||
|
DeleteObject(bmp.GetHbitmap());
|
||||||
return bmpImage.Clone();
|
return bmpImage.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +122,30 @@ namespace GeekDesk.Util
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool CheckIsSmallIco(Bitmap bm)
|
||||||
|
{
|
||||||
|
Color color;
|
||||||
|
int count = 0;
|
||||||
|
foreach (int[] arr in pixelList)
|
||||||
|
{
|
||||||
|
color = bm.GetPixel(arr[0], arr[1]);
|
||||||
|
if (color.A == 0)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DeleteObject(bm.GetHbitmap());
|
||||||
|
if (count >= 6)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
|
||||||
|
public static extern bool DeleteObject(IntPtr onj);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static int GetIconIndex(string pszFile)
|
public static int GetIconIndex(string pszFile)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using IWshRuntimeLibrary;
|
using IWshRuntimeLibrary;
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -156,5 +157,20 @@ namespace GeekDesk.Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string MakeRelativePath(string fromPath, string toPath)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(toPath) || string.IsNullOrEmpty(fromPath)) return null;
|
||||||
|
Uri file = new Uri(@toPath);
|
||||||
|
// Must end in a slash to indicate folder
|
||||||
|
Uri folder = new Uri(@fromPath);
|
||||||
|
string relativePath =
|
||||||
|
Uri.UnescapeDataString(
|
||||||
|
folder.MakeRelativeUri(file)
|
||||||
|
.ToString()
|
||||||
|
.Replace('/', Path.DirectorySeparatorChar)
|
||||||
|
);
|
||||||
|
return relativePath;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
892
Util/ListBoxDragDropManager.cs
Normal file
892
Util/ListBoxDragDropManager.cs
Normal file
@@ -0,0 +1,892 @@
|
|||||||
|
// Copyright (C) Josh Smith - January 2007
|
||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using GeekDesk.Util;
|
||||||
|
using GeekDesk.Constant;
|
||||||
|
using HandyControl.Controls;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
#region ListBoxDragDropManager
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Manages the dragging and dropping of ListBoxItems in a ListBox.
|
||||||
|
/// The ItemType type parameter indicates the type of the objects in
|
||||||
|
/// the ListBox's items source. The ListBox's ItemsSource must be
|
||||||
|
/// set to an instance of ObservableCollection of ItemType, or an
|
||||||
|
/// Exception will be thrown.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="ItemType">The type of the ListBox's items.</typeparam>
|
||||||
|
public class ListBoxDragDropManager<ItemType> where ItemType : class
|
||||||
|
{
|
||||||
|
#region Data
|
||||||
|
|
||||||
|
bool canInitiateDrag;
|
||||||
|
DragAdorner dragAdorner;
|
||||||
|
double dragAdornerOpacity;
|
||||||
|
int indexToSelect;
|
||||||
|
bool isDragInProgress;
|
||||||
|
ItemType itemUnderDragCursor;
|
||||||
|
ListBox listBox;
|
||||||
|
Point ptMouseDown;
|
||||||
|
bool showDragAdorner;
|
||||||
|
|
||||||
|
#endregion // Data
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of ListBoxDragManager.
|
||||||
|
/// </summary>
|
||||||
|
public ListBoxDragDropManager()
|
||||||
|
{
|
||||||
|
this.canInitiateDrag = false;
|
||||||
|
this.dragAdornerOpacity = 0.7;
|
||||||
|
this.indexToSelect = -1;
|
||||||
|
this.showDragAdorner = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of ListBoxDragManager.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="listBox"></param>
|
||||||
|
public ListBoxDragDropManager( ListBox listBox )
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
this.ListBox = listBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of ListBoxDragManager.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="listBox"></param>
|
||||||
|
/// <param name="dragAdornerOpacity"></param>
|
||||||
|
public ListBoxDragDropManager( ListBox listBox, double dragAdornerOpacity )
|
||||||
|
: this( listBox )
|
||||||
|
{
|
||||||
|
this.DragAdornerOpacity = dragAdornerOpacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of ListBoxDragManager.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="listBox"></param>
|
||||||
|
/// <param name="showDragAdorner"></param>
|
||||||
|
public ListBoxDragDropManager( ListBox listBox, bool showDragAdorner )
|
||||||
|
: this( listBox )
|
||||||
|
{
|
||||||
|
this.ShowDragAdorner = showDragAdorner;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // Constructors
|
||||||
|
|
||||||
|
#region Public Interface
|
||||||
|
|
||||||
|
#region DragAdornerOpacity
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets the opacity of the drag adorner. This property has no
|
||||||
|
/// effect if ShowDragAdorner is false. The default value is 0.7
|
||||||
|
/// </summary>
|
||||||
|
public double DragAdornerOpacity
|
||||||
|
{
|
||||||
|
get { return this.dragAdornerOpacity; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if( this.IsDragInProgress )
|
||||||
|
throw new InvalidOperationException( "Cannot set the DragAdornerOpacity property during a drag operation." );
|
||||||
|
|
||||||
|
if( value < 0.0 || value > 1.0 )
|
||||||
|
throw new ArgumentOutOfRangeException( "DragAdornerOpacity", value, "Must be between 0 and 1." );
|
||||||
|
|
||||||
|
this.dragAdornerOpacity = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // DragAdornerOpacity
|
||||||
|
|
||||||
|
#region IsDragInProgress
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if there is currently a drag operation being managed.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDragInProgress
|
||||||
|
{
|
||||||
|
get { return this.isDragInProgress; }
|
||||||
|
private set { this.isDragInProgress = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // IsDragInProgress
|
||||||
|
|
||||||
|
#region ListBox
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets the ListBox whose dragging is managed. This property
|
||||||
|
/// can be set to null, to prevent drag management from occuring. If
|
||||||
|
/// the ListBox's AllowDrop property is false, it will be set to true.
|
||||||
|
/// </summary>
|
||||||
|
public ListBox ListBox
|
||||||
|
{
|
||||||
|
get { return listBox; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if( this.IsDragInProgress )
|
||||||
|
throw new InvalidOperationException( "Cannot set the ListBox property during a drag operation." );
|
||||||
|
|
||||||
|
if( this.listBox != null )
|
||||||
|
{
|
||||||
|
#region Unhook Events
|
||||||
|
|
||||||
|
this.listBox.PreviewMouseLeftButtonDown -= LIstBox_PreviewMouseLeftButtonDown;
|
||||||
|
this.listBox.PreviewMouseMove -= LIstBox_PreviewMouseMove;
|
||||||
|
this.listBox.DragOver -= LIstBox_DragOver;
|
||||||
|
this.listBox.DragLeave -= LIstBox_DragLeave;
|
||||||
|
this.listBox.DragEnter -= LIstBox_DragEnter;
|
||||||
|
this.listBox.Drop -= LIstBox_Drop;
|
||||||
|
|
||||||
|
#endregion // Unhook Events
|
||||||
|
}
|
||||||
|
|
||||||
|
this.listBox = value;
|
||||||
|
|
||||||
|
if( this.listBox != null )
|
||||||
|
{
|
||||||
|
if( !this.listBox.AllowDrop )
|
||||||
|
this.listBox.AllowDrop = true;
|
||||||
|
|
||||||
|
#region Hook Events
|
||||||
|
|
||||||
|
this.listBox.PreviewMouseLeftButtonDown += LIstBox_PreviewMouseLeftButtonDown;
|
||||||
|
this.listBox.PreviewMouseMove += LIstBox_PreviewMouseMove;
|
||||||
|
this.listBox.DragOver += LIstBox_DragOver;
|
||||||
|
this.listBox.DragLeave += LIstBox_DragLeave;
|
||||||
|
this.listBox.DragEnter += LIstBox_DragEnter;
|
||||||
|
this.listBox.Drop += LIstBox_Drop;
|
||||||
|
|
||||||
|
#endregion // Hook Events
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // ListBox
|
||||||
|
|
||||||
|
#region ProcessDrop [event]
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised when a drop occurs. By default the dropped item will be moved
|
||||||
|
/// to the target index. Handle this event if relocating the dropped item
|
||||||
|
/// requires custom behavior. Note, if this event is handled the default
|
||||||
|
/// item dropping logic will not occur.
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler<ProcessDropEventArgs<ItemType>> ProcessDrop;
|
||||||
|
|
||||||
|
#endregion // ProcessDrop [event]
|
||||||
|
|
||||||
|
#region ShowDragAdorner
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets whether a visual representation of the ListBoxItem being dragged
|
||||||
|
/// follows the mouse cursor during a drag operation. The default value is true.
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowDragAdorner
|
||||||
|
{
|
||||||
|
get { return this.showDragAdorner; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if( this.IsDragInProgress )
|
||||||
|
throw new InvalidOperationException( "Cannot set the ShowDragAdorner property during a drag operation." );
|
||||||
|
|
||||||
|
this.showDragAdorner = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // ShowDragAdorner
|
||||||
|
|
||||||
|
#endregion // Public Interface
|
||||||
|
|
||||||
|
#region Event Handling Methods
|
||||||
|
|
||||||
|
#region LIstBox_PreviewMouseLeftButtonDown
|
||||||
|
|
||||||
|
void LIstBox_PreviewMouseLeftButtonDown( object sender, MouseButtonEventArgs e )
|
||||||
|
{
|
||||||
|
if( this.IsMouseOverScrollbar )
|
||||||
|
{
|
||||||
|
// 4/13/2007 - Set the flag to false when cursor is over scrollbar.
|
||||||
|
this.canInitiateDrag = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = this.IndexUnderDragCursor;
|
||||||
|
this.canInitiateDrag = index > -1;
|
||||||
|
|
||||||
|
if( this.canInitiateDrag )
|
||||||
|
{
|
||||||
|
// Remember the location and index of the ListBoxItem the user clicked on for later.
|
||||||
|
this.ptMouseDown = MouseUtil.GetMousePosition();
|
||||||
|
//this.ptMouseDown = MouseUtil.GetMousePosition( this.listBox );
|
||||||
|
this.indexToSelect = index;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.ptMouseDown = new Point( -10000, -10000 );
|
||||||
|
this.indexToSelect = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // LIstBox_PreviewMouseLeftButtonDown
|
||||||
|
|
||||||
|
#region LIstBox_PreviewMouseMove
|
||||||
|
|
||||||
|
void LIstBox_PreviewMouseMove( object sender, MouseEventArgs e )
|
||||||
|
{
|
||||||
|
if( !this.CanStartDragOperation )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Select the item the user clicked on.
|
||||||
|
if( this.listBox.SelectedIndex != this.indexToSelect )
|
||||||
|
this.listBox.SelectedIndex = this.indexToSelect;
|
||||||
|
|
||||||
|
// If the item at the selected index is null, there's nothing
|
||||||
|
// we can do, so just return;
|
||||||
|
if( this.listBox.SelectedItem == null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
ListBoxItem itemToDrag = this.GetListBoxItem( this.listBox.SelectedIndex );
|
||||||
|
if( itemToDrag == null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
AdornerLayer adornerLayer = this.ShowDragAdornerResolved ? this.InitializeAdornerLayer( itemToDrag ) : null;
|
||||||
|
|
||||||
|
this.InitializeDragOperation( itemToDrag );
|
||||||
|
this.PerformDragOperation();
|
||||||
|
this.FinishDragOperation( itemToDrag, adornerLayer );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // LIstBox_PreviewMouseMove
|
||||||
|
|
||||||
|
#region LIstBox_DragOver
|
||||||
|
|
||||||
|
void LIstBox_DragOver( object sender, DragEventArgs e )
|
||||||
|
{
|
||||||
|
e.Effects = DragDropEffects.Move;
|
||||||
|
|
||||||
|
if ( this.ShowDragAdornerResolved )
|
||||||
|
this.UpdateDragAdornerLocation();
|
||||||
|
|
||||||
|
// Update the item which is known to be currently under the drag cursor.
|
||||||
|
int index = this.IndexUnderDragCursor;
|
||||||
|
this.ItemUnderDragCursor = index < 0 ? null : this.ListBox.Items[index] as ItemType;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // LIstBox_DragOver
|
||||||
|
|
||||||
|
#region LIstBox_DragLeave
|
||||||
|
|
||||||
|
void LIstBox_DragLeave( object sender, DragEventArgs e )
|
||||||
|
{
|
||||||
|
if( !this.IsMouseOver( this.listBox ) )
|
||||||
|
{
|
||||||
|
if( this.ItemUnderDragCursor != null )
|
||||||
|
this.ItemUnderDragCursor = null;
|
||||||
|
|
||||||
|
if( this.dragAdorner != null )
|
||||||
|
this.dragAdorner.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // LIstBox_DragLeave
|
||||||
|
|
||||||
|
#region LIstBox_DragEnter
|
||||||
|
|
||||||
|
void LIstBox_DragEnter( object sender, DragEventArgs e )
|
||||||
|
{
|
||||||
|
if( this.dragAdorner != null && this.dragAdorner.Visibility != Visibility.Visible )
|
||||||
|
{
|
||||||
|
// Update the location of the adorner and then show it.
|
||||||
|
this.UpdateDragAdornerLocation();
|
||||||
|
this.dragAdorner.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // LIstBox_DragEnter
|
||||||
|
|
||||||
|
#region LIstBox_Drop
|
||||||
|
|
||||||
|
void LIstBox_Drop( object sender, DragEventArgs e )
|
||||||
|
{
|
||||||
|
if( this.ItemUnderDragCursor != null )
|
||||||
|
this.ItemUnderDragCursor = null;
|
||||||
|
|
||||||
|
e.Effects = DragDropEffects.None;
|
||||||
|
|
||||||
|
if( !e.Data.GetDataPresent( typeof( ItemType ) ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Get the data object which was dropped.
|
||||||
|
ItemType data = e.Data.GetData( typeof( ItemType ) ) as ItemType;
|
||||||
|
if( data == null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Get the ObservableCollection<ItemType> which contains the dropped data object.
|
||||||
|
ObservableCollection<ItemType> itemsSource = this.listBox.ItemsSource as ObservableCollection<ItemType>;
|
||||||
|
if( itemsSource == null )
|
||||||
|
throw new Exception(
|
||||||
|
"A ListBox managed by ListBoxDragManager must have its ItemsSource set to an ObservableCollection<ItemType>." );
|
||||||
|
|
||||||
|
int oldIndex = itemsSource.IndexOf( data );
|
||||||
|
int newIndex = this.IndexUnderDragCursor;
|
||||||
|
|
||||||
|
if( newIndex < 0 )
|
||||||
|
{
|
||||||
|
// The drag started somewhere else, and our ListBox is empty
|
||||||
|
// so make the new item the first in the list.
|
||||||
|
if( itemsSource.Count == 0 )
|
||||||
|
newIndex = 0;
|
||||||
|
|
||||||
|
// The drag started somewhere else, but our ListBox has items
|
||||||
|
// so make the new item the last in the list.
|
||||||
|
else if( oldIndex < 0 )
|
||||||
|
newIndex = itemsSource.Count;
|
||||||
|
|
||||||
|
// The user is trying to drop an item from our ListBox into
|
||||||
|
// our ListBox, but the mouse is not over an item, so don't
|
||||||
|
// let them drop it.
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dropping an item back onto itself is not considered an actual 'drop'.
|
||||||
|
if( oldIndex == newIndex )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( this.ProcessDrop != null )
|
||||||
|
{
|
||||||
|
// Let the client code process the drop.
|
||||||
|
ProcessDropEventArgs<ItemType> args = new ProcessDropEventArgs<ItemType>( itemsSource, data, oldIndex, newIndex, e.AllowedEffects );
|
||||||
|
this.ProcessDrop( this, args );
|
||||||
|
e.Effects = args.Effects;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Move the dragged data object from it's original index to the
|
||||||
|
// new index (according to where the mouse cursor is). If it was
|
||||||
|
// not previously in the ListBox, then insert the item.
|
||||||
|
if( oldIndex > -1 )
|
||||||
|
{
|
||||||
|
// <20>ⲿҵ<E2B2BF><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
itemsSource.Move(oldIndex, newIndex);
|
||||||
|
if (MainWindow.appData.AppConfig.IconSortType != SortType.CUSTOM)
|
||||||
|
{
|
||||||
|
MainWindow.appData.AppConfig.IconSortType = SortType.CUSTOM;
|
||||||
|
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
|
||||||
|
|| MainWindow.mainWindow.Opacity != 1)
|
||||||
|
{
|
||||||
|
Growl.WarningGlobal("<22>ѽ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Growl.Warning("<22>ѽ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>!", "MainWindowGrowl");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemsSource.Insert(newIndex, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the Effects property so that the call to DoDragDrop will return 'Move'.
|
||||||
|
e.Effects = DragDropEffects.Move;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // LIstBox_Drop
|
||||||
|
|
||||||
|
#endregion // Event Handling Methods
|
||||||
|
|
||||||
|
#region Private Helpers
|
||||||
|
|
||||||
|
#region CanStartDragOperation
|
||||||
|
|
||||||
|
bool CanStartDragOperation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if( Mouse.LeftButton != MouseButtonState.Pressed )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( !this.canInitiateDrag )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( this.indexToSelect == -1 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( !this.HasCursorLeftDragThreshold )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // CanStartDragOperation
|
||||||
|
|
||||||
|
#region FinishDragOperation
|
||||||
|
|
||||||
|
void FinishDragOperation( ListBoxItem draggedItem, AdornerLayer adornerLayer )
|
||||||
|
{
|
||||||
|
// Let the ListBoxItem know that it is not being dragged anymore.
|
||||||
|
ListBoxItemDragState.SetIsBeingDragged( draggedItem, false );
|
||||||
|
|
||||||
|
this.IsDragInProgress = false;
|
||||||
|
|
||||||
|
if( this.ItemUnderDragCursor != null )
|
||||||
|
this.ItemUnderDragCursor = null;
|
||||||
|
|
||||||
|
// Remove the drag adorner from the adorner layer.
|
||||||
|
if( adornerLayer != null )
|
||||||
|
{
|
||||||
|
adornerLayer.Remove( this.dragAdorner );
|
||||||
|
this.dragAdorner = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // FinishDragOperation
|
||||||
|
|
||||||
|
#region GetListBoxItem
|
||||||
|
|
||||||
|
ListBoxItem GetListBoxItem( int index )
|
||||||
|
{
|
||||||
|
if( this.listBox.ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return this.listBox.ItemContainerGenerator.ContainerFromIndex( index ) as ListBoxItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
ListBoxItem GetListBoxItem( ItemType dataItem )
|
||||||
|
{
|
||||||
|
if( this.listBox.ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return this.listBox.ItemContainerGenerator.ContainerFromItem( dataItem ) as ListBoxItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // GetListBoxItem
|
||||||
|
|
||||||
|
#region HasCursorLeftDragThreshold
|
||||||
|
|
||||||
|
bool HasCursorLeftDragThreshold
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if( this.indexToSelect < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ListBoxItem item = this.GetListBoxItem( this.indexToSelect );
|
||||||
|
Rect bounds = VisualTreeHelper.GetDescendantBounds( item );
|
||||||
|
Point ptInItem = this.listBox.TranslatePoint( this.ptMouseDown, item );
|
||||||
|
|
||||||
|
// In case the cursor is at the very top or bottom of the ListBoxItem
|
||||||
|
// we want to make the vertical threshold very small so that dragging
|
||||||
|
// over an adjacent item does not select it.
|
||||||
|
double topOffset = Math.Abs( ptInItem.Y );
|
||||||
|
double btmOffset = Math.Abs( bounds.Height - ptInItem.Y );
|
||||||
|
double vertOffset = Math.Min( topOffset, btmOffset );
|
||||||
|
|
||||||
|
double width = SystemParameters.MinimumHorizontalDragDistance * 2;
|
||||||
|
double height = Math.Min( SystemParameters.MinimumVerticalDragDistance, vertOffset ) * 2;
|
||||||
|
Size szThreshold = new Size( width, height );
|
||||||
|
|
||||||
|
Rect rect = new Rect( this.ptMouseDown, szThreshold );
|
||||||
|
rect.Offset( szThreshold.Width / -2, szThreshold.Height / -2 );
|
||||||
|
//Point ptInListBox = MouseUtil.GetMousePosition(this.listBox);
|
||||||
|
Point ptInListBox = MouseUtil.GetMousePosition();
|
||||||
|
return !rect.Contains( ptInListBox );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // HasCursorLeftDragThreshold
|
||||||
|
|
||||||
|
#region IndexUnderDragCursor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the index of the ListBoxItem underneath the
|
||||||
|
/// drag cursor, or -1 if the cursor is not over an item.
|
||||||
|
/// </summary>
|
||||||
|
int IndexUnderDragCursor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
for( int i = 0; i < this.listBox.Items.Count; ++i )
|
||||||
|
{
|
||||||
|
ListBoxItem item = this.GetListBoxItem( i );
|
||||||
|
if( this.IsMouseOver( item ) )
|
||||||
|
{
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // IndexUnderDragCursor
|
||||||
|
|
||||||
|
#region InitializeAdornerLayer
|
||||||
|
|
||||||
|
AdornerLayer InitializeAdornerLayer( ListBoxItem itemToDrag )
|
||||||
|
{
|
||||||
|
// Create a brush which will paint the ListBoxItem onto
|
||||||
|
// a visual in the adorner layer.
|
||||||
|
VisualBrush brush = new VisualBrush( itemToDrag );
|
||||||
|
|
||||||
|
// Create an element which displays the source item while it is dragged.
|
||||||
|
this.dragAdorner = new DragAdorner( this.listBox, itemToDrag.RenderSize, brush );
|
||||||
|
|
||||||
|
// Set the drag adorner's opacity.
|
||||||
|
this.dragAdorner.Opacity = this.DragAdornerOpacity;
|
||||||
|
|
||||||
|
AdornerLayer layer = AdornerLayer.GetAdornerLayer( this.listBox );
|
||||||
|
layer.Add( dragAdorner );
|
||||||
|
|
||||||
|
// Save the location of the cursor when the left mouse button was pressed.
|
||||||
|
this.ptMouseDown = MouseUtil.GetMousePosition(this.listBox);
|
||||||
|
//this.ptMouseDown = MouseUtil.GetMousePosition();
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // InitializeAdornerLayer
|
||||||
|
|
||||||
|
#region InitializeDragOperation
|
||||||
|
|
||||||
|
void InitializeDragOperation( ListBoxItem itemToDrag )
|
||||||
|
{
|
||||||
|
// Set some flags used during the drag operation.
|
||||||
|
this.IsDragInProgress = true;
|
||||||
|
this.canInitiateDrag = false;
|
||||||
|
|
||||||
|
// Let the ListBoxItem know that it is being dragged.
|
||||||
|
ListBoxItemDragState.SetIsBeingDragged( itemToDrag, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // InitializeDragOperation
|
||||||
|
|
||||||
|
#region IsMouseOver
|
||||||
|
|
||||||
|
bool IsMouseOver( Visual target )
|
||||||
|
{
|
||||||
|
// We need to use MouseUtil to figure out the cursor
|
||||||
|
// coordinates because, during a drag-drop operation, the WPF
|
||||||
|
// mechanisms for getting the coordinates behave strangely.
|
||||||
|
|
||||||
|
Rect bounds = VisualTreeHelper.GetDescendantBounds( target );
|
||||||
|
Point mousePos = MouseUtil.GetMousePosition( target );
|
||||||
|
return bounds.Contains( mousePos );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // IsMouseOver
|
||||||
|
|
||||||
|
#region IsMouseOverScrollbar
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the mouse cursor is over a scrollbar in the ListBox.
|
||||||
|
/// </summary>
|
||||||
|
bool IsMouseOverScrollbar
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Point ptMouse = MouseUtil.GetMousePosition( this.listBox );
|
||||||
|
HitTestResult res = VisualTreeHelper.HitTest( this.listBox, ptMouse );
|
||||||
|
if( res == null )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
DependencyObject depObj = res.VisualHit;
|
||||||
|
while( depObj != null )
|
||||||
|
{
|
||||||
|
if( depObj is ScrollBar )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// VisualTreeHelper works with objects of type Visual or Visual3D.
|
||||||
|
// If the current object is not derived from Visual or Visual3D,
|
||||||
|
// then use the LogicalTreeHelper to find the parent element.
|
||||||
|
if( depObj is Visual || depObj is System.Windows.Media.Media3D.Visual3D )
|
||||||
|
depObj = VisualTreeHelper.GetParent( depObj );
|
||||||
|
else
|
||||||
|
depObj = LogicalTreeHelper.GetParent( depObj );
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // IsMouseOverScrollbar
|
||||||
|
|
||||||
|
#region ItemUnderDragCursor
|
||||||
|
|
||||||
|
ItemType ItemUnderDragCursor
|
||||||
|
{
|
||||||
|
get { return this.itemUnderDragCursor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if( this.itemUnderDragCursor == value )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// The first pass handles the previous item under the cursor.
|
||||||
|
// The second pass handles the new one.
|
||||||
|
for( int i = 0; i < 2; ++i )
|
||||||
|
{
|
||||||
|
if( i == 1 )
|
||||||
|
this.itemUnderDragCursor = value;
|
||||||
|
|
||||||
|
if( this.itemUnderDragCursor != null )
|
||||||
|
{
|
||||||
|
ListBoxItem listBoxItem = this.GetListBoxItem( this.itemUnderDragCursor );
|
||||||
|
if( listBoxItem != null )
|
||||||
|
ListBoxItemDragState.SetIsUnderDragCursor( listBoxItem, i == 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // ItemUnderDragCursor
|
||||||
|
|
||||||
|
#region PerformDragOperation
|
||||||
|
|
||||||
|
void PerformDragOperation()
|
||||||
|
{
|
||||||
|
ItemType selectedItem = this.listBox.SelectedItem as ItemType;
|
||||||
|
DragDropEffects allowedEffects = DragDropEffects.Move | DragDropEffects.Move | DragDropEffects.Link;
|
||||||
|
if( DragDrop.DoDragDrop( this.listBox, selectedItem, allowedEffects ) != DragDropEffects.None )
|
||||||
|
{
|
||||||
|
// The item was dropped into a new location,
|
||||||
|
// so make it the new selected item.
|
||||||
|
this.listBox.SelectedItem = selectedItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // PerformDragOperation
|
||||||
|
|
||||||
|
#region ShowDragAdornerResolved
|
||||||
|
|
||||||
|
bool ShowDragAdornerResolved
|
||||||
|
{
|
||||||
|
get { return this.ShowDragAdorner && this.DragAdornerOpacity > 0.0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // ShowDragAdornerResolved
|
||||||
|
|
||||||
|
#region UpdateDragAdornerLocation
|
||||||
|
|
||||||
|
void UpdateDragAdornerLocation()
|
||||||
|
{
|
||||||
|
if( this.dragAdorner != null )
|
||||||
|
{
|
||||||
|
//Point ptCursor = MouseUtil.GetMousePosition(this.ListBox);
|
||||||
|
|
||||||
|
|
||||||
|
Point ptCursor = MouseUtil.GetMousePosition(this.ListBox);
|
||||||
|
|
||||||
|
//double left = ptCursor.X - this.ptMouseDown.X;
|
||||||
|
//double left2 = ptCursor.X;
|
||||||
|
|
||||||
|
ListBoxItem itemBeingDragged = this.GetListBoxItem(this.indexToSelect);
|
||||||
|
|
||||||
|
// 4/13/2007 - Made the top offset relative to the item being dragged.
|
||||||
|
Point itemLoc = itemBeingDragged.TranslatePoint( new Point( 0, 0 ), this.ListBox );
|
||||||
|
double top = itemLoc.Y + ptCursor.Y - this.ptMouseDown.Y;
|
||||||
|
double left = itemLoc.X + ptCursor.X - this.ptMouseDown.X;
|
||||||
|
|
||||||
|
this.dragAdorner.SetOffsets(left, top );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // UpdateDragAdornerLocation
|
||||||
|
|
||||||
|
#endregion // Private Helpers
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // ListBoxDragDropManager
|
||||||
|
|
||||||
|
#region ListBoxItemDragState
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Exposes attached properties used in conjunction with the ListBoxDragDropManager class.
|
||||||
|
/// Those properties can be used to allow triggers to modify the appearance of ListBoxItems
|
||||||
|
/// in a ListBox during a drag-drop operation.
|
||||||
|
/// </summary>
|
||||||
|
public static class ListBoxItemDragState
|
||||||
|
{
|
||||||
|
#region IsBeingDragged
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the ListBoxItemDragState's IsBeingDragged attached property.
|
||||||
|
/// This field is read-only.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsBeingDraggedProperty =
|
||||||
|
DependencyProperty.RegisterAttached(
|
||||||
|
"IsBeingDragged",
|
||||||
|
typeof( bool ),
|
||||||
|
typeof( ListBoxItemDragState ),
|
||||||
|
new UIPropertyMetadata( false ) );
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the specified ListBoxItem is being dragged, else false.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The ListBoxItem to check.</param>
|
||||||
|
public static bool GetIsBeingDragged( ListBoxItem item )
|
||||||
|
{
|
||||||
|
return (bool)item.GetValue( IsBeingDraggedProperty );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the IsBeingDragged attached property for the specified ListBoxItem.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The ListBoxItem to set the property on.</param>
|
||||||
|
/// <param name="value">Pass true if the element is being dragged, else false.</param>
|
||||||
|
internal static void SetIsBeingDragged( ListBoxItem item, bool value )
|
||||||
|
{
|
||||||
|
item.SetValue( IsBeingDraggedProperty, value );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // IsBeingDragged
|
||||||
|
|
||||||
|
#region IsUnderDragCursor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the ListBoxItemDragState's IsUnderDragCursor attached property.
|
||||||
|
/// This field is read-only.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsUnderDragCursorProperty =
|
||||||
|
DependencyProperty.RegisterAttached(
|
||||||
|
"IsUnderDragCursor",
|
||||||
|
typeof( bool ),
|
||||||
|
typeof( ListBoxItemDragState ),
|
||||||
|
new UIPropertyMetadata( false ) );
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the specified ListBoxItem is currently underneath the cursor
|
||||||
|
/// during a drag-drop operation, else false.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The ListBoxItem to check.</param>
|
||||||
|
public static bool GetIsUnderDragCursor( ListBoxItem item )
|
||||||
|
{
|
||||||
|
return (bool)item.GetValue( IsUnderDragCursorProperty );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the IsUnderDragCursor attached property for the specified ListBoxItem.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The ListBoxItem to set the property on.</param>
|
||||||
|
/// <param name="value">Pass true if the element is underneath the drag cursor, else false.</param>
|
||||||
|
internal static void SetIsUnderDragCursor( ListBoxItem item, bool value )
|
||||||
|
{
|
||||||
|
item.SetValue( IsUnderDragCursorProperty, value );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // IsUnderDragCursor
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // ListBoxItemDragState
|
||||||
|
|
||||||
|
#region ProcessDropEventArgs
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event arguments used by the ListBoxDragDropManager.ProcessDrop event.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="ItemType">The type of data object being dropped.</typeparam>
|
||||||
|
public class ProcessDropEventArgs<ItemType> : EventArgs where ItemType : class
|
||||||
|
{
|
||||||
|
#region Data
|
||||||
|
|
||||||
|
ObservableCollection<ItemType> itemsSource;
|
||||||
|
ItemType dataItem;
|
||||||
|
int oldIndex;
|
||||||
|
int newIndex;
|
||||||
|
DragDropEffects allowedEffects = DragDropEffects.None;
|
||||||
|
DragDropEffects effects = DragDropEffects.None;
|
||||||
|
|
||||||
|
#endregion // Data
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
internal ProcessDropEventArgs(
|
||||||
|
ObservableCollection<ItemType> itemsSource,
|
||||||
|
ItemType dataItem,
|
||||||
|
int oldIndex,
|
||||||
|
int newIndex,
|
||||||
|
DragDropEffects allowedEffects )
|
||||||
|
{
|
||||||
|
this.itemsSource = itemsSource;
|
||||||
|
this.dataItem = dataItem;
|
||||||
|
this.oldIndex = oldIndex;
|
||||||
|
this.newIndex = newIndex;
|
||||||
|
this.allowedEffects = allowedEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // Constructor
|
||||||
|
|
||||||
|
#region Public Properties
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The items source of the ListBox where the drop occurred.
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<ItemType> ItemsSource
|
||||||
|
{
|
||||||
|
get { return this.itemsSource; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The data object which was dropped.
|
||||||
|
/// </summary>
|
||||||
|
public ItemType DataItem
|
||||||
|
{
|
||||||
|
get { return this.dataItem; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current index of the data item being dropped, in the ItemsSource collection.
|
||||||
|
/// </summary>
|
||||||
|
public int OldIndex
|
||||||
|
{
|
||||||
|
get { return this.oldIndex; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The target index of the data item being dropped, in the ItemsSource collection.
|
||||||
|
/// </summary>
|
||||||
|
public int NewIndex
|
||||||
|
{
|
||||||
|
get { return this.newIndex; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The drag drop effects allowed to be performed.
|
||||||
|
/// </summary>
|
||||||
|
public DragDropEffects AllowedEffects
|
||||||
|
{
|
||||||
|
get { return allowedEffects; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The drag drop effect(s) performed on the dropped item.
|
||||||
|
/// </summary>
|
||||||
|
public DragDropEffects Effects
|
||||||
|
{
|
||||||
|
get { return effects; }
|
||||||
|
set { effects = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // Public Properties
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // ProcessDropEventArgs
|
||||||
|
}
|
||||||
@@ -12,7 +12,10 @@ namespace GeekDesk.Util
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Exception ex = exception as Exception;
|
Exception ex = exception as Exception;
|
||||||
|
if (!Directory.Exists(Constants.ERROR_FILE_PATH.Substring(0, Constants.ERROR_FILE_PATH.LastIndexOf("\\"))))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Constants.ERROR_FILE_PATH.Substring(0, Constants.ERROR_FILE_PATH.LastIndexOf("\\")));
|
||||||
|
}
|
||||||
using (FileStream fs = File.Open(Constants.ERROR_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
using (FileStream fs = File.Open(Constants.ERROR_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
||||||
{
|
{
|
||||||
fs.Seek(0, SeekOrigin.End);
|
fs.Seek(0, SeekOrigin.End);
|
||||||
@@ -58,6 +61,10 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (!Directory.Exists(Constants.LOG_FILE_PATH.Substring(0, Constants.LOG_FILE_PATH.LastIndexOf("\\"))))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Constants.LOG_FILE_PATH.Substring(0, Constants.LOG_FILE_PATH.LastIndexOf("\\")));
|
||||||
|
}
|
||||||
using (FileStream fs = File.Open(Constants.LOG_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
using (FileStream fs = File.Open(Constants.LOG_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
||||||
{
|
{
|
||||||
fs.Seek(0, SeekOrigin.End);
|
fs.Seek(0, SeekOrigin.End);
|
||||||
|
|||||||
32
Util/MD5Util.cs
Normal file
32
Util/MD5Util.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
internal class MD5Util
|
||||||
|
{
|
||||||
|
|
||||||
|
public static string CreateMD5(string input)
|
||||||
|
{
|
||||||
|
// Use input string to calculate MD5 hash
|
||||||
|
using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
|
||||||
|
{
|
||||||
|
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
|
||||||
|
byte[] hashBytes = md5.ComputeHash(inputBytes);
|
||||||
|
|
||||||
|
//return Convert.ToHexString(hashBytes); // .NET 5 +
|
||||||
|
|
||||||
|
//Convert the byte array to hexadecimal string prior to.NET 5
|
||||||
|
StringBuilder sb = new System.Text.StringBuilder();
|
||||||
|
for (int i = 0; i < hashBytes.Length; i++)
|
||||||
|
{
|
||||||
|
sb.Append(hashBytes[i].ToString("X2"));
|
||||||
|
}
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,8 +25,8 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
private static Window window;//定义使用该方法的窗体
|
private static Window window;//定义使用该方法的窗体
|
||||||
|
|
||||||
private static readonly int hideTime = 50;
|
private static readonly int hideTime = 65;
|
||||||
private static readonly int showTime = 30;
|
private static readonly int showTime = 15;
|
||||||
|
|
||||||
private static int animalTime;
|
private static int animalTime;
|
||||||
|
|
||||||
@@ -77,8 +77,7 @@ namespace GeekDesk.Util
|
|||||||
#region 窗体贴边隐藏功能
|
#region 窗体贴边隐藏功能
|
||||||
private static void HideWindow(object o, EventArgs e)
|
private static void HideWindow(object o, EventArgs e)
|
||||||
{
|
{
|
||||||
if (window.Visibility != Visibility.Visible
|
if (RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW
|
||||||
|| RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW
|
|
||||||
|| RunTimeStatus.LOCK_APP_PANEL) return;
|
|| RunTimeStatus.LOCK_APP_PANEL) return;
|
||||||
|
|
||||||
double screenLeft = SystemParameters.VirtualScreenLeft;
|
double screenLeft = SystemParameters.VirtualScreenLeft;
|
||||||
@@ -98,7 +97,7 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
//鼠标不在窗口上
|
//鼠标不在窗口上
|
||||||
if ((mouseX < windowLeft || mouseX > windowLeft + windowWidth
|
if ((mouseX < windowLeft || mouseX > windowLeft + windowWidth
|
||||||
|| mouseY < windowTop || mouseY > windowTop + windowHeight) && !IS_HIDE)
|
|| mouseY < windowTop || mouseY > windowTop + windowHeight) && !IS_HIDE && window.Visibility == Visibility.Visible)
|
||||||
{
|
{
|
||||||
//上方隐藏条件
|
//上方隐藏条件
|
||||||
if (windowTop <= screenTop)
|
if (windowTop <= screenTop)
|
||||||
@@ -126,8 +125,9 @@ namespace GeekDesk.Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth
|
else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth
|
||||||
&& mouseY >= windowTop && mouseY <= windowTop + windowHeight && IS_HIDE)
|
&& mouseY >= windowTop && mouseY <= windowTop + windowHeight && IS_HIDE && window.Visibility != Visibility.Visible)
|
||||||
{
|
{
|
||||||
|
window.Show();
|
||||||
//上方显示
|
//上方显示
|
||||||
if (windowTop <= screenTop - showMarginWidth)
|
if (windowTop <= screenTop - showMarginWidth)
|
||||||
{
|
{
|
||||||
@@ -189,6 +189,7 @@ namespace GeekDesk.Util
|
|||||||
double windowTop = window.Top;
|
double windowTop = window.Top;
|
||||||
double windowLeft = window.Left;
|
double windowLeft = window.Left;
|
||||||
|
|
||||||
|
window.Visibility = Visibility.Visible;
|
||||||
//左侧显示
|
//左侧显示
|
||||||
if (windowLeft <= screenLeft - showMarginWidth)
|
if (windowLeft <= screenLeft - showMarginWidth)
|
||||||
{
|
{
|
||||||
@@ -226,17 +227,30 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
App.Current.Dispatcher.Invoke(() =>
|
App.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
double abs = Math.Abs(Math.Abs(to) - Math.Abs(from));
|
|
||||||
double subLen = abs / hideTime;
|
|
||||||
|
|
||||||
if ((int)hideType <= 3)
|
switch (hideType)
|
||||||
|
{
|
||||||
|
case HideType.LEFT_SHOW:
|
||||||
|
to -= 20;
|
||||||
|
break;
|
||||||
|
case HideType.RIGHT_SHOW:
|
||||||
|
to += 20;
|
||||||
|
break;
|
||||||
|
case HideType.TOP_SHOW:
|
||||||
|
to -= 20;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
double abs = Math.Abs(Math.Abs(to) - Math.Abs(from));
|
||||||
|
|
||||||
|
if (hideType <= HideType.RIGHT_SHOW)
|
||||||
{
|
{
|
||||||
animalTime = showTime;
|
animalTime = showTime;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
animalTime = hideTime;
|
animalTime = hideTime;
|
||||||
}
|
}
|
||||||
|
double subLen = abs / animalTime;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (count < animalTime)
|
while (count < animalTime)
|
||||||
{
|
{
|
||||||
@@ -267,81 +281,20 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
switch (hideType)
|
switch (hideType)
|
||||||
{
|
{
|
||||||
case HideType.LEFT_HIDE:
|
|
||||||
window.Left = to;
|
|
||||||
break;
|
|
||||||
case HideType.LEFT_SHOW:
|
|
||||||
window.Left = to - 20;
|
|
||||||
break;
|
|
||||||
case HideType.RIGHT_HIDE:
|
|
||||||
window.Left = to;
|
|
||||||
break;
|
|
||||||
case HideType.RIGHT_SHOW:
|
|
||||||
window.Left = to + 20;
|
|
||||||
break;
|
|
||||||
case HideType.TOP_HIDE:
|
case HideType.TOP_HIDE:
|
||||||
window.Top = to;
|
window.Top = to;
|
||||||
break;
|
break;
|
||||||
case HideType.TOP_SHOW:
|
case HideType.TOP_SHOW:
|
||||||
window.Top = to - 20;
|
window.Top = to;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
window.Left = to;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//double toTemp = to;
|
if (hideType > HideType.RIGHT_SHOW)
|
||||||
//double leftT = 0;
|
{
|
||||||
//double topT = 0;
|
window.Visibility = Visibility.Collapsed;
|
||||||
//switch (hideType)
|
}
|
||||||
//{
|
|
||||||
// case HideType.LEFT_HIDE:
|
|
||||||
// to += leftT;
|
|
||||||
// break;
|
|
||||||
// case HideType.LEFT_SHOW:
|
|
||||||
// to -= leftT;
|
|
||||||
// break;
|
|
||||||
// case HideType.RIGHT_HIDE:
|
|
||||||
// to -= leftT;
|
|
||||||
// break;
|
|
||||||
// case HideType.RIGHT_SHOW:
|
|
||||||
// to += leftT;
|
|
||||||
// break;
|
|
||||||
// case HideType.TOP_HIDE:
|
|
||||||
// to += topT;
|
|
||||||
// break;
|
|
||||||
// case HideType.TOP_SHOW:
|
|
||||||
// to -= topT;
|
|
||||||
// break;
|
|
||||||
//}
|
|
||||||
//DoubleAnimation da = new DoubleAnimation
|
|
||||||
//{
|
|
||||||
// From = from,
|
|
||||||
// To = to,
|
|
||||||
// Duration = new Duration(TimeSpan.FromMilliseconds(hideTime))
|
|
||||||
//};
|
|
||||||
//// 如果是显示 则贴屏幕侧不显示阴影
|
|
||||||
//bool isShow = false;
|
|
||||||
//int shadowWidthTemp = Constants.SHADOW_WIDTH;
|
|
||||||
//if (hideType <= HideType.RIGHT_SHOW)
|
|
||||||
//{
|
|
||||||
// isShow = true;
|
|
||||||
// if (hideType == HideType.RIGHT_SHOW)
|
|
||||||
// {
|
|
||||||
// shadowWidthTemp = -shadowWidthTemp;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//da.Completed += (s, e) =>
|
|
||||||
//{
|
|
||||||
// if ("Top".Equals(property.Name))
|
|
||||||
// {
|
|
||||||
// window.Top = isShow ? toTemp - shadowWidthTemp : toTemp;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// window.Left = isShow ? toTemp - shadowWidthTemp : toTemp;
|
|
||||||
// }
|
|
||||||
// window.BeginAnimation(property, null);
|
|
||||||
//};
|
|
||||||
|
|
||||||
//Timeline.SetDesiredFrameRate(da, 60);
|
|
||||||
//window.BeginAnimation(property, da);
|
|
||||||
});
|
});
|
||||||
}).Start();
|
}).Start();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace GeekDesk.Util
|
namespace GeekDesk.Util
|
||||||
{
|
{
|
||||||
@@ -27,5 +28,27 @@ namespace GeekDesk.Util
|
|||||||
GetCursorPos(ref w32Mouse);
|
GetCursorPos(ref w32Mouse);
|
||||||
return new Point(w32Mouse.X, w32Mouse.Y);
|
return new Point(w32Mouse.X, w32Mouse.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Point GetMousePosition(Visual relativeTo)
|
||||||
|
{
|
||||||
|
Win32Point mouse = new Win32Point();
|
||||||
|
GetCursorPos(ref mouse);
|
||||||
|
|
||||||
|
// Using PointFromScreen instead of Dan Crevier's code (commented out below)
|
||||||
|
// is a bug fix created by William J. Roberts. Read his comments about the fix
|
||||||
|
// here: http://www.codeproject.com/useritems/ListViewDragDropManager.asp?msg=1911611#xx1911611xx
|
||||||
|
return relativeTo.PointFromScreen(new Point((double)mouse.X, (double)mouse.Y));
|
||||||
|
|
||||||
|
#region Commented Out
|
||||||
|
//System.Windows.Interop.HwndSource presentationSource =
|
||||||
|
// (System.Windows.Interop.HwndSource)PresentationSource.FromVisual( relativeTo );
|
||||||
|
//ScreenToClient( presentationSource.Handle, ref mouse );
|
||||||
|
//GeneralTransform transform = relativeTo.TransformToAncestor( presentationSource.RootVisual );
|
||||||
|
//Point offset = transform.Transform( new Point( 0, 0 ) );
|
||||||
|
//return new Point( mouse.X - offset.X, mouse.Y - offset.Y );
|
||||||
|
#endregion // Commented Out
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
37
Util/RelayCommand.cs
Normal file
37
Util/RelayCommand.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class RelayCommand : ICommand
|
||||||
|
{
|
||||||
|
private readonly Predicate<object> _canExecute;
|
||||||
|
private readonly Action<object> _execute;
|
||||||
|
|
||||||
|
public RelayCommand(Predicate<object> canExecute, Action<object> execute)
|
||||||
|
{
|
||||||
|
_canExecute = canExecute;
|
||||||
|
_execute = execute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler CanExecuteChanged
|
||||||
|
{
|
||||||
|
add => CommandManager.RequerySuggested += value;
|
||||||
|
remove => CommandManager.RequerySuggested -= value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanExecute(object parameter)
|
||||||
|
{
|
||||||
|
return _canExecute(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(object parameter)
|
||||||
|
{
|
||||||
|
_execute(parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@ namespace GeekDesk.Util
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 随鼠标位置显示面板
|
/// 随鼠标位置显示面板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Show(Window window, MousePosition position, double widthOffset = 0, double heightOffset = 0, bool visibility = true)
|
public static void Show(Window window, MousePosition position, double widthOffset = 0, double heightOffset = 0)
|
||||||
{
|
{
|
||||||
//获取鼠标位置
|
//获取鼠标位置
|
||||||
System.Windows.Point p = MouseUtil.GetMousePosition();
|
System.Windows.Point p = MouseUtil.GetMousePosition();
|
||||||
@@ -101,11 +101,6 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
window.Top = p.Y - afterHeight;
|
window.Top = p.Y - afterHeight;
|
||||||
}
|
}
|
||||||
if (visibility)
|
|
||||||
{
|
|
||||||
window.Opacity = 0;
|
|
||||||
window.Visibility = Visibility.Visible;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,8 +93,79 @@ namespace GeekDesk.ViewModel
|
|||||||
|
|
||||||
private SearchType searchType;
|
private SearchType searchType;
|
||||||
|
|
||||||
|
private string sysBakTime; //系统自动备份时间
|
||||||
|
|
||||||
|
private string menuPassword; //锁菜单密码
|
||||||
|
|
||||||
|
private string passwordHint; //密码提示
|
||||||
|
|
||||||
|
private bool? isShow;
|
||||||
|
|
||||||
|
private bool itemSpradeAnimation; //列表展开动画
|
||||||
|
|
||||||
#region GetSet
|
#region GetSet
|
||||||
|
public bool ItemSpradeAnimation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return itemSpradeAnimation;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
itemSpradeAnimation = value;
|
||||||
|
OnPropertyChanged("ItemSpradeAnimation");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool? IsShow
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return isShow;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
isShow = value;
|
||||||
|
OnPropertyChanged("IsShow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string PasswordHint
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return passwordHint;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
passwordHint = value;
|
||||||
|
OnPropertyChanged("PasswordHint");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string MenuPassword
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return menuPassword;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
menuPassword = value;
|
||||||
|
OnPropertyChanged("MenuPassword");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SysBakTime
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return sysBakTime;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
sysBakTime = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SearchType SearchType
|
public SearchType SearchType
|
||||||
{
|
{
|
||||||
@@ -898,7 +969,7 @@ namespace GeekDesk.ViewModel
|
|||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GeekDesk.Util;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -88,7 +89,7 @@ namespace GeekDesk.ViewModel
|
|||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GeekDesk.Util;
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ namespace GeekDesk.ViewModel
|
|||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,36 @@ namespace GeekDesk.ViewModel
|
|||||||
private string startArg; //启动参数
|
private string startArg; //启动参数
|
||||||
private string lnkPath;
|
private string lnkPath;
|
||||||
|
|
||||||
|
private string relativePath; //相对路径
|
||||||
|
|
||||||
private IconType iconType = IconType.OTHER;
|
private IconType iconType = IconType.OTHER;
|
||||||
|
|
||||||
|
|
||||||
|
public string RelativePath_NoWrite
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return relativePath;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
relativePath = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string RelativePath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return relativePath;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
relativePath = value;
|
||||||
|
OnPropertyChanged("RelativePath");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string LnkPath_NoWrite
|
public string LnkPath_NoWrite
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -303,7 +330,7 @@ namespace GeekDesk.ViewModel
|
|||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,22 @@ namespace GeekDesk.ViewModel
|
|||||||
private string menuGeometry; //菜单几何图标
|
private string menuGeometry; //菜单几何图标
|
||||||
private string geometryColor; //几何图标颜色
|
private string geometryColor; //几何图标颜色
|
||||||
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
|
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
|
||||||
|
private bool isEncrypt; //是否加密
|
||||||
|
|
||||||
|
|
||||||
|
public bool IsEncrypt
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return isEncrypt;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
isEncrypt = value;
|
||||||
|
OnPropertyChanged("IsEncrypt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string MenuGeometry
|
public string MenuGeometry
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -134,7 +148,7 @@ namespace GeekDesk.ViewModel
|
|||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ namespace GeekDesk.ViewModel
|
|||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
CommonCode.SaveAppData(MainWindow.appData);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,10 @@
|
|||||||
<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.3.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="KeyMouseHook" version="1.0.6" targetFramework="net472" developmentDependency="true" />
|
||||||
|
<package id="Microsoft.Build.Tasks.Git" version="1.0.0" targetFramework="net472" developmentDependency="true" />
|
||||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" />
|
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" />
|
||||||
|
<package id="Microsoft.SourceLink.Common" version="1.0.0" targetFramework="net472" developmentDependency="true" />
|
||||||
|
<package id="Microsoft.SourceLink.GitHub" version="1.0.0" targetFramework="net472" developmentDependency="true" />
|
||||||
<package id="MouseKeyHook" version="5.6.0" targetFramework="net472" />
|
<package id="MouseKeyHook" version="5.6.0" targetFramework="net472" />
|
||||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
||||||
<package id="NPinyin.Core" version="3.0.0" targetFramework="net472" />
|
<package id="NPinyin.Core" version="3.0.0" targetFramework="net472" />
|
||||||
@@ -13,5 +16,8 @@
|
|||||||
<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.Memory" version="4.5.4" targetFramework="net472" />
|
||||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||||
|
<package id="System.Reactive" version="5.0.0" targetFramework="net472" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
|
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
|
||||||
|
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
||||||
|
<package id="XamlFlair.WPF" version="1.2.13" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
||||||
Reference in New Issue
Block a user