样式优化 bug修改 鼠标中键呼出

This commit is contained in:
liufei
2021-12-10 17:58:23 +08:00
parent 1c486a5c8a
commit 24ba279b18
41 changed files with 877 additions and 451 deletions

View File

@@ -6,13 +6,16 @@
xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Background="AliceBlue"
Background="Transparent"
d:DesignHeight="300" d:DesignWidth="450">
<UserControl.Resources>
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
</UserControl.Resources>
<Grid Background="AliceBlue" MouseDown="DragMove">
<Grid Background="Transparent" MouseDown="DragMove"
>
<StackPanel Panel.ZIndex="1" hc:Growl.GrowlParent="True" hc:Growl.Token="HotKeyGrowl"></StackPanel>
<StackPanel Margin="10">
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<TextBlock Text="面板动作设置" VerticalAlignment="Center"/>
@@ -37,6 +40,16 @@
</CheckBox>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="鼠标中间呼出" Checked="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="贴边隐藏" IsChecked="{Binding MarginHide}" Checked="MarginHide_Changed" Unchecked="MarginHide_Changed">
<CheckBox.Background>
@@ -101,7 +114,6 @@
KeyUp="HotKeyUp"
/>
</hc:UniformSpacingPanel>
<StackPanel hc:Growl.GrowlParent="True" hc:Growl.Token="HotKeyGrowl" VerticalAlignment="Top"/>
</StackPanel>
</Grid>

View File

@@ -30,7 +30,7 @@ namespace GeekDesk.Control.UserControls.Config
public partial class MotionControl : UserControl
{
public static bool hotkeyFinished = true; //热键设置结束
private KeyEventArgs prevKeyTemp; //上一个按键
private Key prevKeyTemp = Key.None; //上一个按键
private readonly List<KeyEventArgs> keysTemp = new List<KeyEventArgs>();//存储一次快捷键集合
private readonly AppConfig appConfig = MainWindow.appData.AppConfig;
@@ -49,13 +49,19 @@ namespace GeekDesk.Control.UserControls.Config
{
string tag = (sender as TextBox).Tag.ToString();
Key downKey = e.Key;
if (downKey == Key.System)
{
downKey = e.SystemKey;
}
bool main = false;
if ("Main".Equals(tag))
{
main = true;
}
if (!e.IsRepeat)
if (prevKeyTemp == Key.None || prevKeyTemp!=downKey)
{
if (hotkeyFinished)
{
@@ -71,25 +77,24 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.ToDoHotkeyModifiers = 0;
}
hotkeyFinished = false;
}
//首次按下按键
if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|| (!main && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0)))
{
if (CheckModifierKeys(e))
if (CheckModifierKeys(downKey))
{
//辅助键
if (main)
{
appConfig.HotkeyStr = GetKeyName(e);
appConfig.HotkeyModifiers = GetModifierKeys(e);
appConfig.HotkeyStr = GetKeyName(downKey);
appConfig.HotkeyModifiers = GetModifierKeys(downKey);
} else
{
appConfig.ToDoHotkeyStr = GetKeyName(e);
appConfig.ToDoHotkeyModifiers = GetModifierKeys(e);
appConfig.ToDoHotkeyStr = GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
}
prevKeyTemp = e;
prevKeyTemp = downKey;
keysTemp.Add(e);
}
}
@@ -97,44 +102,43 @@ namespace GeekDesk.Control.UserControls.Config
{
//非首次按下 需要判断前一个键值是否为辅助键
if (CheckModifierKeys(prevKeyTemp)
&& ((e.Key >= Key.A && e.Key <= Key.Z)
|| (e.Key >= Key.F1 && e.Key <= Key.F12)
|| (e.Key >= Key.D0 && e.Key <= Key.D9)))
&& ((downKey >= Key.A && downKey <= Key.Z)
|| (downKey >= Key.F1 && downKey <= Key.F12)
|| (downKey >= Key.D0 && downKey <= Key.D9)))
{
if (main)
{
appConfig.Hotkey = e.Key;
appConfig.HotkeyStr += e.Key.ToString();
appConfig.Hotkey = downKey;
appConfig.HotkeyStr += downKey.ToString();
} else
{
appConfig.ToDoHotkey = e.Key;
appConfig.ToDoHotkeyStr += e.Key.ToString();
appConfig.ToDoHotkey = downKey;
appConfig.ToDoHotkeyStr += downKey.ToString();
}
prevKeyTemp = e;
prevKeyTemp = downKey;
keysTemp.Add(e);
}
else if (CheckModifierKeys(e))
else if (CheckModifierKeys(downKey))
{
if (main)
{
appConfig.HotkeyStr += GetKeyName(e);
appConfig.HotkeyModifiers |= GetModifierKeys(e);
appConfig.HotkeyStr += GetKeyName(downKey);
appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
} else
{
appConfig.ToDoHotkeyStr += GetKeyName(e);
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(e);
appConfig.ToDoHotkeyStr += GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
}
prevKeyTemp = e;
prevKeyTemp = downKey;
keysTemp.Add(e);
}
}
}
}
private string GetKeyName(KeyEventArgs e)
private string GetKeyName(Key key)
{
Key key = e.Key;
if (key == Key.LeftCtrl || key == Key.RightCtrl)
{
return "Ctrl + ";
@@ -150,12 +154,10 @@ namespace GeekDesk.Control.UserControls.Config
{
return "Alt + ";
}
}
private HotkeyModifiers GetModifierKeys(KeyEventArgs e)
private HotkeyModifiers GetModifierKeys(Key key)
{
Key key = e.Key;
if (key == Key.LeftCtrl || key == Key.RightCtrl)
{
return HotkeyModifiers.MOD_CONTROL;
@@ -174,9 +176,8 @@ namespace GeekDesk.Control.UserControls.Config
}
}
private bool CheckModifierKeys(KeyEventArgs e)
private bool CheckModifierKeys(Key key)
{
Key key = e.Key;
return key == Key.LeftCtrl || key == Key.RightCtrl
|| key == Key.LWin || key == Key.RWin
|| key == Key.LeftShift || key == Key.RightShift
@@ -208,6 +209,7 @@ namespace GeekDesk.Control.UserControls.Config
if (allKeyUp && !hotkeyFinished)
{
keysTemp.Clear();
prevKeyTemp = Key.None;
hotkeyFinished = true;
if (main)
@@ -271,5 +273,19 @@ namespace GeekDesk.Control.UserControls.Config
}
/// <summary>
/// 鼠标中键呼出 change
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MouseMiddle_Changed(object sender, RoutedEventArgs e)
{
}
private void HookListener_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
Console.WriteLine(e.KeyChar);
}
}
}

