prefix Telerik-based type names with "Rad"

This commit is contained in:
2024-06-10 09:48:53 +02:00
parent 99a327f4ed
commit 9e8ca9140f
14 changed files with 56 additions and 48 deletions

View File

@@ -63,7 +63,15 @@ public static class Extensions
/// You usually don't set customClickHandler if you set this parameter to <see cref="true"/>.</param> /// You usually don't set customClickHandler if you set this parameter to <see cref="true"/>.</param>
/// <param name="customClickHandler">Adds a custom click handler. If addDefaultHandler is true, it will only work on <see cref="PluginFeature"/>s.<br/> /// <param name="customClickHandler">Adds a custom click handler. If addDefaultHandler is true, it will only work on <see cref="PluginFeature"/>s.<br/>
/// You usually don't set addDefaultHandler to true if you set this parameter to something not null.</param> /// You usually don't set addDefaultHandler to true if you set this parameter to something not null.</param>
public static void InsertItemsTo(this IEnumerable<PluginFeature> features, RadItemOwnerCollection itemsCollection, bool addDefaultHandler = false, EventHandler? customClickHandler = null, FeatureInsertMode insertMode = FeatureInsertMode.Default, int? customDefault = null, int? customTop = null, int? customBottom = null, FeatureInsertPosition insertSplitter = FeatureInsertPosition.None) public static void InsertItemsTo(this IEnumerable<PluginFeature> features,
RadItemOwnerCollection itemsCollection,
bool addDefaultHandler = false,
EventHandler? customClickHandler = null,
FeatureInsertMode insertMode = FeatureInsertMode.Default,
int? customDefault = null,
int? customTop = null,
int? customBottom = null,
FeatureInsertPosition insertSplitter = FeatureInsertPosition.None)
{ {
var insertDefault = customDefault ?? (insertMode.HasFlag(FeatureInsertMode.DefaultStart) ? 0 : itemsCollection.Count); var insertDefault = customDefault ?? (insertMode.HasFlag(FeatureInsertMode.DefaultStart) ? 0 : itemsCollection.Count);
var insertTop = customTop ?? (insertMode.HasFlag(FeatureInsertMode.InsertTop) || insertMode.HasFlag(FeatureInsertMode.DefaultStart) ? 0 : insertDefault); var insertTop = customTop ?? (insertMode.HasFlag(FeatureInsertMode.InsertTop) || insertMode.HasFlag(FeatureInsertMode.DefaultStart) ? 0 : insertDefault);
@@ -109,7 +117,7 @@ public static class Extensions
private static void RadMenuItem_RMMethod_Click(object? sender, EventArgs e) private static void RadMenuItem_RMMethod_Click(object? sender, EventArgs e)
{ {
if (sender is RadMenuItem item && item.Tag is PluginModule function) if (sender is RadMenuItem item && item.Tag is RadPluginModule function)
function.ShowUI(); function.ShowUI();
} }

View File

@@ -24,7 +24,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="PluginModuleUI.cs"> <Compile Update="RadPluginModuleUI.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
</ItemGroup> </ItemGroup>

View File

@@ -4,7 +4,7 @@ using Telerik.WinControls;
namespace Pilz.Plugins.Advanced.UI.Telerik; namespace Pilz.Plugins.Advanced.UI.Telerik;
public abstract class PluginModule : PluginModule<PluginModuleUI> public abstract class RadPluginModule : PluginModule<RadPluginModuleUI>
{ {
/// <summary> /// <summary>
/// Wrapper for the <see cref="PluginFeature.Icon"/> property to directly use it as <see cref="RadSvgImage"/>. /// Wrapper for the <see cref="PluginFeature.Icon"/> property to directly use it as <see cref="RadSvgImage"/>.
@@ -15,21 +15,21 @@ public abstract class PluginModule : PluginModule<PluginModuleUI>
set => base.Icon = value; set => base.Icon = value;
} }
protected PluginModule(string moduleType, string moduleIdentifier) : base(moduleType, moduleIdentifier) protected RadPluginModule(string moduleType, string moduleIdentifier) : base(moduleType, moduleIdentifier)
{ {
} }
protected PluginModule(string moduleType, string moduleIdentifier, string moduleName) : base(moduleType, moduleIdentifier, moduleName) protected RadPluginModule(string moduleType, string moduleIdentifier, string moduleName) : base(moduleType, moduleIdentifier, moduleName)
{ {
} }
public override void ShowUI(PluginFunctionParameter? @params) public override void ShowUI(PluginFunctionParameter? @params)
{ {
if (CreateNewUI(@params) is PluginModuleUI ui) if (CreateNewUI(@params) is RadPluginModuleUI ui)
{ {
ui.BackColor = Color.Transparent; ui.BackColor = Color.Transparent;
DialogBase.Show(ui, Name!, SvgImage!.ToImage().ToIcon()!); RadDialogBase.Show(ui, Name!, SvgImage!.ToImage().ToIcon()!);
} }
} }
} }

View File

