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 namespace Pilz.UI.Telerik.Dialogs
{ {
partial class DialogBaseForm partial class DialogBase
{ {
public delegate void DialogLoadingEventHandler(DialogLoadingEventArgs e); public delegate void DialogLoadingEventHandler(DialogLoadingEventArgs e);
public delegate void DialogClosedEventHandler(DialogClosedEventArgs e); public delegate void DialogClosedEventHandler(DialogClosedEventArgs e);
@@ -17,60 +17,60 @@ 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 public static T Show<T>(string title, Icon icon, object? tag = null) where T : FlyoutBase
{ {
return Show<T>(null, title, icon, tag); 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); 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); 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); 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); 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); 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(); CreateForm(dialogPanel, parent, title, icon).Show();
return dialogPanel; 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(); CreateForm(dialogPanel, parent, title, icon).ShowDialog();
return dialogPanel; 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>(); T dialogPanel = Activator.CreateInstance<T>();
dialogPanel.Tag = tag; dialogPanel.Tag = tag;
return dialogPanel; 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; dialogPanel.Dock = DockStyle.Fill;
var dialog = new DialogBaseForm(dialogPanel) var dialog = new DialogBase(dialogPanel)
{ {
Text = title, Text = title,
Icon = icon, Icon = icon,

View File

@@ -8,17 +8,17 @@ using Telerik.WinControls.UI;
namespace Pilz.UI.Telerik.Dialogs 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; Load += DialogBaseForm_Load;
FormClosed += DialogBaseForm_FormClosed; FormClosed += DialogBaseForm_FormClosed;
} }
public DialogBaseForm(FlyoutDialogBase? dialogPanel) : this() public DialogBase(FlyoutBase? dialogPanel) : this()
{ {
DialogPanel = dialogPanel; DialogPanel = dialogPanel;
} }

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
namespace Pilz.UI.Telerik.Dialogs namespace Pilz.UI.Telerik.Dialogs
{ {
partial class FlyoutDialogBase partial class FlyoutBase
{ {
/// <summary> /// <summary>
/// Erforderliche Designervariable. /// Erforderliche Designervariable.
@@ -28,7 +28,7 @@
/// </summary> /// </summary>
private void InitializeComponent() 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_Cancel = new global::Telerik.WinControls.UI.RadButton();
radButton_Confirm = new global::Telerik.WinControls.UI.RadButton(); radButton_Confirm = new global::Telerik.WinControls.UI.RadButton();
tableLayoutPanel_ActionButtons = new TableLayoutPanel(); tableLayoutPanel_ActionButtons = new TableLayoutPanel();

View File

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

View File

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

View File

@@ -9,9 +9,9 @@ namespace Pilz.UI.Telerik.Dialogs
{ {
public class FlyoutClosedEventArgs : global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs 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 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)
{ {
} }
} }