View File

@@ -7,14 +7,14 @@
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Background="AliceBlue"
Background="Transparent"
d:DesignHeight="400" d:DesignWidth="500"
>
<UserControl.Resources>
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
</UserControl.Resources>
<Grid MouseDown="DragMove" Background="AliceBlue">
<Grid MouseDown="DragMove" Background="Transparent">
<hc:SimplePanel Margin="20" >
<StackPanel >
<TextBlock Text="程序设置" />

View File

@@ -6,12 +6,12 @@
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.Config"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Background="AliceBlue"
Background="Transparent"
d:DesignHeight="500" d:DesignWidth="450">
<Grid>
<Grid MouseDown="DragMove" Background="AliceBlue">
<Grid MouseDown="DragMove" Background="Transparent">
<StackPanel Margin="20" >
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
@@ -26,6 +26,7 @@
hc:Poptip.Placement="TopLeft"
/>
<Button Content="修改" Click="BGButton_Click"/>
<Button Content="默认" Click="DefaultButton_Click"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">

View File

@@ -1,4 +1,5 @@
using GeekDesk.Util;
using GeekDesk.Constant;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Microsoft.Win32;
using System;
@@ -59,6 +60,23 @@ namespace GeekDesk.Control.UserControls.Config
}
private void DefaultButton_Click(object sender, RoutedEventArgs e)
{
try
{
appConfig.BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
appConfig.BacImgName = "系统默认";
}
catch (Exception)
{
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
}
}
private void ColorButton_Click(object sender, RoutedEventArgs e)
{
ColorPanel.Visibility = Visibility.Visible;

View File

@@ -5,10 +5,11 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.IconFont"
mc:Ignorable="d"
mc:Ignorable="d"
Background="#00FFFFFF"
>
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Top">
<ListBox x:Name="IconListBox" ItemsSource="{Binding Iconfonts}" BorderThickness="0" Background="AliceBlue">
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Top" Background="Transparent">
<ListBox x:Name="IconListBox" ItemsSource="{Binding Iconfonts}" BorderThickness="0" Background="Transparent">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" Background="Transparent"/>

View File

@@ -8,7 +8,9 @@
xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800"
>
<UserControl.Resources>
<!--右侧栏样式动画-->
<Style x:Key="ImageStyle" TargetType="Image">
@@ -30,7 +32,6 @@
<cvt:OpcityConvert x:Key="OpcityConvert"/>
</UserControl.Resources>
<!--右侧栏-->
<hc:Card AllowDrop="True"
Drop="Wrap_Drop"
@@ -48,7 +49,7 @@
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
</ContextMenu>
</hc:Card.ContextMenu>
<WrapPanel Orientation="Horizontal">
<WrapPanel Orientation="Horizontal" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True">
<ListBox x:Name="IconListBox" ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=TwoWay}"
BorderThickness="0"
>
@@ -101,7 +102,7 @@
MouseEnter="StackPanel_MouseEnter"
MouseLeave="StackPanel_MouseLeave"
>
<Image Style="{StaticResource ImageStyle}"/>
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
<TextBlock MaxWidth="80"
Margin="0,5,0,0"
MaxHeight="40"
@@ -116,6 +117,7 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</WrapPanel>
</hc:Card>
</UserControl>

