change UI to UI.WinForms
This commit is contained in:
35
Pilz.UI.WinForms/Dialogs/DialogBase.cs
Normal file
35
Pilz.UI.WinForms/Dialogs/DialogBase.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Pilz.UI.WinForms;
|
||||
using Pilz.UI.WinForms.Dialogs;
|
||||
|
||||
namespace Pilz.UI.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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user