🚩 增加列表加密功能
This commit is contained in:
@@ -13,6 +13,7 @@ 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>
|
||||||
@@ -21,11 +22,13 @@ namespace GeekDesk.Constant
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 备份文件路径
|
/// 备份文件路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string DATA_FILE_BAK_PATH = APP_DIR + "bak\\Data.bak"; //app数据文件路径
|
public static string DATA_FILE_BAK_PATH = APP_DIR + "bak\\Data.bak"; //app备份数据文件路径
|
||||||
|
|
||||||
public static string LOG_FILE_PATH = APP_DIR + "logs\\log.log";
|
public static string PW_FILE_BAK_PATH = APP_DIR + "bak\\pw.txt"; //密码文件路径
|
||||||
|
|
||||||
public static string ERROR_FILE_PATH = APP_DIR + "logs\\error.log";
|
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,20 @@
|
|||||||
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 IS_MENU_EDIT = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
<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>
|
||||||
@@ -121,11 +122,12 @@
|
|||||||
|
|
||||||
<!--左侧栏-->
|
<!--左侧栏-->
|
||||||
<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}}">
|
||||||
|
|
||||||
@@ -137,28 +139,28 @@
|
|||||||
<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"
|
||||||
ItemsSource="{Binding MenuList}"
|
ItemsSource="{Binding MenuList}"
|
||||||
Tag="{Binding AppConfig.MenuCardWidth}"
|
Tag="{Binding AppConfig.MenuCardWidth}"
|
||||||
BorderThickness="0" Foreground="{x:Null}"
|
BorderThickness="0" Foreground="{x:Null}"
|
||||||
SelectedIndex="{Binding AppConfig.SelectedMenuIndex}"
|
SelectedIndex="{Binding AppConfig.SelectedMenuIndex}"
|
||||||
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>
|
||||||
@@ -181,8 +183,7 @@
|
|||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Tag="{Binding}"
|
<StackPanel Tag="{Binding}">
|
||||||
>
|
|
||||||
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
||||||
|
|||||||
@@ -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,7 @@ 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;
|
||||||
|
|
||||||
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Collapsed;
|
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
@@ -322,7 +320,18 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
|
if (appData.MenuList[MenuListBox.SelectedIndex].IsEncrypt)
|
||||||
|
{
|
||||||
|
appData.AppConfig.SelectedMenuIcons = null;
|
||||||
|
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入密码";
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Collapsed;
|
||||||
|
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Visible;
|
MainWindow.mainWindow.RightCard.WrapUFG.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
@@ -335,7 +344,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(() =>
|
||||||
{
|
{
|
||||||
@@ -406,6 +415,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;
|
||||||
@@ -461,5 +471,104 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
appData.MenuList[MenuListBox.SelectedIndex].IconList.Remove(iconInfo);
|
appData.MenuList[MenuListBox.SelectedIndex].IconList.Remove(iconInfo);
|
||||||
appData.MenuList[MenuListBox.Items.IndexOf(mi)].IconList.Add(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 = "加密此列表";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
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: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"
|
||||||
>
|
>
|
||||||
@@ -93,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>
|
||||||
@@ -107,29 +110,36 @@
|
|||||||
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
|
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</hc:Card.ContextMenu>
|
</hc:Card.ContextMenu>
|
||||||
<Grid>
|
<hc:DialogContainer>
|
||||||
<StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
|
<Grid>
|
||||||
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling"
|
<ot:PasswordDialog xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}"
|
||||||
VirtualizingPanel.IsVirtualizing="True"
|
x:Name="PDDialog"
|
||||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
Panel.ZIndex="99"
|
||||||
>
|
IsVisibleChanged="PDDialog_IsVisibleChanged"
|
||||||
<UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
|
Margin="0,-100,0,0"/>
|
||||||
<!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
|
<StackPanel Panel.ZIndex="1" Margin="0,-10,-0,0"/>
|
||||||
|
<WrapPanel Orientation="Horizontal"
|
||||||
|
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
|
>
|
||||||
|
<UniformGrid x:Name="WrapUFG" xf:Animations.Primary="{xf:Animate BasedOn={StaticResource FadeInAndGrowHorizontally}, Event=Visibility}">
|
||||||
|
<!--<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom3Transition3}">-->
|
||||||
<ListBox x:Name="IconListBox"
|
<ListBox x:Name="IconListBox"
|
||||||
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Padding="0,10,0,0"
|
Padding="0,10,0,0"
|
||||||
>
|
>
|
||||||
<ListBox.Background>
|
<ListBox.Background>
|
||||||
<SolidColorBrush Opacity="0"/>
|
<SolidColorBrush Opacity="0"/>
|
||||||
</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 />
|
<WrapPanel />
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
@@ -155,45 +165,45 @@
|
|||||||
<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}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
hc:Poptip.Content="{Binding Content}"
|
hc:Poptip.Content="{Binding Content}"
|
||||||
hc:Poptip.Placement="BottomLeft"
|
hc:Poptip.Placement="BottomLeft"
|
||||||
Background="#00FFFFFF"
|
Background="#00FFFFFF"
|
||||||
MouseEnter="StackPanel_MouseEnter"
|
MouseEnter="StackPanel_MouseEnter"
|
||||||
MouseLeave="StackPanel_MouseLeave"
|
MouseLeave="StackPanel_MouseLeave"
|
||||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||||
>
|
>
|
||||||
<!--<StackPanel Background="#00FFFFFF"
|
<!--<StackPanel Background="#00FFFFFF"
|
||||||
MouseEnter="CursorPanel_MouseEnter"
|
MouseEnter="CursorPanel_MouseEnter"
|
||||||
MouseLeave="CursorPanel_MouseLeave"
|
MouseLeave="CursorPanel_MouseLeave"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
|
||||||
<Image Style="{StaticResource ImageStyle}"
|
<Image Style="{StaticResource ImageStyle}"
|
||||||
RenderOptions.BitmapScalingMode="HighQuality"/>
|
RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
<TextBlock MaxWidth="80"
|
<TextBlock MaxWidth="80"
|
||||||
Margin="0,5,0,0"
|
Margin="0,5,0,0"
|
||||||
MaxHeight="40"
|
MaxHeight="40"
|
||||||
FontSize="13"
|
FontSize="13"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
TextTrimming="WordEllipsis"
|
TextTrimming="WordEllipsis"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||||
Text="{Binding Name}"/>
|
Text="{Binding Name}"/>
|
||||||
<!--</StackPanel>-->
|
<!--</StackPanel>-->
|
||||||
|
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
<!--</hc:TransitioningContentControl>-->
|
<!--</hc:TransitioningContentControl>-->
|
||||||
</UniformGrid>
|
</UniformGrid>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</hc:DialogContainer>
|
||||||
</hc:Card>
|
</hc:Card>
|
||||||
|
|
||||||
<hc:Card x:Name="VerticalCard"
|
<hc:Card x:Name="VerticalCard"
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Loaded += RightCardControl_Loaded;
|
this.Loaded += RightCardControl_Loaded;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RightCardControl_Loaded(object sender, RoutedEventArgs e)
|
private void RightCardControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
@@ -443,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -674,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>
|
||||||
@@ -797,5 +798,25 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
SearchListBox.ScrollIntoView(SearchListBox.SelectedItem);
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,6 +161,7 @@
|
|||||||
<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" />
|
||||||
@@ -179,6 +180,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>
|
||||||
@@ -278,6 +282,7 @@
|
|||||||
<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\ShellContextMenu.cs" />
|
<Compile Include="Util\ShellContextMenu.cs" />
|
||||||
@@ -310,6 +315,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>
|
||||||
@@ -506,7 +515,7 @@
|
|||||||
<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">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Focusable="True"
|
Focusable="True"
|
||||||
x:Name="BGBorder"
|
x:Name="BGBorder"
|
||||||
hc:Dialog.Token="IconInfoDialog"
|
hc:Dialog.Token="MainWindowDialog"
|
||||||
>
|
>
|
||||||
<Border.Effect>
|
<Border.Effect>
|
||||||
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||||
@@ -74,9 +74,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<StackPanel HorizontalAlignment="Right" Panel.ZIndex="99" hc:Growl.GrowlParent="False" hc:Growl.Token="MainWindowGrowl" Grid.Column="1" Grid.Row="1"/>
|
<StackPanel HorizontalAlignment="Right" Panel.ZIndex="99" hc:Growl.GrowlParent="False" hc:Growl.Token="MainWindowGrowl" Grid.Column="1" Grid.Row="1"/>
|
||||||
<!--获取焦点用-->
|
|
||||||
<TextBox x:Name="EmptyTextBox" Width="0"/>
|
|
||||||
|
|
||||||
|
|
||||||
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
<DockPanel Grid.Row="0" Grid.Column="0" MouseMove="DragMove">
|
||||||
<DockPanel.Background>
|
<DockPanel.Background>
|
||||||
|
|||||||
@@ -435,6 +435,7 @@ namespace GeekDesk
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
MainWindow.mainWindow.Activate();
|
MainWindow.mainWindow.Activate();
|
||||||
|
mainWindow.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
if (MarginHide.ON_HIDE)
|
if (MarginHide.ON_HIDE)
|
||||||
{
|
{
|
||||||
@@ -454,7 +455,13 @@ namespace GeekDesk
|
|||||||
|
|
||||||
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible);
|
||||||
Keyboard.Focus(mainWindow);
|
Keyboard.Focus(mainWindow);
|
||||||
Keyboard.Focus(mainWindow.SearchBox);
|
if (RunTimeStatus.SHOW_MENU_PASSWORDBOX)
|
||||||
|
{
|
||||||
|
mainWindow.RightCard.PDDialog.SetFocus();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Keyboard.Focus(mainWindow.SearchBox);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void HideApp()
|
public static void HideApp()
|
||||||
@@ -742,14 +749,25 @@ 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)
|
||||||
{
|
{
|
||||||
//if判断是为了能够使修改菜单时 菜单能够获得焦点
|
if (RunTimeStatus.SHOW_MENU_PASSWORDBOX)
|
||||||
Keyboard.Focus(SearchBox);
|
{
|
||||||
|
//必须在其它文本框没有工作的时候才给密码框焦点
|
||||||
|
RightCard.PDDialog.SetFocus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//必须在其它文本框没有工作的时候才给搜索框焦点
|
||||||
|
Keyboard.Focus(SearchBox);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AppWindow_Deactivated(object sender, EventArgs e)
|
private void AppWindow_Deactivated(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -97,7 +97,10 @@ namespace GeekDesk.Util
|
|||||||
{
|
{
|
||||||
lock (_MyLock)
|
lock (_MyLock)
|
||||||
{
|
{
|
||||||
appData.AppConfig.SysBakTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
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("\\"))))
|
if (!Directory.Exists(filePath.Substring(0, filePath.LastIndexOf("\\"))))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(filePath.Substring(0, filePath.LastIndexOf("\\")));
|
Directory.CreateDirectory(filePath.Substring(0, filePath.LastIndexOf("\\")));
|
||||||
@@ -108,9 +111,18 @@ namespace GeekDesk.Util
|
|||||||
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()
|
public static void BakAppData()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -95,8 +95,36 @@ namespace GeekDesk.ViewModel
|
|||||||
|
|
||||||
private string sysBakTime; //系统自动备份时间
|
private string sysBakTime; //系统自动备份时间
|
||||||
|
|
||||||
|
private string menuPassword; //锁菜单密码
|
||||||
|
|
||||||
|
private string passwordHint; //密码提示
|
||||||
|
|
||||||
#region GetSet
|
#region GetSet
|
||||||
|
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
|
public string SysBakTime
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user