💩 优化一部分代码
This commit is contained in:
@@ -149,7 +149,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
<TextBlock Text="背景不透明度" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<!--<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
@@ -177,7 +177,7 @@
|
|||||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||||
</hc:PreviewSlider.PreviewContent>
|
</hc:PreviewSlider.PreviewContent>
|
||||||
</hc:PreviewSlider>
|
</hc:PreviewSlider>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>-->
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
||||||
|
|||||||
@@ -10,12 +10,21 @@ namespace GeekDesk.Converts
|
|||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
int val = int.Parse(value.ToString());
|
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);
|
return new CornerRadius(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace DraggAnimatedPanel
|
|||||||
#endregion
|
#endregion
|
||||||
static DraggAnimatedPanel()
|
static DraggAnimatedPanel()
|
||||||
{
|
{
|
||||||
|
|
||||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(DraggAnimatedPanel), new FrameworkPropertyMetadata(typeof(DraggAnimatedPanel)));
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DraggAnimatedPanel), new FrameworkPropertyMetadata(typeof(DraggAnimatedPanel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.1.32319.34
|
VisualStudioVersion = 17.1.32319.34
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeekDesk", "GeekDesk.csproj", "{B4983CEC-2281-413C-8ECF-92EE0E40A713}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeekDesk", "GeekDesk.csproj", "{B4983CEC-2281-413C-8ECF-92EE0E40A713}"
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
|
- 这是个人开发的程序,任何人可任意修改和免费使用(未做较大功能性改动不允许修改赞赏码,重新修改发布需注明出处)
|
||||||
- 商用需联系作者
|
- 商用需联系作者
|
||||||
|
|||||||
@@ -29,9 +29,7 @@
|
|||||||
GotFocus="Window_GotFocus"
|
GotFocus="Window_GotFocus"
|
||||||
Loaded="Window_Loaded"
|
Loaded="Window_Loaded"
|
||||||
>
|
>
|
||||||
<WindowChrome.WindowChrome>
|
|
||||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
|
|
||||||
</WindowChrome.WindowChrome>
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<RoutedUICommand x:Key="SearchHotKeyDown" Text="SearchHotKeyDown"/>
|
<RoutedUICommand x:Key="SearchHotKeyDown" Text="SearchHotKeyDown"/>
|
||||||
|
|
||||||
@@ -39,37 +37,31 @@
|
|||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
|
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
|
||||||
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
<cvt:DoubleToGridLength x:Key="DoubleToGridLength"/>
|
||||||
<Style x:Key="BorderBacStyle" TargetType="Border">
|
|
||||||
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
|
||||||
|
<WindowChrome.WindowChrome>
|
||||||
|
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="15"/>
|
||||||
|
</WindowChrome.WindowChrome>
|
||||||
|
|
||||||
<Window.InputBindings>
|
<Window.InputBindings>
|
||||||
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchHotKeyDown}"/>
|
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchHotKeyDown}"/>
|
||||||
</Window.InputBindings>
|
</Window.InputBindings>
|
||||||
<Window.CommandBindings>
|
<Window.CommandBindings>
|
||||||
<CommandBinding Command="{StaticResource SearchHotKeyDown}" CanExecute="SearchHotKeyDown"/>
|
<CommandBinding Command="{StaticResource SearchHotKeyDown}" CanExecute="SearchHotKeyDown"/>
|
||||||
<!--<CommandBinding Command="ChangeImgBG" Executed="ChangeImgBG_Executed" CanExecute="ChangeImgBG_CanExecute" />-->
|
|
||||||
|
|
||||||
</Window.CommandBindings>
|
</Window.CommandBindings>
|
||||||
|
|
||||||
<Window.Effect>
|
<!--Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"-->
|
||||||
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
|
||||||
RenderingBias="Quality" ShadowDepth="2"/>
|
BorderThickness="0"
|
||||||
</Window.Effect>
|
|
||||||
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
|
|
||||||
Background="#EBF7E3"
|
|
||||||
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
|
|
||||||
hc:Dialog.Token="IconInfoDialog"
|
|
||||||
Focusable="True"
|
Focusable="True"
|
||||||
|
x:Name="BGBorder"
|
||||||
|
hc:Dialog.Token="IconInfoDialog"
|
||||||
>
|
>
|
||||||
<hc:DialogContainer Focusable="True">
|
<Border.Effect>
|
||||||
<!-- -1是为了解决圆角白线的问题-->
|
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||||
<Border x:Name="BGBorder"
|
RenderingBias="Quality" ShadowDepth="2"/>
|
||||||
CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
|
</Border.Effect>
|
||||||
BorderThickness="0"
|
<hc:DialogContainer Focusable="True">
|
||||||
Margin="-1"
|
|
||||||
>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
||||||
@@ -167,8 +159,7 @@
|
|||||||
|
|
||||||
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</hc:DialogContainer>
|
||||||
</hc:DialogContainer>
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -230,6 +230,10 @@ namespace GeekDesk
|
|||||||
//自动备份一次数据
|
//自动备份一次数据
|
||||||
appData.AppConfig.SysBakTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
appData.AppConfig.SysBakTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
CommonCode.SaveAppData(appData, Constants.DATA_FILE_BAK_PATH);
|
CommonCode.SaveAppData(appData, Constants.DATA_FILE_BAK_PATH);
|
||||||
|
|
||||||
|
//毛玻璃 暂时未解决阴影问题
|
||||||
|
//BlurGlassUtil.EnableBlur(this);
|
||||||
|
AeroGlassUtil.GlassWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# BookerLiu
|
||||||
diff a/MainWindow.xaml b/MainWindow.xaml (rejected hunks)
|
diff a/MainWindow.xaml b/MainWindow.xaml (rejected hunks)
|
||||||
@@ -20,6 +20,7 @@
|
@@ -20,6 +20,7 @@
|
||||||
SizeChanged="Window_SizeChanged"
|
SizeChanged="Window_SizeChanged"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Windows;
|
|||||||
|
|
||||||
// 有关程序集的一般信息由以下
|
// 有关程序集的一般信息由以下
|
||||||
// 控制。更改这些特性值可修改
|
// 控制。更改这些特性值可修改
|
||||||
// 与程序集关联的信息。
|
// 与程序集关联的信息。
|
||||||
[assembly: AssemblyTitle("GeekDesk")]
|
[assembly: AssemblyTitle("GeekDesk")]
|
||||||
[assembly: AssemblyDescription("小巧、美观的桌面快速启动工具")]
|
[assembly: AssemblyDescription("小巧、美观的桌面快速启动工具")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace GeekDesk.Task
|
|||||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||||
{
|
{
|
||||||
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
|
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 内存回收
|
#region 内存回收
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace GeekDesk.Util
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LinearGradientBrush lgb = new LinearGradientBrush();
|
LinearGradientBrush lgb = new LinearGradientBrush();
|
||||||
|
lgb.Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2));
|
||||||
GradientStop gs = new GradientStop
|
GradientStop gs = new GradientStop
|
||||||
{
|
{
|
||||||
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color1),
|
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color1),
|
||||||
|
|||||||
@@ -50,20 +50,24 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
public static void EnableBlur(Window window)
|
public static void EnableBlur(Window window)
|
||||||
{
|
{
|
||||||
var windowHelper = new WindowInteropHelper(window);
|
WindowInteropHelper windowHelper = new WindowInteropHelper(window);
|
||||||
|
|
||||||
var accent = new AccentPolicy();
|
AccentPolicy accent = new AccentPolicy
|
||||||
accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND;
|
{
|
||||||
|
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);
|
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||||
|
|
||||||
var data = new WindowCompositionAttributeData();
|
WindowCompositionAttributeData data = new WindowCompositionAttributeData
|
||||||
data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
|
{
|
||||||
data.SizeOfData = accentStructSize;
|
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
|
||||||
data.Data = accentPtr;
|
SizeOfData = accentStructSize,
|
||||||
|
Data = accentPtr
|
||||||
|
};
|
||||||
|
|
||||||
SetWindowCompositionAttribute(windowHelper.Handle, ref data);
|
SetWindowCompositionAttribute(windowHelper.Handle, ref data);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user