Skip to content

Commit

Permalink
Merge pull request #38 from Demo-Liu/2.4.14
Browse files Browse the repository at this point in the history
2.4.14
  • Loading branch information
BookerLiu committed Apr 20, 2022
2 parents e5f1368 + be9dcdb commit 072985d
Show file tree
Hide file tree
Showing 36 changed files with 1,243 additions and 1,496 deletions.
4 changes: 2 additions & 2 deletions Constant/CommonEnum.cs
Expand Up @@ -5,8 +5,8 @@ namespace GeekDesk.Constant
{
public enum CommonEnum
{
WINDOW_WIDTH = 666, //默认窗体宽度
WINDOW_HEIGHT = 500, //默认窗体高度
WINDOW_WIDTH = 850, //默认窗体宽度
WINDOW_HEIGHT = 600, //默认窗体高度
MENU_CARD_WIDHT = 165, //默认菜单栏宽度
IMAGE_WIDTH = 45, //默认图标宽度
IMAGE_HEIGHT = 45, //默认图标高度
Expand Down
2 changes: 2 additions & 0 deletions Constant/Constants.cs
Expand Up @@ -26,6 +26,8 @@ public class Constants

public static string ERROR_FILE_PATH = APP_DIR + "Error.log";

public static int SHADOW_WIDTH = 20;

//系统图标
public static Hashtable SYSTEM_ICONS = (Hashtable)ConfigurationManager.GetSection("SystemIcons");

Expand Down
26 changes: 26 additions & 0 deletions Constant/RunTimeStatus.cs
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GeekDesk.Constant
{
internal class RunTimeStatus
{

/// <summary>
/// 查询框是否在工作
/// </summary>
public static bool SEARCH_BOX_SHOW = false;

/// <summary>
/// 贴边隐藏后 以非鼠标经过方式触发显示
/// </summary>
public static bool MARGIN_HIDE_AND_OTHER_SHOW = false;




}
}
6 changes: 4 additions & 2 deletions Constant/SortType.cs
Expand Up @@ -3,7 +3,9 @@
public enum SortType
{
CUSTOM = 1, //自定义排序
NAME = 2, //按名称排序
COUNT = 3 //按使用次数排序
COUNT_UP = 2, //按使用次数升序
COUNT_LOW = 3, //按使用次数降序
NAME_UP = 4, //按名称升序
NAME_LOW = 5, //按名称降序
}
}
12 changes: 11 additions & 1 deletion Control/UserControls/Config/MotionControl.xaml
Expand Up @@ -41,7 +41,7 @@
</hc:UniformSpacingPanel>

<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="鼠标中间呼出" Click="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}">
<CheckBox Content="鼠标中键呼出" Click="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
Expand All @@ -60,6 +60,16 @@
</CheckBox>
</hc:UniformSpacingPanel>

<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="悬停切换菜单" IsChecked="{Binding HoverMenu}">
<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}" Click="MarginHide_Changed">
<CheckBox.Background>
Expand Down
2 changes: 1 addition & 1 deletion Control/UserControls/Config/MotionControl.xaml.cs
@@ -1,6 +1,6 @@
using GeekDesk.Constant;
using GeekDesk.Control.Windows;
using GeekDesk.Thread;
using GeekDesk.MyThread;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using HandyControl.Data;
Expand Down
42 changes: 41 additions & 1 deletion Control/UserControls/Config/OtherControl.xaml
Expand Up @@ -13,6 +13,7 @@

<UserControl.Resources>
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
<cvt:SortTypeConvert x:Key="SortTypeConvert"/>
</UserControl.Resources>
<Grid MouseDown="DragMove" Background="Transparent">
<hc:SimplePanel Margin="20" >
Expand Down Expand Up @@ -40,6 +41,45 @@
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<TextBlock Text="排序方式" Margin="0,25,0,0"/>

<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton x:Name="CustomSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="自定义"
Tag="1"
hc:IconElement.Geometry="{StaticResource CustomSort}"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=1}"/>

<RadioButton x:Name="CountUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
Tag="2"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=2}"/>

<RadioButton x:Name="CountLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
Tag="3"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=3}"/>

<RadioButton x:Name="NameUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Tag="4"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=4}"/>

<RadioButton x:Name="NameLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Tag="5"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=5}"/>

</hc:UniformSpacingPanel>
<TextBlock Text="更新源" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Expand All @@ -56,6 +96,6 @@
</StackPanel>
</hc:SimplePanel>
</Grid>


</UserControl>
72 changes: 72 additions & 0 deletions Control/UserControls/Config/OtherControl.xaml.cs
Expand Up @@ -26,6 +26,13 @@ public partial class OtherControl : UserControl
public OtherControl()
{
InitializeComponent();
this.Loaded += OtherControl_Loaded;

}

private void OtherControl_Loaded(object sender, RoutedEventArgs e)
{
Sort_Check();
}

private void SelfStartUpBox_Click(object sender, RoutedEventArgs e)
Expand All @@ -46,5 +53,70 @@ private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e
Window.GetWindow(this).DragMove();
}
}

private void SortType_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
RadioButton rb = sender as RadioButton;
SortType type = (SortType)int.Parse(rb.Tag.ToString());

