rename to FlyoutBase and DialogBase

This commit is contained in:
2024-04-29 06:19:50 +02:00
parent fce33f1e35
commit 3031f7196d
10 changed files with 37 additions and 37 deletions

View File

@@ -9,7 +9,7 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
namespace Pilz.UI.Telerik.Dialogs
{
partial class DialogBaseForm
partial class DialogBase
{
public delegate void DialogLoadingEventHandler(DialogLoadingEventArgs e);
public delegate void DialogClosedEventHandler(DialogClosedEventArgs e);
@@ -17,60 +17,60 @@ namespace Pilz.UI.Telerik.Dialogs
public static event DialogLoadingEventHandler? DialogLoading;
public static event DialogClosedEventHandler? DialogClosed;
public static T Show<T>(string title, Icon icon, object? tag = null) where T : FlyoutDialogBase
public static T Show<T>(string title, Icon icon, object? tag = null) where T : FlyoutBase
{
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 : FlyoutBase
{
return ShowDialog<T>(null, title, icon, tag);
}
public static T Show<T>(IWin32Window? parent, string title, Icon icon, object? tag = null) where T : FlyoutDialogBase
public static T Show<T>(IWin32Window? parent, string title, Icon icon, object? tag = null) where T : FlyoutBase
{
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 : FlyoutBase
{
return ShowDialog(CreatePanelInstance<T>(tag), parent, title, icon);
}
public static T Show<T>(T dialogPanel, string title, Icon icon) where T : FlyoutDialogBase
public static T Show<T>(T dialogPanel, string title, Icon icon) where T : FlyoutBase
{
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 : FlyoutBase
{
return ShowDialog(dialogPanel, null, title, icon);
}
public static T Show<T>(T dialogPanel, IWin32Window? parent, string title, Icon icon) where T : FlyoutDialogBase
public static T Show<T>(T dialogPanel, IWin32Window? parent, string title, Icon icon) where T : FlyoutBase
{
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 : FlyoutBase
{
CreateForm(dialogPanel, parent, title, icon).ShowDialog();
return dialogPanel;
}
private static T CreatePanelInstance<T>(object? tag) where T : FlyoutDialogBase
private static T CreatePanelInstance<T>(object? tag) where T : FlyoutBase
{
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
private static DialogBase CreateForm<T>(T dialogPanel, IWin32Window? parent, string title, Icon icon) where T : FlyoutBase
{
dialogPanel.Dock = DockStyle.Fill;
var dialog = new DialogBaseForm(dialogPanel)
var dialog = new DialogBase(dialogPanel)
{
Text = title,
Icon = icon,

View File

@@ -8,17 +8,17 @@ using Telerik.WinControls.UI;
namespace Pilz.UI.Telerik.Dialogs
{
public partial class DialogBaseForm : RadForm
public partial class DialogBase : RadForm
{
public FlyoutDialogBase? DialogPanel { get; private set; }
public FlyoutBase? DialogPanel { get; private set; }
private DialogBaseForm()
private DialogBase()
{
Load += DialogBaseForm_Load;
FormClosed += DialogBaseForm_FormClosed;
}
public DialogBaseForm(FlyoutDialogBase? dialogPanel) : this()
public DialogBase(FlyoutBase? dialogPanel) : this()
{
DialogPanel = dialogPanel;
}

View File

@@ -9,10 +9,10 @@ namespace Pilz.UI.Telerik.Dialogs
{
public class DialogClosedEventArgs : EventArgs
{
public DialogBaseForm Parent { get; private set; }
public FlyoutDialogBase? Content => Parent?.DialogPanel;
public DialogBase Parent { get; private set; }
public FlyoutBase? Content => Parent?.DialogPanel;
public DialogClosedEventArgs(DialogBaseForm dialog)
public DialogClosedEventArgs(DialogBase dialog)
{
Parent = dialog;
}

View File

@@ -10,10 +10,10 @@ namespace Pilz.UI.Telerik.Dialogs
{
public class DialogLoadingEventArgs : EventArgs
{
public DialogBaseForm Parent { get; private set; }
public FlyoutDialogBase? Content => Parent?.DialogPanel;
public DialogBase Parent { get; private set; }
public FlyoutBase? Content => Parent?.DialogPanel;
public DialogLoadingEventArgs(DialogBaseForm dialog)
public DialogLoadingEventArgs(DialogBase dialog)
{
Parent = dialog;
}

View File

@@ -1,6 +1,6 @@
namespace Pilz.UI.Telerik.Dialogs
{
partial class FlyoutDialogBase
partial class FlyoutBase
{
/// <summary>
/// Erforderliche Designervariable.
@@ -28,7 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FlyoutDialogBase));
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FlyoutBase));
radButton_Cancel = new global::Telerik.WinControls.UI.RadButton();
radButton_Confirm = new global::Telerik.WinControls.UI.RadButton();
tableLayoutPanel_ActionButtons = new TableLayoutPanel();

View File

@@ -9,7 +9,7 @@ using System.Windows.Forms;
namespace Pilz.UI.Telerik.Dialogs
{
partial class FlyoutDialogBase
partial class FlyoutBase
{
public delegate void FlyoutCreatedEventHandler(FlyoutCreatedEventArgs e);
public delegate void FlyoutClosedEventHandler(FlyoutClosedEventArgs e);
@@ -32,7 +32,7 @@ namespace Pilz.UI.Telerik.Dialogs
private static object? tagToAssign = null;
public static Control? ParentContext { get; private set; } = null;
static FlyoutDialogBase()
static FlyoutBase()
{
RadFlyoutManager.ContentCreated += RadFlyoutManager_ContentCreated;
RadFlyoutManager.FlyoutClosed += RadFlyoutManager_FlyoutClosed;
@@ -40,12 +40,12 @@ namespace Pilz.UI.Telerik.Dialogs
private static void RadFlyoutManager_ContentCreated(ContentCreatedEventArgs e)
{
if (e.Content is FlyoutDialogBase dialogBase)
if (e.Content is FlyoutBase dialogBase)
{
if (tagToAssign != null)
dialogBase.Tag = tagToAssign;
var eventArgs = new FlyoutCreatedEventArgs((FlyoutDialogBase)e.Content);
var eventArgs = new FlyoutCreatedEventArgs((FlyoutBase)e.Content);
if (dialogBase is ILoadContent iLoadContent)
iLoadContent.LoadContent();
@@ -62,9 +62,9 @@ namespace Pilz.UI.Telerik.Dialogs
private static void RadFlyoutManager_FlyoutClosed(global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs e)
{
if (e.Content is FlyoutDialogBase dialogBase)
if (e.Content is FlyoutBase dialogBase)
{
var eventArgs = new FlyoutClosedEventArgs((FlyoutDialogBase)e.Content);
var eventArgs = new FlyoutClosedEventArgs((FlyoutBase)e.Content);
foreach (var args in flyoutCloseHandlers)
{

View File

@@ -15,7 +15,7 @@ using static Telerik.WinControls.UI.PopupEditorNotificationData;
namespace Pilz.UI.Telerik.Dialogs
{
public partial class FlyoutDialogBase : UserControl
public partial class FlyoutBase : UserControl
{
public static RadSvgImage? CancelSvg { get; set; } = null;
public static RadSvgImage? ConfirmSvg { get; set; } = null;
@@ -48,7 +48,7 @@ namespace Pilz.UI.Telerik.Dialogs
set => radButton_Confirm.Enabled = value;
}
protected FlyoutDialogBase()
protected FlyoutBase()
{
InitializeComponent();
ParentChanged += FlyoutDialogBase_ParentChanged;
@@ -74,7 +74,7 @@ namespace Pilz.UI.Telerik.Dialogs
{
Result = result;
if (FindForm() is DialogBaseForm dialogForm)
if (FindForm() is DialogBase dialogForm)
dialogForm.Close();
else
CloseFlyout();

View File

@@ -9,9 +9,9 @@ namespace Pilz.UI.Telerik.Dialogs
{
public class FlyoutClosedEventArgs : global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs
{
public new FlyoutDialogBase? Content => base.Content as FlyoutDialogBase;
public new FlyoutBase? Content => base.Content as FlyoutBase;
public FlyoutClosedEventArgs(FlyoutDialogBase content) : base(content)
public FlyoutClosedEventArgs(FlyoutBase content) : base(content)
{
}
}

View File

@@ -10,9 +10,9 @@ namespace Pilz.UI.Telerik.Dialogs
{
public class FlyoutCreatedEventArgs : ContentCreatedEventArgs
{
public new FlyoutDialogBase? Content => base.Content as FlyoutDialogBase;
public new FlyoutBase? Content => base.Content as FlyoutBase;
public FlyoutCreatedEventArgs(FlyoutDialogBase content) : base(content)
public FlyoutCreatedEventArgs(FlyoutBase content) : base(content)
{
}
}