69 lines
1.9 KiB
C#
69 lines
1.9 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// SettingControl.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class SettingControl : UserControl
|
|
{
|
|
public SettingControl()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void SimplePanel_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
CommonCode.SaveAppData(MainWindow.appData);
|
|
}
|
|
|
|
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
/// <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);
|
|
}
|
|
} catch (Exception)
|
|
{
|
|
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|