fix: Fixed the problem that the AvaloniaRider plugin on Windows cannot display the live preview for Avalonia XAML

This commit is contained in:
Gadfly 2024-04-12 01:23:08 +08:00
parent f3f39ac593
commit c0b13bdc8c
No known key found for this signature in database
GPG key ID: 9128145F93CFC69C

View file

@ -73,24 +73,19 @@ namespace SourceGit.Native
v.dwOSVersionInfoSize = (uint)Marshal.SizeOf<RTL_OSVERSIONINFOEX>();
if (RtlGetVersion(ref v) == 0 && (v.dwMajorVersion < 10 || v.dwBuildNumber < 22000))
{
Window.WindowStateProperty.Changed.AddClassHandler<Window>((w, e) =>
{
if (w.WindowState != WindowState.Maximized)
{
var margins = new MARGINS { cxLeftWidth = 1, cxRightWidth = 1, cyTopHeight = 1, cyBottomHeight = 1 };
DwmExtendFrameIntoClientArea(w.TryGetPlatformHandle().Handle, ref margins);
Window.WindowStateProperty.Changed.AddClassHandler<Window>((w, e) => ExtendWindowFrame(w));
Window.LoadedEvent.AddClassHandler<Window>((w, e) => ExtendWindowFrame(w));
}
}
});
Window.LoadedEvent.AddClassHandler<Window>((w, e) =>
{
if (w.WindowState != WindowState.Maximized)
private void ExtendWindowFrame(Window w)
{
var platformHandle = w.TryGetPlatformHandle();
if (platformHandle == null)
return;
var margins = new MARGINS { cxLeftWidth = 1, cxRightWidth = 1, cyTopHeight = 1, cyBottomHeight = 1 };
DwmExtendFrameIntoClientArea(w.TryGetPlatformHandle().Handle, ref margins);
}
});
}
DwmExtendFrameIntoClientArea(platformHandle.Handle, ref margins);
}
public string FindGitExecutable()