SEBWIN-312: Made extension method out of WindowUtility.

This commit is contained in:
dbuechel 2019-12-06 10:04:22 +01:00
parent 7cbf9c39d3
commit 3626fbe74f
4 changed files with 7 additions and 7 deletions

View file

@ -163,7 +163,7 @@ namespace SafeExamBrowser.UserInterface.Desktop
if (isMainWindow)
{
WindowUtility.DisableCloseButtonFor(this);
this.DisableCloseButton();
}
}

View file

@ -163,7 +163,7 @@ namespace SafeExamBrowser.UserInterface.Mobile
if (isMainWindow)
{
WindowUtility.DisableCloseButtonFor(this);
this.DisableCloseButton();
}
}

View file

@ -75,7 +75,7 @@
<Compile Include="Utilities\IconResourceLoader.cs" />
<Compile Include="Utilities\Thumbnail.cs" />
<Compile Include="Utilities\VisualExtensions.cs" />
<Compile Include="Utilities\WindowUtility.cs" />
<Compile Include="Utilities\WindowExtensions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SafeExamBrowser.Applications.Contracts\SafeExamBrowser.Applications.Contracts.csproj">

View file

@ -13,17 +13,17 @@ using System.Windows.Interop;
namespace SafeExamBrowser.UserInterface.Shared.Utilities
{
public static class WindowUtility
public static class WindowExtensions
{
private const uint MF_BYCOMMAND = 0x00000000;
private const uint MF_GRAYED = 0x00000001;
private const uint MF_ENABLED = 0x00000000;
private const uint SC_CLOSE = 0xF060;
public static void DisableCloseButtonFor(Window window)
public static void DisableCloseButton(this Window window)
{
var handle = new WindowInteropHelper(window);
var systemMenu = GetSystemMenu(handle.Handle, false);
var helper = new WindowInteropHelper(window);
var systemMenu = GetSystemMenu(helper.Handle, false);
if (systemMenu != IntPtr.Zero)
{