View File

@@ -253,14 +253,13 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
case IconType.URL:
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog(info);
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog);
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "IconInfoDialog");
break;
default:
IconInfoDialog dialog = new IconInfoDialog(info);
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog);
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "IconInfoDialog");
break;
}
}
private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
@@ -406,7 +405,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void AddUrlIcon(object sender, RoutedEventArgs e)
{
IconInfoUrlDialog urlDialog = new IconInfoUrlDialog();
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog);
urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "IconInfoDialog");
}
}
}

View File

@@ -4,13 +4,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:ToDoInfo}"
mc:Ignorable="d"
Background="AliceBlue"
Background="Transparent"
>
<hc:SimplePanel Margin="20">
<Grid>
<hc:SimplePanel Margin="20" Background="Transparent">
<Grid Background="Transparent">
<DataGrid x:Name="BacklogList"
HeadersVisibility="All"
AutoGenerateColumns="False"
@@ -26,13 +26,30 @@
</DataGrid.ContextMenu>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource DataGridRowStyle}">
<EventSetter Event="MouseRightButtonUp" Handler="DataGridRow_MouseRightButtonUp" />
<EventSetter Event="MouseRightButtonDown" Handler="DataGridRow_MouseRightButtonDown" />
<EventSetter Event="Selected" Handler="DataGridRow_Selected"/>
<Setter Property="Background" Value="White"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#5BC0DE"/>
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter Property="Background" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle}">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="Transparent"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.ColumnHeaderStyle>
@@ -42,7 +59,7 @@
</DataGrid.ColumnHeaderStyle>
<DataGrid.Background>
<SolidColorBrush Color="AliceBlue"/>
<SolidColorBrush Color="Transparent"/>
</DataGrid.Background>
<DataGrid.Columns>
<DataGridTextColumn Width="120" Binding="{Binding Title}" Header="待办任务"/>

View File

@@ -73,13 +73,31 @@ namespace GeekDesk.Control.UserControls.Backlog
BacklogList.ContextMenu = null;
}
private void DataGridRow_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
/// <summary>
/// 打开右键菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DataGridRow_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
BacklogList.SelectedIndex = ((DataGridRow)sender).GetIndex();
Menu.IsOpen = true;
}
/// <summary>
/// 选中时颜色变化
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DataGridRow_Selected(object sender, RoutedEventArgs e)
{
Color c = Color.FromRgb(91, 192, 222);
SolidColorBrush b = new SolidColorBrush
{
Color = c,
Opacity = 0.9
};
((DataGridRow)sender).Background = b;
}
}
}