添加功能
This commit is contained in:
@@ -46,5 +46,6 @@ namespace GeekDesk.Control
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
@@ -58,17 +59,24 @@ namespace GeekDesk.Control
|
||||
/// <param name="e"></param>
|
||||
private void EditImage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
try
|
||||
{
|
||||
Multiselect = false, //只允许选中单个文件
|
||||
Filter = "所有文件(*.*)|*.*"
|
||||
};
|
||||
if (ofd.ShowDialog() == true)
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
{
|
||||
Multiselect = false, //只允许选中单个文件
|
||||
Filter = "所有文件(*.*)|*.*"
|
||||
};
|
||||
if (ofd.ShowDialog() == true)
|
||||
{
|
||||
IconInfo info = this.DataContext as IconInfo;
|
||||
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
} catch (Exception)
|
||||
{
|
||||
IconInfo info = this.DataContext as IconInfo;
|
||||
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="40,199.5,-40,-189.5" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="图片路径:" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding BacImgName}" Width="200" VerticalAlignment="Center"/>
|
||||
<Button Content="修改" Click="Button_Click"/>
|
||||
<Button Content="修改" Click="BGButton_Click"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="30,22,450,119" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -36,8 +38,30 @@ namespace GeekDesk.Control.UserControls
|
||||
|
||||
}
|
||||
|
||||
private void Button_Click(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("修改背景失败,已重置为默认背景!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user