optimized performance

This commit is contained in:
NaBian committed 2020-02-02 14:37:39 +08:00
1 parent e1a07c0acc
commit e9a7123398
16 files changed
+239 -190

No files matched your search

@@ -6,6 +6,7 @@ using System.Runtime.CompilerServices;
#endif
using System.Windows;
using System.Windows.Markup;
using System.Windows.Media.Animation;
using HandyControl.Controls;
using HandyControl.Data;
@@ -50,8 +51,12 @@ namespace HandyControl.Tools
{
SetSystemVersionInfo(config.SystemVersionInfo);
SetLang(config.Lang);
SetTimelineFrameRate(config.TimelineFrameRate);
}
public void SetTimelineFrameRate(int rate) =>
Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata(rate));
public void SetWindowDefaultStyle(object resourceKey = null)
{
var metadata = resourceKey == null
@@ -148,5 +148,7 @@ namespace HandyControl.Tools
public static IntPtr CreateHandle() => new WindowInteropHelper(new Window()).EnsureHandle();
public static IntPtr GetHandle(this Window window) => new WindowInteropHelper(window).EnsureHandle();
public static HwndSource GetHwndSource(this Window window) => HwndSource.FromHwnd(window.GetHandle());
}
}
@@ -42,6 +42,19 @@ namespace HandyControl.Tools.Interop
NIIF_INFO = 0x00000001,
NIIF_WARNING = 0x00000002,
NIIF_ERROR = 0x00000003,
WM_ACTIVATE = 0x0006,
WM_QUIT = 0x0012,
WM_WINDOWPOSCHANGING = 0x0046,
WM_WINDOWPOSCHANGED = 0x0047,
WM_SETICON = 0x0080,
WM_NCCREATE = 0x0081,
WM_NCDESTROY = 0x0082,
WM_NCACTIVATE = 0x0086,
WM_NCRBUTTONDOWN = 0x00A4,
WM_NCRBUTTONUP = 0x00A5,
WM_NCRBUTTONDBLCLK = 0x00A6,
WM_NCUAHDRAWCAPTION = 0x00AE,
WM_NCUAHDRAWFRAME = 0x00AF,
WM_KEYDOWN = 0x0100,
WM_KEYUP = 0x0101,
WM_SYSKEYDOWN = 0x0104,
@@ -53,6 +66,7 @@ namespace HandyControl.Tools.Interop
WM_RBUTTONUP = 0x0205,
WM_CLIPBOARDUPDATE = 0x031D,
WM_USER = 0x0400,
WS_VISIBLE = 0x10000000,
MF_BYPOSITION = 0x400,
MF_SEPARATOR = 0x800,
TB_GETBUTTON = WM_USER + 23,
@@ -61,7 +75,12 @@ namespace HandyControl.Tools.Interop
VERTRES = 10,
DESKTOPVERTRES = 117,
LOGPIXELSX = 88,
LOGPIXELSY = 90;
LOGPIXELSY = 90,
SC_SIZE = 0xF000,
SC_MOVE = 0xF010,
SC_MINIMIZE = 0xF020,
SC_MAXIMIZE = 0xF030,
SC_RESTORE = 0xF120;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
internal class NOTIFYICONDATA
@@ -230,7 +249,7 @@ namespace HandyControl.Tools.Interop
STYLE = -16,
EXSTYLE = -20
}
internal enum GWLP
{
WNDPROC = -4,