change UI to UI.WinForms
This commit is contained in:
54
Pilz.UI.WinForms/Extensions/DialogResultExtensions.cs
Normal file
54
Pilz.UI.WinForms/Extensions/DialogResultExtensions.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
12
Pilz.UI.WinForms/Extensions/FlyoutBaseExtensions.cs
Normal file
12
Pilz.UI.WinForms/Extensions/FlyoutBaseExtensions.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
11
Pilz.UI.WinForms/Extensions/ImageExtensions.cs
Normal file
11
Pilz.UI.WinForms/Extensions/ImageExtensions.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user