mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-29 15:19:12 +08:00
Merge pull request #206 from tuskermanshu/Mac
fix: Skip window operations in design mode
This commit is contained in:
@@ -32,8 +32,12 @@ internal static partial class WindowExtensions
|
||||
public static void SetMacOSOptionButtonsPosition(this WindowBase window, double x, double y, double spacing = 10.0)
|
||||
{
|
||||
var handle = window.PlatformImpl?.Handle?.Handle;
|
||||
if (Design.IsDesignMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Debug.Assert(handle is not null);
|
||||
if (handle == IntPtr.Zero)
|
||||
if (handle is null || handle == IntPtr.Zero)
|
||||
{
|
||||
throw new ArgumentException("Invalid window handle");
|
||||
}
|
||||
@@ -88,8 +92,12 @@ internal static partial class WindowExtensions
|
||||
public static Size GetMacOSOptionsSize(this WindowBase window, double spacing = 10.0)
|
||||
{
|
||||
var handle = window.PlatformImpl?.Handle?.Handle;
|
||||
if (Design.IsDesignMode)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
Debug.Assert(handle is not null);
|
||||
if (handle == IntPtr.Zero)
|
||||
if (handle is null || handle == IntPtr.Zero)
|
||||
{
|
||||
throw new ArgumentException("Invalid window handle");
|
||||
}
|
||||
@@ -129,8 +137,12 @@ internal static partial class WindowExtensions
|
||||
public static void SetMacOSWindowClosable(this WindowBase window, bool flag)
|
||||
{
|
||||
var handle = window.PlatformImpl?.Handle?.Handle;
|
||||
if (Design.IsDesignMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Debug.Assert(handle is not null);
|
||||
if (handle == IntPtr.Zero)
|
||||
if (handle is null || handle == IntPtr.Zero)
|
||||
{
|
||||
throw new ArgumentException("Invalid window handle");
|
||||
}
|
||||
@@ -147,4 +159,4 @@ internal static partial class WindowExtensions
|
||||
WindowUtilsInterop.SetEnabled(closeButton, flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user