增加渐变背景切换
This commit is contained in:
@@ -4,42 +4,109 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
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"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
d:DesignHeight="500" d:DesignWidth="450">
|
d:DesignHeight="500" d:DesignWidth="450">
|
||||||
|
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<cvt:BGStyleConvert x:Key="BGStyleConvert"/>
|
||||||
|
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||||
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid MouseDown="DragMove" Background="Transparent">
|
<Grid MouseDown="DragMove" Background="Transparent">
|
||||||
<StackPanel Margin="20" >
|
<StackPanel Margin="20" >
|
||||||
<hc:UniformSpacingPanel Spacing="10" 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="20,0,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="图片路径:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
<TextBlock Text="{Binding BacImgName}" Width="200"
|
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="图 片"
|
||||||
Margin="0,5,0,0"
|
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=1}"/>
|
||||||
VerticalAlignment="Center"
|
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||||
hc:Poptip.HitMode="None"
|
Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="纯 色"
|
||||||
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=2}"/>
|
||||||
hc:Poptip.Content="{Binding BacImgName}"
|
|
||||||
hc:Poptip.Placement="TopLeft"
|
|
||||||
/>
|
|
||||||
<Button Content="修改" Click="BGButton_Click"/>
|
|
||||||
<Button Content="默认" Click="DefaultButton_Click"/>
|
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
<UniformGrid x:Name="ImgBGConf">
|
||||||
<CheckBox x:Name="IconIsAdmin" Content="毛玻璃效果" IsChecked="{Binding BlurEffect}">
|
<hc:TransitioningContentControl TransitionMode="Bottom2TopWithFade"
|
||||||
<CheckBox.Background>
|
Height="130">
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<StackPanel>
|
||||||
<GradientStop Color="#FF9EA3A6"/>
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
</LinearGradientBrush>
|
<TextBlock Text="图片背景" VerticalAlignment="Center"/>
|
||||||
</CheckBox.Background>
|
</hc:UniformSpacingPanel>
|
||||||
</CheckBox>
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,15,0,0" Grid.ColumnSpan="4">
|
||||||
</hc:UniformSpacingPanel>
|
<TextBlock Text="图片路径:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||||
|
<TextBlock Text="{Binding BacImgName}" Width="200"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
hc:Poptip.HitMode="None"
|
||||||
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
|
hc:Poptip.Content="{Binding BacImgName}"
|
||||||
|
hc:Poptip.Placement="TopLeft"
|
||||||
|
/>
|
||||||
|
<Button Content="修改" Click="BGButton_Click"/>
|
||||||
|
<Button Content="默认" Click="DefaultButton_Click"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,10,0,0" Grid.ColumnSpan="4">
|
||||||
|
<CheckBox x:Name="IconIsAdmin" Content="毛玻璃效果" Click="BGStyle_Changed" IsChecked="{Binding BlurEffect}">
|
||||||
|
<CheckBox.Background>
|
||||||
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</CheckBox.Background>
|
||||||
|
</CheckBox>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
|
||||||
|
</UniformGrid>
|
||||||
|
|
||||||
|
<UniformGrid x:Name="GradientBGConf">
|
||||||
|
<hc:TransitioningContentControl TransitionMode="Bottom2TopWithFade"
|
||||||
|
Height="130">
|
||||||
|
<StackPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="纯色背景" VerticalAlignment="Center"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="色彩1:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||||
|
<TextBlock Text="{Binding GradientBGParam.Color1, NotifyOnTargetUpdated=True}"
|
||||||
|
TargetUpdated="Color_TargetUpdated"
|
||||||
|
Width="65"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
/>
|
||||||
|
<Button Content="设置" Tag="Color1" Click="ColorButton_Click"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
|
||||||
|
<TextBlock Text="色彩2:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||||
|
<TextBlock Text="{Binding GradientBGParam.Color2, NotifyOnTargetUpdated=True}"
|
||||||
|
TargetUpdated="Color_TargetUpdated"
|
||||||
|
Width="65"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
/>
|
||||||
|
<Button Content="设置" Tag="Color2" Click="ColorButton_Click"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<Button Content="系统预设"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
hc:Poptip.HitMode="None"
|
||||||
|
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
|
||||||
|
hc:Poptip.Content="{Binding GradientBGParam.Name, Converter={StaticResource StringAppendConvert}, ConverterParameter=当前设置: \{\}}"
|
||||||
|
hc:Poptip.Placement="Top"
|
||||||
|
/>
|
||||||
|
</StackPanel>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
</UniformGrid>
|
||||||
|
|
||||||
|
|
||||||
|
<hc:Divider LineStrokeDashArray="3,3" Margin="0,0,0,0" Height="20" LineStroke="Black" Grid.ColumnSpan="1"/>
|
||||||
|
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="5,-10,0,0" Grid.ColumnSpan="4">
|
||||||
<CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
|
<CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
@@ -49,11 +116,10 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
|
||||||
|
|
||||||
<StackPanel>
|
<StackPanel Margin="0,15,0,0">
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" 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 CardOpacity}"
|
<hc:PreviewSlider Value="{Binding CardOpacity}"
|
||||||
@@ -66,15 +132,17 @@
|
|||||||
</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"/>
|
||||||
</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}"
|
||||||
Maximum="100"
|
ValueChanged="BGOpacity_ValueChanged"
|
||||||
Width="350"
|
Maximum="100"
|
||||||
>
|
Width="350"
|
||||||
|
>
|
||||||
<hc:PreviewSlider.PreviewContent>
|
<hc:PreviewSlider.PreviewContent>
|
||||||
<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>
|
||||||
@@ -131,8 +199,8 @@
|
|||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
|
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
|
||||||
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Width="100"/>
|
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Foreground="{Binding TextColor}" Width="100"/>
|
||||||
<Button Content="选择" Margin="0,-10,0,0" Click="ColorButton_Click"/>
|
<Button Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -18,24 +18,45 @@ using System.Windows.Documents;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Effects;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace GeekDesk.Control.UserControls.Config
|
namespace GeekDesk.Control.UserControls.Config
|
||||||
{
|
{
|
||||||
|
|
||||||
|
enum ColorType
|
||||||
|
{
|
||||||
|
COLOR_1 = 1,
|
||||||
|
COLOR_2 = 2,
|
||||||
|
TEXT_COLOR = 3
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MotionControl.xaml 的交互逻辑
|
/// MotionControl.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ThemeControl : System.Windows.Controls.UserControl
|
public partial class ThemeControl : System.Windows.Controls.UserControl
|
||||||
{
|
{
|
||||||
|
private static ColorType colorType;
|
||||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
|
|
||||||
private System.Windows.Controls.Primitives.ToggleButton toggleButton = null;
|
private System.Windows.Controls.Primitives.ToggleButton toggleButton = null;
|
||||||
public ThemeControl()
|
public ThemeControl()
|
||||||
{
|
{
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
if (appConfig.BGStyle != BGStyle.GradientBac)
|
||||||
|
{
|
||||||
|
GradientBGConf.Visibility = Visibility.Collapsed;
|
||||||
|
ImgBGConf.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImgBGConf.Visibility = Visibility.Collapsed;
|
||||||
|
GradientBGConf.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -64,7 +85,7 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
LogUtil.WriteErrorLog(ex, "修改背景失败,已重置为默认背景!");
|
LogUtil.WriteErrorLog(ex, "修改背景失败,已重置为默认背景!");
|
||||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||||
}
|
}
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -81,12 +102,22 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
LogUtil.WriteErrorLog(ex, "修改背景失败2,已重置为默认背景!");
|
LogUtil.WriteErrorLog(ex, "修改背景失败2,已重置为默认背景!");
|
||||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||||
}
|
}
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ColorButton_Click(object sender, RoutedEventArgs e)
|
private void ColorButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
string tag = (sender as Button).Tag.ToString();
|
||||||
|
switch (tag)
|
||||||
|
{
|
||||||
|
case "Color1":
|
||||||
|
colorType = ColorType.COLOR_1;break;
|
||||||
|
case "Color2":
|
||||||
|
colorType = ColorType.COLOR_2;break;
|
||||||
|
default:
|
||||||
|
colorType = ColorType.TEXT_COLOR;break;
|
||||||
|
}
|
||||||
ColorPanel.Visibility = Visibility.Visible;
|
ColorPanel.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +138,16 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
|
||||||
{
|
{
|
||||||
SolidColorBrush scb = MyColorPicker.SelectedBrush;
|
SolidColorBrush scb = MyColorPicker.SelectedBrush;
|
||||||
appConfig.TextColor = scb.ToString();
|
|
||||||
|
switch (colorType)
|
||||||
|
{
|
||||||
|
case ColorType.COLOR_1:
|
||||||
|
appConfig.GradientBGParam.Color1 = scb.ToString();break;
|
||||||
|
case ColorType.COLOR_2:
|
||||||
|
appConfig.GradientBGParam.Color2 = scb.ToString(); break;
|
||||||
|
default:
|
||||||
|
appConfig.TextColor = scb.ToString();break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -178,6 +218,28 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
ColorPanel.Visibility = Visibility.Collapsed;
|
ColorPanel.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void BGStyle_Changed(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
|
if (appConfig.BGStyle != BGStyle.GradientBac)
|
||||||
|
{
|
||||||
|
GradientBGConf.Visibility = Visibility.Collapsed;
|
||||||
|
ImgBGConf.Visibility = Visibility.Visible;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
ImgBGConf.Visibility = Visibility.Collapsed;
|
||||||
|
GradientBGConf.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BGOpacity_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||||
|
{
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Color_TargetUpdated(object sender, DataTransferEventArgs e)
|
||||||
|
{
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
29
Converts/BGStyleConvert.cs
Normal file
29
Converts/BGStyleConvert.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
class BGStyleConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return (BGStyle)value == (BGStyle)int.Parse(parameter.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
bool isChecked = (bool)value;
|
||||||
|
if (!isChecked)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (BGStyle)int.Parse(parameter.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||||
|
xmlns:cn="clr-namespace:GeekDesk.Constant"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
x:Name="window"
|
x:Name="window"
|
||||||
@@ -33,12 +34,22 @@
|
|||||||
<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"/>
|
||||||
|
<cvt:ArrToBitmapImageConvert x:Key="ArrToBitmapImageConvert"/>
|
||||||
|
<cvt:VisualBrushConvert x:Key="VisualBrushConvert"/>
|
||||||
|
|
||||||
|
|
||||||
|
<Style x:Key="BorderBacStyle" TargetType="Border">
|
||||||
|
|
||||||
|
</Style>
|
||||||
|
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Window.InputBindings>
|
<Window.InputBindings>
|
||||||
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchItem}"/>
|
<KeyBinding Gesture="Ctrl+F" Key="F" Command="{StaticResource SearchItem}"/>
|
||||||
</Window.InputBindings>
|
</Window.InputBindings>
|
||||||
<Window.CommandBindings>
|
<Window.CommandBindings>
|
||||||
<CommandBinding Command="{StaticResource SearchItem}" CanExecute="SearchItem"/>
|
<CommandBinding Command="{StaticResource SearchItem}" CanExecute="SearchItem"/>
|
||||||
|
<!--<CommandBinding Command="ChangeImgBG" Executed="ChangeImgBG_Executed" CanExecute="ChangeImgBG_CanExecute" />-->
|
||||||
|
|
||||||
</Window.CommandBindings>
|
</Window.CommandBindings>
|
||||||
|
|
||||||
<Window.Effect>
|
<Window.Effect>
|
||||||
@@ -48,29 +59,15 @@
|
|||||||
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
|
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
|
||||||
Background="AliceBlue"
|
Background="AliceBlue"
|
||||||
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
|
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
|
||||||
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True"
|
|
||||||
hc:Dialog.Token="IconInfoDialog"
|
hc:Dialog.Token="IconInfoDialog"
|
||||||
Focusable="True"
|
Focusable="True"
|
||||||
>
|
>
|
||||||
<hc:DialogContainer Focusable="True">
|
<hc:DialogContainer Focusable="True">
|
||||||
|
|
||||||
<Border CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0">
|
<Border x:Name="BGBorder"
|
||||||
<!--背景图片-->
|
CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
|
||||||
<Border.Background>
|
BorderThickness="0"
|
||||||
<VisualBrush>
|
>
|
||||||
<VisualBrush.Visual>
|
|
||||||
<Grid ClipToBounds="True">
|
|
||||||
<Image Source="{Binding AppConfig.BitmapImage}" Margin="-30" Opacity="{Binding AppConfig.BgOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
|
||||||
<Image.Effect>
|
|
||||||
<BlurEffect Radius="{Binding AppConfig.BlurValue}"/>
|
|
||||||
</Image.Effect>
|
|
||||||
</Image>
|
|
||||||
</Grid>
|
|
||||||
</VisualBrush.Visual>
|
|
||||||
</VisualBrush>
|
|
||||||
</Border.Background>
|
|
||||||
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
<RowDefinition Height="40" MouseMove="DragMove"></RowDefinition>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ using System.Collections.ObjectModel;
|
|||||||
using NPinyin;
|
using NPinyin;
|
||||||
using GeekDesk.ViewModel.Temp;
|
using GeekDesk.ViewModel.Temp;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using DraggAnimatedPanelExample;
|
||||||
|
|
||||||
namespace GeekDesk
|
namespace GeekDesk
|
||||||
{
|
{
|
||||||
@@ -52,6 +53,7 @@ namespace GeekDesk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示搜索框
|
/// 显示搜索框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -110,7 +112,6 @@ namespace GeekDesk
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
GC.KeepAlive(appData); // 持活
|
|
||||||
this.DataContext = appData;
|
this.DataContext = appData;
|
||||||
if (appData.MenuList.Count == 0)
|
if (appData.MenuList.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -129,6 +130,7 @@ namespace GeekDesk
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
void Window_Loaded(object sender, RoutedEventArgs e)
|
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
BGSettingUtil.BGSetting();
|
||||||
if (!appData.AppConfig.StartedShowPanel)
|
if (!appData.AppConfig.StartedShowPanel)
|
||||||
{
|
{
|
||||||
if (appData.AppConfig.AppAnimation)
|
if (appData.AppConfig.AppAnimation)
|
||||||
|
|||||||
74
Util/BGSettingUtil.cs
Normal file
74
Util/BGSettingUtil.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Effects;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public class BGSettingUtil
|
||||||
|
{
|
||||||
|
private static readonly AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
|
public static void BGSetting()
|
||||||
|
{
|
||||||
|
if (appConfig.BGStyle == BGStyle.ImgBac || appConfig.BGStyle == 0)
|
||||||
|
{
|
||||||
|
Image image = new Image
|
||||||
|
{
|
||||||
|
Effect = new BlurEffect()
|
||||||
|
{
|
||||||
|
Radius = appConfig.BlurValue
|
||||||
|
},
|
||||||
|
Margin = new Thickness(-30),
|
||||||
|
Source = appConfig.BitmapImage,
|
||||||
|
Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2))
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
|
||||||
|
//image.SetBinding(Image.OpacityProperty, binding);
|
||||||
|
|
||||||
|
Grid grid = new Grid
|
||||||
|
{
|
||||||
|
ClipToBounds = true
|
||||||
|
};
|
||||||
|
grid.Children.Add(image);
|
||||||
|
|
||||||
|
VisualBrush vb = new VisualBrush
|
||||||
|
{
|
||||||
|
Visual = grid
|
||||||
|
};
|
||||||
|
MainWindow.mainWindow.BGBorder.Background = vb;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LinearGradientBrush lgb = new LinearGradientBrush();
|
||||||
|
|
||||||
|
GradientStop gs = new GradientStop
|
||||||
|
{
|
||||||
|
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color1),
|
||||||
|
Offset = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
lgb.GradientStops.Add(gs);
|
||||||
|
|
||||||
|
GradientStop gs2 = new GradientStop
|
||||||
|
{
|
||||||
|
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color2),
|
||||||
|
Offset = 1
|
||||||
|
};
|
||||||
|
lgb.GradientStops.Add(gs2);
|
||||||
|
MainWindow.mainWindow.BGBorder.Background = lgb;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user