add DialogBaseForm.Show()
This commit is contained in:
@@ -17,16 +17,29 @@ namespace Pilz.UI.Telerik.Dialogs
|
|||||||
public static event DialogLoadingEventHandler? DialogLoading;
|
public static event DialogLoadingEventHandler? DialogLoading;
|
||||||
public static event DialogClosedEventHandler? DialogClosed;
|
public static event DialogClosedEventHandler? DialogClosed;
|
||||||
|
|
||||||
|
public static T Show<T>(string title, Icon icon, object? tag = null) where T : FlyoutDialogBase
|
||||||
|
{
|
||||||
|
return Show<T>(null, title, icon, tag);
|
||||||
|
}
|
||||||
|
|
||||||
public static T ShowDialog<T>(string title, Icon icon, object? tag = null) where T : FlyoutDialogBase
|
public static T ShowDialog<T>(string title, Icon icon, object? tag = null) where T : FlyoutDialogBase
|
||||||
{
|
{
|
||||||
return ShowDialog<T>(null, title, icon, tag);
|
return ShowDialog<T>(null, title, icon, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static T Show<T>(IWin32Window? parent, string title, Icon icon, object? tag = null) where T : FlyoutDialogBase
|
||||||
|
{
|
||||||
|
return Show(CreatePanelInstance<T>(tag), parent, title, icon);
|
||||||
|
}
|
||||||
|
|
||||||
public static T ShowDialog<T>(IWin32Window? parent, string title, Icon icon, object? tag = null) where T : FlyoutDialogBase
|
public static T ShowDialog<T>(IWin32Window? parent, string title, Icon icon, object? tag = null) where T : FlyoutDialogBase
|
||||||
{
|
{
|
||||||
T dialogPanel = Activator.CreateInstance<T>();
|
return ShowDialog(CreatePanelInstance<T>(tag), parent, title, icon);
|
||||||
dialogPanel.Tag = tag;
|
}
|
||||||
return ShowDialog(dialogPanel, parent, title, icon);
|
|
||||||
|
public static T Show<T>(T dialogPanel, string title, Icon icon) where T : FlyoutDialogBase
|
||||||
|
{
|
||||||
|
return Show(dialogPanel, null, title, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T ShowDialog<T>(T dialogPanel, string title, Icon icon) where T : FlyoutDialogBase
|
public static T ShowDialog<T>(T dialogPanel, string title, Icon icon) where T : FlyoutDialogBase
|
||||||
@@ -34,7 +47,26 @@ namespace Pilz.UI.Telerik.Dialogs
|
|||||||
return ShowDialog(dialogPanel, null, title, icon);
|
return ShowDialog(dialogPanel, null, title, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static T Show<T>(T dialogPanel, IWin32Window? parent, string title, Icon icon) where T : FlyoutDialogBase
|
||||||
|
{
|
||||||
|
CreateForm(dialogPanel, parent, title, icon).Show();
|
||||||
|
return dialogPanel;
|
||||||
|
}
|
||||||
|
|
||||||
public static T ShowDialog<T>(T dialogPanel, IWin32Window? parent, string title, Icon icon) where T : FlyoutDialogBase
|
public static T ShowDialog<T>(T dialogPanel, IWin32Window? parent, string title, Icon icon) where T : FlyoutDialogBase
|
||||||
|
{
|
||||||
|
CreateForm(dialogPanel, parent, title, icon).ShowDialog();
|
||||||
|
return dialogPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static T CreatePanelInstance<T>(object? tag) where T : FlyoutDialogBase
|
||||||
|
{
|
||||||
|
T dialogPanel = Activator.CreateInstance<T>();
|
||||||
|
dialogPanel.Tag = tag;
|
||||||
|
return dialogPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static DialogBaseForm CreateForm<T>(T dialogPanel, IWin32Window? parent, string title, Icon icon) where T : FlyoutDialogBase
|
||||||
{
|
{
|
||||||
dialogPanel.Dock = DockStyle.Fill;
|
dialogPanel.Dock = DockStyle.Fill;
|
||||||
|
|
||||||
@@ -47,9 +79,8 @@ namespace Pilz.UI.Telerik.Dialogs
|
|||||||
};
|
};
|
||||||
|
|
||||||
dialog.Controls.Add(dialogPanel);
|
dialog.Controls.Add(dialogPanel);
|
||||||
dialog.ShowDialog(parent);
|
|
||||||
|
|
||||||
return dialogPanel;
|
return dialog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user