Files
Pilz/Pilz.UI/Extensions/DialogResultExtensions.cs
2024-07-29 09:40:52 +02:00

32 lines
831 B
C#

using System.Diagnostics.CodeAnalysis;
namespace Pilz.UI.Extensions;
public static class DialogResultExtensions
{
public static bool Is([NotNullWhen(true)] this DialogResult? @this, DialogResult result)
{
return @this == result;
}
public static bool Is([NotNullWhen(true)] this DialogResult? @this, params DialogResult[] results)
{
return results.Any(result => @this == result);
}
public static bool IsOk([NotNullWhen(true)] this DialogResult? @this)
{
return @this == DialogResult.OK;
}
public static bool IsYes([NotNullWhen(true)] this DialogResult? @this)
{
return @this == DialogResult.Yes;
}
public static bool IsCancel([NotNullWhen(true)] this DialogResult? @this)
{
return @this == DialogResult.Cancel;
}
}