bloxstrap/Bloxstrap/Enums/BootstrapperStyle.cs
pizzaboxer 93ad0fb609 Rework dialog handling for better generic support
preparation for FluentDIalog
2023-02-10 10:46:58 +00:00

42 lines
1.2 KiB
C#

using System.Windows.Forms;
using Bloxstrap.Dialogs;
namespace Bloxstrap.Enums
{
public enum BootstrapperStyle
{
VistaDialog,
LegacyDialog2009,
LegacyDialog2011,
ProgressDialog,
}
public static class BootstrapperStyleEx
{
public static void Show(this BootstrapperStyle bootstrapperStyle, Bootstrapper? bootstrapper = null)
{
IBootstrapperDialog dialog = bootstrapperStyle switch
{
BootstrapperStyle.VistaDialog => new VistaDialog(bootstrapper),
BootstrapperStyle.LegacyDialog2009 => new LegacyDialog2009(bootstrapper),
BootstrapperStyle.LegacyDialog2011 => new LegacyDialog2011(bootstrapper),
BootstrapperStyle.ProgressDialog => new ProgressDialog(bootstrapper),
_ => new ProgressDialog(bootstrapper)
};
if (bootstrapper is null)
{
dialog.ShowAsPreview();
}
else
{
if (App.IsQuiet)
dialog.HideBootstrapper();
dialog.ShowAsBootstrapper();
}
}
}
}