增加标题Logo的隐藏, 修复圆角白线

This commit is contained in:
liufei
2022-05-11 15:28:20 +08:00
parent d4891e08a0
commit 5cfaf9a37d
5 changed files with 82 additions and 11 deletions

View File

@@ -2,6 +2,8 @@
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:cvt="clr-namespace:GeekDesk.Converts"
@@ -13,6 +15,7 @@
<UserControl.Resources> <UserControl.Resources>
<cvt:BGStyleConvert x:Key="BGStyleConvert"/> <cvt:BGStyleConvert x:Key="BGStyleConvert"/>
<cvt:StringAppendConvert x:Key="StringAppendConvert"/> <cvt:StringAppendConvert x:Key="StringAppendConvert"/>
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid MouseDown="DragMove" Background="Transparent"> <Grid MouseDown="DragMove" Background="Transparent">
@@ -117,6 +120,16 @@
</CheckBox> </CheckBox>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="5,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<StackPanel Margin="0,15,0,0"> <StackPanel Margin="0,15,0,0">
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
@@ -206,22 +219,21 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
<StackPanel x:Name="ColorPanel" Panel.ZIndex="1" <!--<StackPanel x:Name="ColorPanel" Panel.ZIndex="1"
Visibility="Collapsed" Visibility="Collapsed"
Height="500" Height="500"
Width="450" Width="450"
VerticalAlignment="Center"> VerticalAlignment="Center">
<StackPanel.Background> <StackPanel.Background>
<SolidColorBrush Color="AliceBlue" Opacity="0"/> <SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
</StackPanel.Background> </StackPanel.Background>-->
<hc:ColorPicker Name="MyColorPicker" <hc:ColorPicker Name="MyColorPicker"
ToggleButton.Checked="MyColorPicker_Checked"
Canceled="MyColorPicker_Canceled" Canceled="MyColorPicker_Canceled"
Confirmed="MyColorPicker_Confirmed" Confirmed="MyColorPicker_Confirmed"
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/> SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>
</StackPanel> <!--</StackPanel>-->
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -1,5 +1,6 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Control.Other; using GeekDesk.Control.Other;
using GeekDesk.Control.Windows;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using Microsoft.Win32; using Microsoft.Win32;
@@ -119,7 +120,8 @@ namespace GeekDesk.Control.UserControls.Config
default: default:
colorType = ColorType.TEXT_COLOR;break; colorType = ColorType.TEXT_COLOR;break;
} }
ColorPanel.Visibility = Visibility.Visible; MyColorPicker.Visibility = Visibility.Visible;
new ColorPickerWindow().Show();
} }
/// <summary> /// <summary>
@@ -216,7 +218,7 @@ namespace GeekDesk.Control.UserControls.Config
MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags); MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags);
mi.Invoke(cp, new object[] { null, null }); mi.Invoke(cp, new object[] { null, null });
} }
ColorPanel.Visibility = Visibility.Collapsed; MyColorPicker.Visibility = Visibility.Collapsed;
} }
public void BGStyle_Changed(object sender, RoutedEventArgs e) public void BGStyle_Changed(object sender, RoutedEventArgs e)

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace GeekDesk.Converts
{
internal class Visibility2BooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((Visibility)value == Visibility.Visible)
{
return true;
} else
{
return false;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((bool)value)
{
return Visibility.Visible;
} else
{
return Visibility.Collapsed;
}
}
}
}

View File

@@ -8,7 +8,8 @@
mc:Ignorable="d" mc:Ignorable="d"
xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:cvt="clr-namespace:GeekDesk.Converts"
x:Name="window" x:Name="window"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
Title="GeekDesk" Title="GeekDesk"
MinWidth="600" MinWidth="600"
MinHeight="400" MinHeight="400"
@@ -63,6 +64,7 @@
<Border x:Name="BGBorder" <Border x:Name="BGBorder"
CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
BorderThickness="0" BorderThickness="0"
Margin="-1"
> >
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -82,7 +84,7 @@
<DockPanel.Background> <DockPanel.Background>
<SolidColorBrush Opacity="0.01"/> <SolidColorBrush Opacity="0.01"/>
</DockPanel.Background> </DockPanel.Background>
<Image Source="/Resource/Image/TitleLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/> <Image Visibility="{Binding AppConfig.TitleLogoVisible}" Source="/Resource/Image/TitleLogo.png" Margin="10,0,0,0" Width="94" Height="30" HorizontalAlignment="Left"/>
</DockPanel> </DockPanel>
<DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove"> <DockPanel Grid.Row="0" Grid.Column="2" MouseMove="DragMove">

View File

@@ -28,6 +28,7 @@ namespace GeekDesk.ViewModel
private int selectedMenuIndex = 0; //上次选中菜单索引 private int selectedMenuIndex = 0; //上次选中菜单索引
private bool followMouse = true; //面板跟随鼠标 默认是 private bool followMouse = true; //面板跟随鼠标 默认是
private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示 private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
private Visibility titleLogoVisible = Visibility.Visible; // 标题logo是否显示
private AppHideType appHideType = AppHideType.START_EXE; //面板关闭方式 (默认启动程序后) private AppHideType appHideType = AppHideType.START_EXE; //面板关闭方式 (默认启动程序后)
private bool startedShowPanel = true; //启动时是否显示主面板 默认显示 private bool startedShowPanel = true; //启动时是否显示主面板 默认显示
[field: NonSerialized] [field: NonSerialized]
@@ -82,6 +83,20 @@ namespace GeekDesk.ViewModel
#region GetSet #region GetSet
public Visibility TitleLogoVisible
{
get
{
return titleLogoVisible;
}
set
{
titleLogoVisible = value;
OnPropertyChanged("TitleLogoVisible");
}
}
public GradientBGParam GradientBGParam public GradientBGParam GradientBGParam
{ {
get get
@@ -103,6 +118,10 @@ namespace GeekDesk.ViewModel
{ {
get get
{ {
if (bgStyle == 0)
{
bgStyle = (BGStyle)1;
}
return bgStyle; return bgStyle;
} }
set set