예제 #1
0
        public void Show(Type contentComponent, string title, ModalParameters parameters, ModalOptions options)
        {
            if (!typeof(ComponentBase).IsAssignableFrom(contentComponent))
            {
                throw new ArgumentException("Must be a Blazor Component!");
            }

            var content = new RenderFragment(x =>
            {
                x.OpenComponent(1, contentComponent);
                x.CloseComponent();
            });

            var onShowEventArgs = new OnShowEventArgs()
            {
                Title      = title,
                Content    = content,
                Parameters = parameters,
                Options    = options,
            };

            this.modalType = contentComponent;
            this.OnShow?.Invoke(this, onShowEventArgs);
        }
예제 #2
0
 public void Show <T>(string title, ModalParameters parameters = null, ModalOptions options = null)
     where T : ComponentBase
 {
     this.Show(typeof(T), title, parameters, options);
 }
예제 #3
0
 public void Show <T>(string title, ModalParameters parameters)
     where T : ComponentBase
 {
     this.Show <T>(title, parameters, new ModalOptions());
 }