SortType resType = type;
switch (type)
{
case SortType.CUSTOM:
break;
case SortType.COUNT_UP:
if (rb.IsChecked == true)
{
CountLowSort.IsChecked = true;
CountUpSort.Visibility = Visibility.Collapsed;
CountLowSort.Visibility = Visibility.Visible;
resType = SortType.COUNT_LOW;
}
break;
case SortType.COUNT_LOW:
if (rb.IsChecked == true)
{
CountUpSort.IsChecked = true;
CountLowSort.Visibility = Visibility.Collapsed;
CountUpSort.Visibility = Visibility.Visible;
resType = SortType.COUNT_UP;
}
break;
case SortType.NAME_UP:
if (rb.IsChecked == true)
{
NameLowSort.IsChecked = true;
NameUpSort.Visibility = Visibility.Collapsed;
NameLowSort.Visibility = Visibility.Visible;
resType = SortType.NAME_LOW;
}
break;
case SortType.NAME_LOW:
if (rb.IsChecked == true)
{
NameUpSort.IsChecked = true;
NameLowSort.Visibility = Visibility.Collapsed;
NameUpSort.Visibility = Visibility.Visible;
resType = SortType.NAME_UP;
}
break;
}
MainWindow.appData.AppConfig.IconSortType = resType;
CommonCode.SortIconList();
}

private void Sort_Check()
{
if (NameLowSort.IsChecked == true)
{
NameUpSort.Visibility = Visibility.Collapsed;
NameLowSort.Visibility = Visibility.Visible;
}
if (CountLowSort.IsChecked == true)
{
CountUpSort.Visibility = Visibility.Collapsed;
CountLowSort.Visibility = Visibility.Visible;
}
}
}
}
24 changes: 15 additions & 9 deletions Control/UserControls/Config/ThemeControl.xaml
Expand Up @@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.Config"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Background="Transparent"
Expand Down Expand Up @@ -133,20 +132,27 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Width="100"/>
<Button Content="选择" Click="ColorButton_Click"/>
<Button Content="选择" Margin="0,-10,0,0" Click="ColorButton_Click"/>
</hc:UniformSpacingPanel>
</StackPanel>
</Grid>

<StackPanel x:Name="ColorPanel" Visibility="Collapsed" VerticalAlignment="Center">

<StackPanel x:Name="ColorPanel" Panel.ZIndex="1"
Visibility="Collapsed"
Height="500"
Width="450"
VerticalAlignment="Center">
<StackPanel.Background>
<SolidColorBrush Color="AliceBlue" Opacity="0"/>
</StackPanel.Background>
<hc:ColorPicker
Name="ColorPicker"
Canceled="ColorPicker_Canceled"
SelectedColorChanged="ColorPicker_SelectedColorChanged"/>

<hc:ColorPicker Name="MyColorPicker"
ToggleButton.Checked="MyColorPicker_Checked"
Canceled="MyColorPicker_Canceled"
Confirmed="MyColorPicker_Confirmed"
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>

</StackPanel>
</Grid>

</UserControl>
48 changes: 42 additions & 6 deletions Control/UserControls/Config/ThemeControl.xaml.cs
Expand Up @@ -6,13 +6,17 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
Expand All @@ -27,6 +31,8 @@ public partial class ThemeControl : System.Windows.Controls.UserControl
{

private static AppConfig appConfig = MainWindow.appData.AppConfig;

private System.Windows.Controls.Primitives.ToggleButton toggleButton = null;
public ThemeControl()
{
InitializeComponent();
Expand All @@ -39,7 +45,7 @@ public ThemeControl()
/// <param name="e"></param>
private void BGButton_Click(object sender, RoutedEventArgs e)
{

try
{
OpenFileDialog ofd = new OpenFileDialog
Expand Down Expand Up @@ -84,16 +90,24 @@ private void ColorButton_Click(object sender, RoutedEventArgs e)
ColorPanel.Visibility = Visibility.Visible;
}

private void ColorPicker_Canceled(object sender, EventArgs e)
/// <summary>
/// 取消按钮事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MyColorPicker_Canceled(object sender, EventArgs e)
{
ColorPanel.Visibility = Visibility.Collapsed;
MyColorPickerClose(sender);
}
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
MyColorPickerClose(sender);
}

private void ColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
SolidColorBrush scb = ColorPicker.SelectedBrush;
SolidColorBrush scb = MyColorPicker.SelectedBrush;
appConfig.TextColor = scb.ToString();
ColorPanel.Visibility = Visibility.Collapsed;
}

/// <summary>
Expand Down Expand Up @@ -143,5 +157,27 @@ public void CheckButtonUp()
}
}
}

private void MyColorPicker_Checked(object sender, RoutedEventArgs e)
{
toggleButton = e.OriginalSource as System.Windows.Controls.Primitives.ToggleButton;
}


private void MyColorPickerClose(object sender)
{
if (toggleButton != null && toggleButton.IsChecked == true)
{
HandyControl.Controls.ColorPicker cp = sender as HandyControl.Controls.ColorPicker;
const BindingFlags InstanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
Type type = cp.GetType();
toggleButton.IsChecked = false;
MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags);
mi.Invoke(cp, new object[] { null, null });
}
ColorPanel.Visibility = Visibility.Collapsed;
}


}
}

0 comments on commit 072985d

Please sign in to comment.