Introduced non generic OpenDialog method. (#2518)

Co-authored-by: pb <pb@gauss-lvs.de>
This commit is contained in:
GAUSS-LVS Dev
2026-04-08 07:58:12 +02:00
committed by GitHub
parent 44b6521a9f
commit c003bf0c08

View File

@@ -143,13 +143,7 @@ namespace Radzen
throw new ArgumentException("The component type must be a subclass of ComponentBase.", nameof(componentType));
}
var method = GetType().GetMethod(nameof(OpenDialog), BindingFlags.Instance | BindingFlags.NonPublic);
if (method == null)
{
throw new InvalidOperationException("OpenDialog method not found.");
}
method.MakeGenericMethod(componentType).Invoke(this, new object[] { title, parameters!, options! });
OpenDialog(title, componentType, parameters, options);
}
/// <summary>
@@ -204,13 +198,7 @@ namespace Radzen
var task = new TaskCompletionSource<dynamic?>();
tasks.Add(task);
var method = GetType().GetMethod(nameof(OpenDialog), BindingFlags.Instance | BindingFlags.NonPublic);
if (method == null)
{
throw new InvalidOperationException("OpenDialog method not found.");
}
method.MakeGenericMethod(componentType).Invoke(this, new object[] { title, parameters!, options! });
OpenDialog(title, componentType, parameters, options);
return task.Task;
}
@@ -441,6 +429,11 @@ namespace Radzen
protected List<DialogOptions> dialogs = new List<DialogOptions>();
internal void OpenDialog<T>(string? title, Dictionary<string, object?>? parameters, DialogOptions? options)
{
OpenDialog(title, typeof(T), parameters, options);
}
internal void OpenDialog(string? title, Type componentType, Dictionary<string, object?>? parameters, DialogOptions? options)
{
// Validate and set default values for the dialog options
options ??= new();
@@ -457,7 +450,7 @@ namespace Radzen
options.WrapperCssClass = !String.IsNullOrEmpty(options.WrapperCssClass) ? options.WrapperCssClass : "";
options.ContentCssClass = !String.IsNullOrEmpty(options.ContentCssClass) ? options.ContentCssClass : "";
OnOpen?.Invoke(title, typeof(T), parameters, options);
OnOpen?.Invoke(title, componentType, parameters, options);
}
/// <summary>