更新整理

This commit is contained in:
GG Z
2025-04-24 20:56:44 +08:00
parent 155cef46f8
commit 5b6d67b571
813 changed files with 14437 additions and 12362 deletions

View File

@@ -1,18 +1,8 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Windows.Threading;
using WPFluent.Interop;
using WPFluent.Interop.WinDef;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Threading;
namespace WPFluent.Controls;
@@ -58,22 +48,22 @@ public static class PendingBox
{
if (!e.Cancel)
{
_ = User32.SetForegroundWindow(new WindowInteropHelper(owner).Handle);
User32.SetForegroundWindow(new WindowInteropHelper(owner).Handle);
}
};
dialog.Closed += (s, e) =>
{
pending.RaiseClosedEvent(s, e);
_ = User32.EnableWindow(new WindowInteropHelper(owner).Handle, true);
_ = User32.SetForegroundWindow(new WindowInteropHelper(owner).Handle);
User32.EnableWindow(new WindowInteropHelper(owner).Handle, true);
User32.SetForegroundWindow(new WindowInteropHelper(owner).Handle);
};
dialog.Canceled += (s, e) =>
{
pending.RaiseCanceledEvent(s, e);
_ = User32.EnableWindow(new WindowInteropHelper(owner).Handle, true);
User32.EnableWindow(new WindowInteropHelper(owner).Handle, true);
};
_ = User32.EnableWindow(new WindowInteropHelper(owner).Handle, false);
User32.EnableWindow(new WindowInteropHelper(owner).Handle, false);
dialog.Show();
return pending;
});
@@ -92,7 +82,7 @@ public static class PendingBox
owner?.Dispatcher.Invoke(() =>
{
Rect rect = new();
_ = User32.GetWindowRect(new WindowInteropHelper(owner).Handle, out rect);
User32.GetWindowRect(new WindowInteropHelper(owner).Handle, out rect);
Point p = new(rect.Left + (int)((rect.Right - rect.Left) / 2d), rect.Top + (int)((rect.Bottom - rect.Top) / 2d));
center = new(p.X, p.Y);
});
@@ -115,7 +105,7 @@ public static class PendingBox
{
if (!e.Cancel)
{
_ = User32.SetForegroundWindow(new WindowInteropHelper(owner).Handle);
User32.SetForegroundWindow(new WindowInteropHelper(owner).Handle);
}
};
dialog.Closed += (s, e) =>
@@ -164,14 +154,14 @@ file static class LayoutHelper
}
Rect rect = default;
_ = User32.GetWindowRect(hwnd, out rect);
User32.GetWindowRect(hwnd, out rect);
nint monitorHandle = User32.MonitorFromWindow(hwnd, User32.MonitorDefaultTo.Nearest);
User32.MONITORINFO monitorInfo = new()
{
cbSize = Marshal.SizeOf<User32.MONITORINFO>()
};
_ = User32.GetMonitorInfo(monitorHandle, ref monitorInfo);
User32.GetMonitorInfo(monitorHandle, ref monitorInfo);
Rect screen = monitorInfo.rcMonitor;
(double x, double y) = ((int)center.X, (int)center.Y);
@@ -197,6 +187,6 @@ file static class LayoutHelper
y = screen.Top + h;
}
_ = User32.MoveWindow(hwnd, x, y, w, h, false);
User32.MoveWindow(hwnd, x, y, w, h, false);
}
}