@@ -2,9 +2,9 @@
namespace Pilz.Plugins.Advanced.UI.Telerik; namespace Pilz.Plugins.Advanced.UI.Telerik;
public class PluginModuleUI : FlyoutBase, ILoadContent public class RadPluginModuleUI : RadFlyoutBase, ILoadContent
{ {
public PluginModuleUI() public RadPluginModuleUI()
{ {
ActionPanelVisible = false; ActionPanelVisible = false;
} }
@@ -12,4 +12,4 @@ public class PluginModuleUI : FlyoutBase, ILoadContent
public virtual void LoadContent() public virtual void LoadContent()
{ {
} }
} }

View File

@@ -2,10 +2,10 @@
public class DialogClosedEventArgs : EventArgs public class DialogClosedEventArgs : EventArgs
{ {
public DialogBase Parent { get; private set; } public RadDialogBase Parent { get; private set; }
public FlyoutBase? Content => Parent?.DialogPanel; public RadFlyoutBase? Content => Parent?.DialogPanel;
public DialogClosedEventArgs(DialogBase dialog) public DialogClosedEventArgs(RadDialogBase dialog)
{ {
Parent = dialog; Parent = dialog;
} }

View File

@@ -2,10 +2,10 @@
public class DialogLoadingEventArgs : EventArgs public class DialogLoadingEventArgs : EventArgs
{ {
public DialogBase Parent { get; private set; } public RadDialogBase Parent { get; private set; }
public FlyoutBase? Content => Parent?.DialogPanel; public RadFlyoutBase? Content => Parent?.DialogPanel;
public DialogLoadingEventArgs(DialogBase dialog) public DialogLoadingEventArgs(RadDialogBase dialog)
{ {
Parent = dialog; Parent = dialog;
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
namespace Pilz.UI.Telerik.Dialogs namespace Pilz.UI.Telerik.Dialogs
{ {
partial class FlyoutBase partial class RadFlyoutBase
{ {
/// <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(FlyoutBase)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RadFlyoutBase));
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

@@ -3,7 +3,7 @@ using Telerik.WinControls.UI.SplashScreen;
namespace Pilz.UI.Telerik.Dialogs; namespace Pilz.UI.Telerik.Dialogs;
partial class FlyoutBase partial class RadFlyoutBase
{ {
public delegate void FlyoutCreatedEventHandler(FlyoutCreatedEventArgs e); public delegate void FlyoutCreatedEventHandler(FlyoutCreatedEventArgs e);
public delegate void FlyoutClosedEventHandler(FlyoutClosedEventArgs e); public delegate void FlyoutClosedEventHandler(FlyoutClosedEventArgs e);
@@ -26,7 +26,7 @@ partial class FlyoutBase
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 FlyoutBase() static RadFlyoutBase()
{ {
RadFlyoutManager.ContentCreated += RadFlyoutManager_ContentCreated; RadFlyoutManager.ContentCreated += RadFlyoutManager_ContentCreated;
RadFlyoutManager.FlyoutClosed += RadFlyoutManager_FlyoutClosed; RadFlyoutManager.FlyoutClosed += RadFlyoutManager_FlyoutClosed;
@@ -34,12 +34,12 @@ partial class FlyoutBase
private static void RadFlyoutManager_ContentCreated(ContentCreatedEventArgs e) private static void RadFlyoutManager_ContentCreated(ContentCreatedEventArgs e)
{ {
if (e.Content is FlyoutBase dialogBase) if (e.Content is RadFlyoutBase dialogBase)
{ {
if (tagToAssign != null) if (tagToAssign != null)
dialogBase.Tag = tagToAssign; dialogBase.Tag = tagToAssign;
var eventArgs = new FlyoutCreatedEventArgs((FlyoutBase)e.Content); var eventArgs = new FlyoutCreatedEventArgs((RadFlyoutBase)e.Content);
if (dialogBase is ILoadContent iLoadContent) if (dialogBase is ILoadContent iLoadContent)
iLoadContent.LoadContent(); iLoadContent.LoadContent();
@@ -56,9 +56,9 @@ partial class FlyoutBase
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 FlyoutBase dialogBase) if (e.Content is RadFlyoutBase dialogBase)
{ {
var eventArgs = new FlyoutClosedEventArgs((FlyoutBase)e.Content); var eventArgs = new FlyoutClosedEventArgs((RadFlyoutBase)e.Content);
foreach (var args in flyoutCloseHandlers) foreach (var args in flyoutCloseHandlers)
{ {

View File

@@ -2,7 +2,7 @@
namespace Pilz.UI.Telerik.Dialogs; namespace Pilz.UI.Telerik.Dialogs;
public partial class FlyoutBase : UserControl public partial class RadFlyoutBase : 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;
@@ -35,7 +35,7 @@ public partial class FlyoutBase : UserControl
set => radButton_Confirm.Enabled = value; set => radButton_Confirm.Enabled = value;
} }
protected FlyoutBase() protected RadFlyoutBase()
{ {
InitializeComponent(); InitializeComponent();
ParentChanged += FlyoutDialogBase_ParentChanged; ParentChanged += FlyoutDialogBase_ParentChanged;
@@ -61,7 +61,7 @@ public partial class FlyoutBase : UserControl
{ {
Result = result; Result = result;
if (FindForm() is DialogBase dialogForm) if (FindForm() is RadDialogBase dialogForm)
dialogForm.Close(); dialogForm.Close();
else else
CloseFlyout(); CloseFlyout();