下班 还有一些小问题 1.0版本就可以发布了
This commit is contained in:
17
Control/UserControls/Config/AboutControl.xaml
Normal file
17
Control/UserControls/Config/AboutControl.xaml
Normal file
@@ -0,0 +1,17 @@
|
||||
<UserControl x:Class="GeekDesk.Control.UserControls.Config.AboutControl"
|
||||
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:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
Background="AliceBlue"
|
||||
d:DesignHeight="400" d:DesignWidth="500">
|
||||
<hc:SimplePanel Margin="20">
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<Image Source="/Resource/Image/Ico.png" Width="250" Height="250"/>
|
||||
<TextBlock Text="这是个人开发的程序,所有人可任意修改和免费试用(商用请联系作者)"/>
|
||||
</StackPanel>
|
||||
</hc:SimplePanel>
|
||||
</UserControl>
|
||||
28
Control/UserControls/Config/AboutControl.xaml.cs
Normal file
28
Control/UserControls/Config/AboutControl.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// AboutControl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AboutControl : UserControl
|
||||
{
|
||||
public AboutControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
71
Control/UserControls/Config/MotionControl.xaml
Normal file
71
Control/UserControls/Config/MotionControl.xaml
Normal file
@@ -0,0 +1,71 @@
|
||||
<UserControl x:Class="GeekDesk.Control.UserControls.Config.MotionControl"
|
||||
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:cvt="clr-namespace:GeekDesk.Converts"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
Background="AliceBlue"
|
||||
d:DesignHeight="300" d:DesignWidth="450">
|
||||
|
||||
<UserControl.Resources>
|
||||
<cvt:HideTypeConvert x:Key="HideTypeConvert"/>
|
||||
</UserControl.Resources>
|
||||
<hc:SimplePanel Margin="20">
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,0,10" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="面板动作设置" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,26.394,0,-16.394" Grid.ColumnSpan="4">
|
||||
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,50,0,-102.337" Grid.ColumnSpan="4">
|
||||
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,89.49,-30,-79.49" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="面板关闭方式" VerticalAlignment="Center" Margin="-26,0,26,0"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="10,115,20,-102.337" Grid.ColumnSpan="4">
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"
|
||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=1}"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="运行项目后"
|
||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=2}"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
|
||||
Style="{StaticResource RadioButtonIcon}" Content="手动关闭"
|
||||
IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,164.49,-30,-154.49" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="热键设置" VerticalAlignment="Center" Margin="-26,0,26,0"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,193,0,-180.337" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="当前热键:"/>
|
||||
<hc:TextBox HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
IsReadOnly="True"
|
||||
IsReadOnlyCaretVisible="True"
|
||||
Width="200"
|
||||
Text="{Binding HotkeyStr}"
|
||||
KeyDown="HotKeyDown"
|
||||
KeyUp="HotKeyUp"
|
||||
Margin="12.967,-7.38,-12.967,0"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</hc:SimplePanel>
|
||||
|
||||
</UserControl>
|
||||
231
Control/UserControls/Config/MotionControl.xaml.cs
Normal file
231
Control/UserControls/Config/MotionControl.xaml.cs
Normal file
@@ -0,0 +1,231 @@
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using GlobalHotKey;
|
||||
using HandyControl.Data;
|
||||
using Microsoft.Win32;
|
||||
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.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// 动作设置
|
||||
/// </summary>
|
||||
public partial class MotionControl : UserControl
|
||||
{
|
||||
private static bool hotkeyFinished = true; //热键设置结束
|
||||
private static KeyEventArgs prevKeyTemp; //上一个按键
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
|
||||
public MotionControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册热键按下
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void HotKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (!e.IsRepeat)
|
||||
{
|
||||
if (hotkeyFinished)
|
||||
{
|
||||
appConfig.Hotkey = 0;
|
||||
appConfig.HotkeyStr = "";
|
||||
appConfig.HotkeyModifiers = 0;
|
||||
hotkeyFinished = false;
|
||||
}
|
||||
//首次按下按键
|
||||
if (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0)
|
||||
{
|
||||
if (CheckModifierKeys(e))
|
||||
{
|
||||
//辅助键
|
||||
appConfig.HotkeyStr = GetKeyName(e);
|
||||
appConfig.HotkeyModifiers = GetModifierKeys(e);
|
||||
prevKeyTemp = e;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//非首次按下 需要判断前一个键值是否为辅助键
|
||||
if (CheckModifierKeys(prevKeyTemp)
|
||||
&& ((e.Key >= Key.A && e.Key <= Key.Z)
|
||||
|| (e.Key >= Key.F1 && e.Key <= Key.F12)
|
||||
|| (e.Key >= Key.D0 && e.Key <= Key.D9)))
|
||||
{
|
||||
appConfig.Hotkey = e.Key;
|
||||
appConfig.HotkeyStr += e.Key.ToString();
|
||||
prevKeyTemp = e;
|
||||
}
|
||||
else if (CheckModifierKeys(e))
|
||||
{
|
||||
appConfig.HotkeyStr += GetKeyName(e);
|
||||
appConfig.HotkeyModifiers |= GetModifierKeys(e);
|
||||
prevKeyTemp = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetKeyName(KeyEventArgs e)
|
||||
{
|
||||
Key key = e.Key;
|
||||
if (key == Key.LeftCtrl || key == Key.RightCtrl)
|
||||
{
|
||||
return "Ctrl + ";
|
||||
} else if (key == Key.LWin || key == Key.RWin)
|
||||
{
|
||||
return "Win + ";
|
||||
}
|
||||
else if (key == Key.LeftShift || key == Key.RightShift)
|
||||
{
|
||||
return "Shift + ";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Alt + ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private HotkeyModifiers GetModifierKeys(KeyEventArgs e)
|
||||
{
|
||||
Key key = e.Key;
|
||||
if (key == Key.LeftCtrl || key == Key.RightCtrl)
|
||||
{
|
||||
return HotkeyModifiers.MOD_CONTROL;
|
||||
}
|
||||
else if (key == Key.LWin || key == Key.RWin)
|
||||
{
|
||||
return HotkeyModifiers.MOD_WIN;
|
||||
}
|
||||
else if (key == Key.LeftShift || key == Key.RightShift)
|
||||
{
|
||||
return HotkeyModifiers.MOD_SHIFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return HotkeyModifiers.MOD_ALT;
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckModifierKeys(KeyEventArgs e)
|
||||
{
|
||||
Key key = e.Key;
|
||||
return key == Key.LeftCtrl || key == Key.RightCtrl
|
||||
|| key == Key.LWin || key == Key.RWin
|
||||
|| key == Key.LeftShift || key == Key.RightShift
|
||||
|| key == Key.LeftAlt || key == Key.RightAlt;
|
||||
}
|
||||
|
||||
|
||||
private void HotKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
hotkeyFinished = true;
|
||||
ConfigWindow cw = (ConfigWindow)Window.GetWindow(this);
|
||||
try
|
||||
{
|
||||
if (cw.mainWindow.hotKeyId != -1)
|
||||
{
|
||||
Hotkey.UnRegist(new WindowInteropHelper(cw.mainWindow).Handle, Hotkey.keymap[cw.mainWindow.hotKeyId]);
|
||||
}
|
||||
cw.mainWindow.hotKeyId = Hotkey.Regist(cw.mainWindow, appConfig.HotkeyModifiers, appConfig.Hotkey, () =>
|
||||
{
|
||||
if (cw.mainWindow.Visibility == Visibility.Collapsed)
|
||||
{
|
||||
cw.mainWindow.ShowApp();
|
||||
}
|
||||
else
|
||||
{
|
||||
cw.mainWindow.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
});
|
||||
} catch (Exception)
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("当前快捷键已被其它程序占用(" + appConfig.HotkeyStr + ")!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ShowApp(MainWindow mainWindow)
|
||||
{
|
||||
if (appConfig.FollowMouse)
|
||||
{
|
||||
ShowAppAndFollowMouse(mainWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Visibility = Visibility.Visible;
|
||||
}
|
||||
Keyboard.Focus(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 随鼠标位置显示面板 (鼠标始终在中间)
|
||||
/// </summary>
|
||||
private void ShowAppAndFollowMouse(MainWindow mainWindow)
|
||||
{
|
||||
//获取鼠标位置
|
||||
System.Windows.Point p = MouseUtil.GetMousePosition();
|
||||
double left = SystemParameters.VirtualScreenLeft;
|
||||
double top = SystemParameters.VirtualScreenTop;
|
||||
double width = SystemParameters.VirtualScreenWidth;
|
||||
double height = SystemParameters.VirtualScreenHeight;
|
||||
double right = width - Math.Abs(left);
|
||||
double bottom = height - Math.Abs(top);
|
||||
|
||||
|
||||
if (p.X - mainWindow.Width / 2 < left)
|
||||
{
|
||||
//判断是否在最左边缘
|
||||
mainWindow.Left = left;
|
||||
}
|
||||
else if (p.X + mainWindow.Width / 2 > right)
|
||||
{
|
||||
//判断是否在最右边缘
|
||||
mainWindow.Left = right - mainWindow.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow.Left = p.X - mainWindow.Width / 2;
|
||||
}
|
||||
|
||||
|
||||
if (p.Y - mainWindow.Height / 2 < top)
|
||||
{
|
||||
//判断是否在最上边缘
|
||||
mainWindow.Top = top;
|
||||
}
|
||||
else if (p.Y + mainWindow.Height / 2 > bottom)
|
||||
{
|
||||
//判断是否在最下边缘
|
||||
mainWindow.Top = bottom - mainWindow.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow.Top = p.Y - mainWindow.Height / 2;
|
||||
}
|
||||
|
||||
mainWindow.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
88
Control/UserControls/Config/ThemeControl.xaml
Normal file
88
Control/UserControls/Config/ThemeControl.xaml
Normal file
@@ -0,0 +1,88 @@
|
||||
<UserControl x:Class="GeekDesk.Control.UserControls.Config.ThemeControl"
|
||||
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:local="clr-namespace:GeekDesk.Control.UserControls.Config"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
Background="AliceBlue"
|
||||
d:DesignHeight="350" d:DesignWidth="450">
|
||||
<hc:SimplePanel Margin="20">
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,-40,-12" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="背景图片" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="19,20,-59,-31.5" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="图片路径:" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding BacImgName}" Width="200"
|
||||
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"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="0,60,0,66" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,80,-40,-89.5" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="托盘不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,110,-40,-122" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding CardOpacity}"
|
||||
Maximum="100"
|
||||
Margin="0,-12,-313.5,19.5"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,135,-40,-161.626" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="背景图片不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,155,-40,-183" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding BgOpacity}"
|
||||
Maximum="100"
|
||||
Margin="0,0,-313.5,7.5"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,195,-40,-208.813" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,215,-40,-241" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding PannelOpacity}"
|
||||
Minimum="50"
|
||||
Maximum="100"
|
||||
Margin="0,0,-313.5,7.5"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,245,-40,-279.313" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,265,-40,-321" Grid.ColumnSpan="4">
|
||||
<hc:PreviewSlider Value="{Binding PannelCornerRadius}"
|
||||
Maximum="25"
|
||||
Margin="0,0,-313.5,7.5"
|
||||
>
|
||||
<hc:PreviewSlider.PreviewContent>
|
||||
<Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</hc:UniformSpacingPanel>
|
||||
</hc:SimplePanel>
|
||||
</UserControl>
|
||||
60
Control/UserControls/Config/ThemeControl.xaml.cs
Normal file
60
Control/UserControls/Config/ThemeControl.xaml.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
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.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// MotionControl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ThemeControl : System.Windows.Controls.UserControl
|
||||
{
|
||||
public ThemeControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改背景图片
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void BGButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
|
||||
try
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
{
|
||||
Multiselect = false, //只允许选中单个文件
|
||||
Filter = "图像文件(*.png, *.jpg)|*.png;*.jpg;*.gif"
|
||||
};
|
||||
if (ofd.ShowDialog() == true)
|
||||
{
|
||||
appConfig.BitmapImage = ImageUtil.GetBitmapImageByFile(ofd.FileName);
|
||||
appConfig.BacImgName = ofd.FileName;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user