public void Show <T>(string title, NoJSModalParameters parameters = null, NoJSModalOptions options = null) where T : ComponentBase { Show(title, typeof(T), parameters ?? new NoJSModalParameters(), options ?? new NoJSModalOptions()); }
/// <summary> /// Shows the modal using the specified <paramref name="title"/> and <paramref name="componentType"/>, /// passing the specified <paramref name="parameters"/> and setting a custom CSS style. /// </summary> /// <param name="title">Modal title.</param> /// <param name="componentType">Type of component to display.</param> /// <param name="parameters">Key/Value collection of parameters to pass to component being displayed.</param> /// <param name="options">Options to configure the modal.</param> public void Show(string title, Type componentType, NoJSModalParameters parameters, NoJSModalOptions options) { if (!typeof(ComponentBase).IsAssignableFrom(componentType)) { throw new ArgumentException($"{componentType.FullName} must be a Blazor Component"); } var content = new RenderFragment(x => { x.OpenComponent(1, componentType); x.CloseComponent(); }); OnShow?.Invoke(title, content, parameters, options); }
/// <summary> /// Shows the modal using the specified title and component type. /// </summary> /// <param name="title">Modal title.</param> /// <param name="componentType">Type of component to display.</param> /// <param name="options">Options to configure the modal.</param> public void Show(string title, Type componentType, NoJSModalOptions options) { Show(title, componentType, new NoJSModalParameters(), options); }