浏览代码

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

liufei 3 年之前
父节点
当前提交
5cfaf9a37d

+ 19 - 7
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 @@
     <UserControl.Resources>
         <cvt:BGStyleConvert x:Key="BGStyleConvert"/>
         <cvt:StringAppendConvert x:Key="StringAppendConvert"/>
+        <cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
     </UserControl.Resources>
     <Grid>
         <Grid  MouseDown="DragMove" Background="Transparent">
@@ -117,6 +120,16 @@
                     </CheckBox>
                 </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">
                     <hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
@@ -206,22 +219,21 @@
             </StackPanel>
         </Grid>
 
-        <StackPanel x:Name="ColorPanel" Panel.ZIndex="1" 
+        <!--<StackPanel x:Name="ColorPanel" Panel.ZIndex="1" 
                     Visibility="Collapsed"
                     Height="500"
                     Width="450"
                     VerticalAlignment="Center">
             <StackPanel.Background>
-                <SolidColorBrush Color="AliceBlue" Opacity="0"/>
-            </StackPanel.Background>
+                <SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
+            </StackPanel.Background>-->
 
             <hc:ColorPicker Name="MyColorPicker" 
-                            ToggleButton.Checked="MyColorPicker_Checked"
                             Canceled="MyColorPicker_Canceled"
                             Confirmed="MyColorPicker_Confirmed"
                             SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>
 
-        </StackPanel>
+        <!--</StackPanel>-->
     </Grid>
 
 </UserControl>

+ 4 - 2
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();
         }
 
         /// <summary>
@@ -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)

+ 36 - 0
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;
+            }
+        }
+    }
+}

+ 4 - 2
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 @@
             <Border x:Name="BGBorder" 
                     CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"  
                     BorderThickness="0"
+                    Margin="-1"
                     >
                 <Grid>
                     <Grid.RowDefinitions>
@@ -82,7 +84,7 @@
                         <DockPanel.Background>
                             <SolidColorBrush Opacity="0.01"/>
                         </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 Grid.Row="0" Grid.Column="2" MouseMove="DragMove">

+ 19 - 0
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