change UI to UI.WinForms

This commit is contained in:
2025-06-16 11:50:17 +02:00
parent fa3a9da07e
commit 299867a910
116 changed files with 318 additions and 319 deletions

View File

@@ -0,0 +1,54 @@
namespace Pilz.UI.WinForms.Extensions;
public static class DialogResultExtensions
{
public static bool Is(this DialogResult @this, DialogResult result)
{
return @this == result;
}
public static bool IsNot(this DialogResult @this, DialogResult result)
{
return @this != result;
}
public static bool Is(this DialogResult @this, params DialogResult[] results)
{
return results.Any(result => @this == result);
}
public static bool IsNot(this DialogResult @this, params DialogResult[] results)
{
return results.All(result => @this != result);
}
public static bool IsOk(this DialogResult @this)
{
return @this == DialogResult.OK;
}
public static bool IsNotOk(this DialogResult @this)
{
return @this != DialogResult.OK;
}
public static bool IsYes(this DialogResult @this)
{
return @this == DialogResult.Yes;
}
public static bool IsNotYes(this DialogResult @this)
{
return @this != DialogResult.Yes;
}
public static bool IsCancel(this DialogResult @this)
{
return @this == DialogResult.Cancel;
}
public static bool IsNotCancel(this DialogResult @this)
{
return @this != DialogResult.Cancel;
}
}

View File

@@ -0,0 +1,12 @@
using Pilz.UI.WinForms.Dialogs;
using System.Diagnostics.CodeAnalysis;
namespace Pilz.UI.WinForms.Extensions;
public static class FlyoutBaseExtensions
{
public static bool IsValid(this FlyoutBase? @this)
{
return @this != null && @this.Result == DialogResult.OK;
}
}

View File

@@ -0,0 +1,11 @@
namespace Pilz.UI.WinForms.Extensions;
public static class ImageExtensions
{
public static Icon? ToIcon(this Image image)
{
if (image is Bitmap bmp)
return Icon.FromHandle(bmp.GetHicon());
return null;
}
}