代码清理/拾色器功能/部分程序优化
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
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;
|
||||
|
||||
@@ -29,9 +24,9 @@ namespace GeekDesk.Util
|
||||
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);
|
||||
|
||||
@@ -67,7 +62,7 @@ namespace GeekDesk.Util
|
||||
lgb.GradientStops.Add(gs2);
|
||||
MainWindow.mainWindow.BGBorder.Background = lgb;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
15
Util/ColorUtil.cs
Normal file
15
Util/ColorUtil.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
public class ColorUtil
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using IWshRuntimeLibrary;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
@@ -21,17 +20,17 @@ namespace GeekDesk.Util
|
||||
return list;
|
||||
}
|
||||
|
||||
[DllImport("User32.dll")]
|
||||
public static extern int PrivateExtractIcons(
|
||||
string lpszFile, //文件名可以是exe,dll,ico,cur,ani,bmp
|
||||
int nIconIndex, //从第几个图标开始获取
|
||||
int cxIcon, //获取图标的尺寸x
|
||||
int cyIcon, //获取图标的尺寸y
|
||||
IntPtr[] phicon, //获取到的图标指针数组
|
||||
int[] piconid, //图标对应的资源编号
|
||||
int nIcons, //指定获取的图标数量,仅当文件类型为.exe 和 .dll时候可用
|
||||
int flags //标志,默认0就可以,具体可以看LoadImage函数
|
||||
);
|
||||
[DllImport("User32.dll")]
|
||||
public static extern int PrivateExtractIcons(
|
||||
string lpszFile, //文件名可以是exe,dll,ico,cur,ani,bmp
|
||||
int nIconIndex, //从第几个图标开始获取
|
||||
int cxIcon, //获取图标的尺寸x
|
||||
int cyIcon, //获取图标的尺寸y
|
||||
IntPtr[] phicon, //获取到的图标指针数组
|
||||
int[] piconid, //图标对应的资源编号
|
||||
int nIcons, //指定获取的图标数量,仅当文件类型为.exe 和 .dll时候可用
|
||||
int flags //标志,默认0就可以,具体可以看LoadImage函数
|
||||
);
|
||||
|
||||
|
||||
public static BitmapImage GetBitmapImage(string filePath)
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using IWshRuntimeLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
|
||||
@@ -53,7 +53,8 @@ namespace GeekDesk.Util
|
||||
UnregisterHotKey(handleTemp[id].Handle, id);
|
||||
GlobalHotKey.handleTemp[id].Dispose();
|
||||
GlobalHotKey.handleTemp.Remove(id);
|
||||
} catch
|
||||
}
|
||||
catch
|
||||
{
|
||||
//nothing
|
||||
}
|
||||
@@ -75,7 +76,7 @@ namespace GeekDesk.Util
|
||||
{
|
||||
CreateHandle(new CreateParams());
|
||||
this.callback += callback;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly int WM_HOTKEY = 0x0312;
|
||||
protected override void WndProc(ref Message m)
|
||||
@@ -94,4 +95,4 @@ namespace GeekDesk.Util
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
@@ -48,27 +45,30 @@ namespace GeekDesk.Util
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
}
|
||||
} catch
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void WriteLog(string msg)
|
||||
{
|
||||
try {
|
||||
using (FileStream fs = File.Open(Constants.LOG_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
||||
try
|
||||
{
|
||||
fs.Seek(0, SeekOrigin.End);
|
||||
byte[] buffer = Encoding.Default.GetBytes("-------------------------------------------------------\r\n");
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
using (FileStream fs = File.Open(Constants.LOG_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
||||
{
|
||||
fs.Seek(0, SeekOrigin.End);
|
||||
byte[] buffer = Encoding.Default.GetBytes("-------------------------------------------------------\r\n");
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
|
||||
buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + msg + "\r\n" );
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + msg + "\r\n");
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
}
|
||||
} catch { }
|
||||
catch { }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
|
||||
using System.Windows.Forms;
|
||||
using GeekDesk.Constant;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media.Animation;
|
||||
using GeekDesk.Constant;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
@@ -71,7 +70,7 @@ namespace GeekDesk.Util
|
||||
#region 窗体贴边隐藏功能
|
||||
private static void HideWindow(object o, EventArgs e)
|
||||
{
|
||||
if (window.Visibility != Visibility.Visible
|
||||
if (window.Visibility != Visibility.Visible
|
||||
|| RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW) return;
|
||||
|
||||
double screenLeft = SystemParameters.VirtualScreenLeft;
|
||||
@@ -302,12 +301,14 @@ namespace GeekDesk.Util
|
||||
|
||||
public static void WaitHide(int waitTime)
|
||||
{
|
||||
new System.Threading.Thread(()=>
|
||||
System.Threading.Thread t = new System.Threading.Thread(() =>
|
||||
{
|
||||
System.Threading.Thread.Sleep(waitTime);
|
||||
//修改状态为false 继续执行贴边隐藏
|
||||
RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = false;
|
||||
}).Start();
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Security.Permissions;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
@@ -1166,7 +1164,7 @@ namespace GeekDesk.Util
|
||||
Int32 ParseDisplayName(
|
||||
IntPtr hwnd,
|
||||
IntPtr pbc,
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
string pszDisplayName,
|
||||
ref uint pchEaten,
|
||||
out IntPtr ppidl,
|
||||
@@ -1261,7 +1259,7 @@ namespace GeekDesk.Util
|
||||
Int32 SetNameOf(
|
||||
IntPtr hwnd,
|
||||
IntPtr pidl,
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
string pszName,
|
||||
SHGNO uFlags,
|
||||
out IntPtr ppidlOut);
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
public class StringUtil
|
||||
public class StringUtil
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,8 @@ using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Xml;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user