From 5cfaf9a37dc9cbb7c21ce264c24a70ca90f31092 Mon Sep 17 00:00:00 2001 From: liufei Date: Wed, 11 May 2022 15:28:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=87=E9=A2=98Logo?= =?UTF-8?q?=E7=9A=84=E9=9A=90=E8=97=8F,=20=E4=BF=AE=E5=A4=8D=E5=9C=86?= =?UTF-8?q?=E8=A7=92=E7=99=BD=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Control/UserControls/Config/ThemeControl.xaml | 26 ++++++++++---- .../UserControls/Config/ThemeControl.xaml.cs | 6 ++-- Converts/Visibility2BooleanConverter.cs | 36 +++++++++++++++++++ MainWindow.xaml | 6 ++-- ViewModel/AppConfig.cs | 19 ++++++++++ 5 files changed, 82 insertions(+), 11 deletions(-) create mode 100644 Converts/Visibility2BooleanConverter.cs diff --git a/Control/UserControls/Config/ThemeControl.xaml b/Control/UserControls/Config/ThemeControl.xaml index ba48415..d22a810 100644 --- a/Control/UserControls/Config/ThemeControl.xaml +++ b/Control/UserControls/Config/ThemeControl.xaml @@ -2,9 +2,11 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 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:viewmodel="clr-namespace:GeekDesk.ViewModel" + d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:hc="https://handyorg.github.io/handycontrol" - xmlns:cvt="clr-namespace:GeekDesk.Converts" + xmlns:cvt="clr-namespace:GeekDesk.Converts" mc:Ignorable="d" Background="Transparent" d:DesignHeight="500" d:DesignWidth="450"> @@ -13,6 +15,7 @@ + @@ -117,6 +120,16 @@ + + + + + + + + + + @@ -206,22 +219,21 @@ - - - + + --> - + diff --git a/Control/UserControls/Config/ThemeControl.xaml.cs b/Control/UserControls/Config/ThemeControl.xaml.cs index 55604a3..4dc4329 100644 --- a/Control/UserControls/Config/ThemeControl.xaml.cs +++ b/Control/UserControls/Config/ThemeControl.xaml.cs @@ -1,5 +1,6 @@ using GeekDesk.Constant; using GeekDesk.Control.Other; +using GeekDesk.Control.Windows; using GeekDesk.Util; using GeekDesk.ViewModel; using Microsoft.Win32; @@ -119,7 +120,8 @@ namespace GeekDesk.Control.UserControls.Config default: colorType = ColorType.TEXT_COLOR;break; } - ColorPanel.Visibility = Visibility.Visible; + MyColorPicker.Visibility = Visibility.Visible; + new ColorPickerWindow().Show(); } /// @@ -216,7 +218,7 @@ namespace GeekDesk.Control.UserControls.Config MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags); mi.Invoke(cp, new object[] { null, null }); } - ColorPanel.Visibility = Visibility.Collapsed; + MyColorPicker.Visibility = Visibility.Collapsed; } public void BGStyle_Changed(object sender, RoutedEventArgs e) diff --git a/Converts/Visibility2BooleanConverter.cs b/Converts/Visibility2BooleanConverter.cs new file mode 100644 index 0000000..b7d81ff --- /dev/null +++ b/Converts/Visibility2BooleanConverter.cs @@ -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; + } + } + } +} diff --git a/MainWindow.xaml b/MainWindow.xaml index f80c2d6..bed8d00 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -8,7 +8,8 @@ mc:Ignorable="d" xmlns:cvt="clr-namespace:GeekDesk.Converts" 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" MinWidth="600" MinHeight="400" @@ -63,6 +64,7 @@ @@ -82,7 +84,7 @@ - + diff --git a/ViewModel/AppConfig.cs b/ViewModel/AppConfig.cs index 37cd230..16196e5 100644 --- a/ViewModel/AppConfig.cs +++ b/ViewModel/AppConfig.cs @@ -28,6 +28,7 @@ namespace GeekDesk.ViewModel private int selectedMenuIndex = 0; //上次选中菜单索引 private bool followMouse = true; //面板跟随鼠标 默认是 private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示 + private Visibility titleLogoVisible = Visibility.Visible; // 标题logo是否显示 private AppHideType appHideType = AppHideType.START_EXE; //面板关闭方式 (默认启动程序后) private bool startedShowPanel = true; //启动时是否显示主面板 默认显示 [field: NonSerialized] @@ -82,6 +83,20 @@ namespace GeekDesk.ViewModel #region GetSet + + public Visibility TitleLogoVisible + { + get + { + return titleLogoVisible; + } + set + { + titleLogoVisible = value; + OnPropertyChanged("TitleLogoVisible"); + } + } + public GradientBGParam GradientBGParam { get @@ -103,6 +118,10 @@ namespace GeekDesk.ViewModel { get { + if (bgStyle == 0) + { + bgStyle = (BGStyle)1; + } return bgStyle; } set