优化代码

This commit is contained in:
liufei
2021-08-20 16:50:24 +08:00
parent 787c23ef77
commit c231587543
6 changed files with 24 additions and 11 deletions

View File

@@ -32,6 +32,7 @@ namespace GeekDesk.Control.UserControls.Config
ZFBCode.Source = ImageUtil.Base64ToBitmapImage(Constants.ZFB_CODE_IMG_BASE64);
}
/// <summary>
/// 移动窗口
/// </summary>

View File

@@ -30,9 +30,9 @@ namespace GeekDesk.Control.UserControls.Config
public partial class MotionControl : UserControl
{
public static bool hotkeyFinished = true; //热键设置结束
private static KeyEventArgs prevKeyTemp; //上一个按键
private static List<KeyEventArgs> keysTemp = new List<KeyEventArgs>();//存储一次快捷键集合
private static AppConfig appConfig = MainWindow.appData.AppConfig;
private KeyEventArgs prevKeyTemp; //上一个按键
private readonly List<KeyEventArgs> keysTemp = new List<KeyEventArgs>();//存储一次快捷键集合
private readonly AppConfig appConfig = MainWindow.appData.AppConfig;
public MotionControl()
{

View File

@@ -15,10 +15,10 @@ namespace GeekDesk.Control.Windows
/// </summary>
public partial class ConfigWindow
{
private static AboutControl about = new AboutControl();
private static ThemeControl theme = new ThemeControl();
private static MotionControl motion = new MotionControl();
private static OtherControl other = new OtherControl();
private static readonly AboutControl about = new AboutControl();
private static readonly ThemeControl theme = new ThemeControl();
private static readonly MotionControl motion = new MotionControl();
private static readonly OtherControl other = new OtherControl();
public MainWindow mainWindow;
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)

View File

@@ -1,9 +1,9 @@
{
"title" : "<22><EFBFBD><E6B1BE><EFBFBD><EFBFBD>",
"subTitle" : "V2.2 <20><>ʽ<EFBFBD><CABD>",
"subTitle" : "V2.3 <20><>ʽ<EFBFBD><CABD>",
"msgTitle" : "<22><><EFBFBD>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
"msg" : "['<27><>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EBB5AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><><C4AC>Ctrl+Shift+Q)','<27>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>򿪳<EFBFBD><F2BFAAB3><EFBFBD>Ŀ¼<C4BF>˵<EFBFBD>']",
"githubUrl" : "https://github.com/Demo-Liu/GeekDesk/releases/tag",
"giteeUrl" : "https://gitee.com/demo_liu/GeekDesk/releases",
"version": "2.2"
"version": "2.3"
}

9
Update.json.bak Normal file
View File

@@ -0,0 +1,9 @@
{
"title" : "版本更新",
"subTitle" : "V2.3 正式版",
"msgTitle" : "本次更新内容如下",
"msg" : "['边缘吸附功能','窗口淡入淡出动画','待办任务快捷键(默认Ctrl+Shift+Q)','右键任务栏图标打开程序目录菜单']",
"githubUrl" : "https://github.com/Demo-Liu/GeekDesk/releases/tag",
"giteeUrl" : "https://gitee.com/demo_liu/GeekDesk/releases",
"version": "2.3"
}

View File

@@ -6,6 +6,7 @@ using System.Drawing.Imaging;
using System.IO;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace GeekDesk.Util
@@ -22,9 +23,10 @@ namespace GeekDesk.Util
{
using (var ms = new System.IO.MemoryStream(array))
{
var image = new BitmapImage();
BitmapImage image = new BitmapImage();
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad; // here
RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.LowQuality);
image.StreamSource = ms;
image.EndInit();
return image;
@@ -184,7 +186,7 @@ namespace GeekDesk.Util
Bitmap bmpOut = new Bitmap(lnNewWidth, lnNewHeight);
Graphics g = Graphics.FromImage(bmpOut);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.FillRectangle(Brushes.White, 0, 0, lnNewWidth, lnNewHeight);
g.FillRectangle(System.Drawing.Brushes.White, 0, 0, lnNewWidth, lnNewHeight);
g.DrawImage(loBMP, 0, 0, lnNewWidth, lnNewHeight);
loBMP.Dispose();
string tempPath = Constants.APP_DIR + "\\temp";
@@ -211,6 +213,7 @@ namespace GeekDesk.Util
BitmapImage bmImg = new BitmapImage();
bmImg.BeginInit();
bmImg.CacheOption = BitmapCacheOption.OnLoad;
RenderOptions.SetBitmapScalingMode(bmImg, BitmapScalingMode.LowQuality);
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
bmImg.StreamSource = fs;