33 lines
899 B
C#
33 lines
899 B
C#
namespace Pilz.UI.WinForms.Dialogs;
|
|
|
|
public partial class DialogBase : Form
|
|
{
|
|
public FlyoutBase? DialogPanel { get; private set; }
|
|
|
|
private DialogBase()
|
|
{
|
|
Load += DialogBaseForm_Load;
|
|
FormClosed += DialogBaseForm_FormClosed;
|
|
}
|
|
|
|
public DialogBase(FlyoutBase? dialogPanel) : this()
|
|
{
|
|
DialogPanel = dialogPanel;
|
|
}
|
|
|
|
private void DialogBaseForm_Load(object? sender, EventArgs e)
|
|
{
|
|
if (DialogPanel is ILoadContent iLoadContent)
|
|
iLoadContent.LoadContent();
|
|
else if (DialogPanel is ILoadContentAsync iLoadContentAsync)
|
|
Task.Run(iLoadContentAsync.LoadContentAsync).Wait();
|
|
|
|
DialogLoading?.Invoke(new DialogLoadingEventArgs(this));
|
|
}
|
|
|
|
private void DialogBaseForm_FormClosed(object? sender, FormClosedEventArgs e)
|
|
{
|
|
DialogClosed?.Invoke(new DialogClosedEventArgs(this));
|
|
}
|
|
}
|