From 9d174ed2fcc47367e4c6ee00f85a47f11e60c811 Mon Sep 17 00:00:00 2001 From: liufei Date: Tue, 7 Jun 2022 11:16:14 +0800 Subject: [PATCH] =?UTF-8?q?:poop:=20=E4=BC=98=E5=8C=96=E4=B8=80=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Control/UserControls/Config/ThemeControl.xaml | 6 +-- Converts/IntToCornerRadius.cs | 11 ++++- DraggAnimatedPanel/DraggAnimatedPanel.cs | 1 + GeekDesk.sln | 2 +- LICENSE.md | 2 +- MainWindow.xaml | 43 ++++++++----------- MainWindow.xaml.cs | 4 ++ MainWindow.xaml.rej | 1 + Properties/AssemblyInfo.cs | 2 +- Task/ToDoTask.cs | 2 +- Util/BGSettingUtil.cs | 2 +- Util/BlurGlassUtil.cs | 22 ++++++---- 12 files changed, 54 insertions(+), 44 deletions(-) diff --git a/Control/UserControls/Config/ThemeControl.xaml b/Control/UserControls/Config/ThemeControl.xaml index 72a38da..10f1a5b 100644 --- a/Control/UserControls/Config/ThemeControl.xaml +++ b/Control/UserControls/Config/ThemeControl.xaml @@ -149,7 +149,7 @@ - + - + diff --git a/Converts/IntToCornerRadius.cs b/Converts/IntToCornerRadius.cs index ff8dd69..3048ad2 100644 --- a/Converts/IntToCornerRadius.cs +++ b/Converts/IntToCornerRadius.cs @@ -10,12 +10,21 @@ namespace GeekDesk.Converts public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { int val = int.Parse(value.ToString()); + var param = 0; + if (parameter != null) + { + param = int.Parse(parameter.ToString()); + } + if (val + param > 0) + { + val += param; + } return new CornerRadius(val); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { - throw new NotImplementedException(); + return null; } } } diff --git a/DraggAnimatedPanel/DraggAnimatedPanel.cs b/DraggAnimatedPanel/DraggAnimatedPanel.cs index 53ad471..542ca80 100644 --- a/DraggAnimatedPanel/DraggAnimatedPanel.cs +++ b/DraggAnimatedPanel/DraggAnimatedPanel.cs @@ -21,6 +21,7 @@ namespace DraggAnimatedPanel #endregion static DraggAnimatedPanel() { + DefaultStyleKeyProperty.OverrideMetadata(typeof(DraggAnimatedPanel), new FrameworkPropertyMetadata(typeof(DraggAnimatedPanel))); } diff --git a/GeekDesk.sln b/GeekDesk.sln index b21eaf0..f80a082 100644 --- a/GeekDesk.sln +++ b/GeekDesk.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 +# Visual Studio Version 17 VisualStudioVersion = 17.1.32319.34 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeekDesk", "GeekDesk.csproj", "{B4983CEC-2281-413C-8ECF-92EE0E40A713}" diff --git a/LICENSE.md b/LICENSE.md index b60e487..aadd86c 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,2 +1,2 @@ -- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处) +- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处) - 商用需联系作者 diff --git a/MainWindow.xaml b/MainWindow.xaml index f1a5499..358317b 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -29,9 +29,7 @@ GotFocus="Window_GotFocus" Loaded="Window_Loaded" > - - - + @@ -39,37 +37,31 @@ - - + + + + + - - - - - - + - - - + + + + @@ -167,8 +159,7 @@ - - + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index f6b8eb0..872c561 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -230,6 +230,10 @@ namespace GeekDesk //自动备份一次数据 appData.AppConfig.SysBakTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); CommonCode.SaveAppData(appData, Constants.DATA_FILE_BAK_PATH); + + //毛玻璃 暂时未解决阴影问题 + //BlurGlassUtil.EnableBlur(this); + AeroGlassUtil.GlassWindow(this); } /// diff --git a/MainWindow.xaml.rej b/MainWindow.xaml.rej index 1b27959..ed84323 100644 --- a/MainWindow.xaml.rej +++ b/MainWindow.xaml.rej @@ -1,3 +1,4 @@ +# BookerLiu diff a/MainWindow.xaml b/MainWindow.xaml (rejected hunks) @@ -20,6 +20,7 @@ SizeChanged="Window_SizeChanged" diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 9450af6..3997bb3 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ using System.Windows; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 -// 与程序集关联的信息。 +// 与程序集关联的信息。 [assembly: AssemblyTitle("GeekDesk")] [assembly: AssemblyDescription("小巧、美观的桌面快速启动工具")] [assembly: AssemblyConfiguration("")] diff --git a/Task/ToDoTask.cs b/Task/ToDoTask.cs index 03d31e5..d5c2b50 100644 --- a/Task/ToDoTask.cs +++ b/Task/ToDoTask.cs @@ -60,7 +60,7 @@ namespace GeekDesk.Task if (Environment.OSVersion.Platform == PlatformID.Win32NT) { SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1); - } + } } #region 内存回收 diff --git a/Util/BGSettingUtil.cs b/Util/BGSettingUtil.cs index b851f11..f7fcdf6 100644 --- a/Util/BGSettingUtil.cs +++ b/Util/BGSettingUtil.cs @@ -45,7 +45,7 @@ namespace GeekDesk.Util else { LinearGradientBrush lgb = new LinearGradientBrush(); - + lgb.Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2)); GradientStop gs = new GradientStop { Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color1), diff --git a/Util/BlurGlassUtil.cs b/Util/BlurGlassUtil.cs index d2069dc..4faaafc 100644 --- a/Util/BlurGlassUtil.cs +++ b/Util/BlurGlassUtil.cs @@ -50,20 +50,24 @@ namespace GeekDesk.Util public static void EnableBlur(Window window) { - var windowHelper = new WindowInteropHelper(window); + WindowInteropHelper windowHelper = new WindowInteropHelper(window); - var accent = new AccentPolicy(); - accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND; + AccentPolicy accent = new AccentPolicy + { + AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND + }; - var accentStructSize = Marshal.SizeOf(accent); + int accentStructSize = Marshal.SizeOf(accent); - var accentPtr = Marshal.AllocHGlobal(accentStructSize); + IntPtr accentPtr = Marshal.AllocHGlobal(accentStructSize); Marshal.StructureToPtr(accent, accentPtr, false); - var data = new WindowCompositionAttributeData(); - data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY; - data.SizeOfData = accentStructSize; - data.Data = accentPtr; + WindowCompositionAttributeData data = new WindowCompositionAttributeData + { + Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY, + SizeOfData = accentStructSize, + Data = accentPtr + }; SetWindowCompositionAttribute(windowHelper.Handle, ref data);