/// <summary>
        /// Create and open a Modal
        /// </summary>
        /// <returns></returns>
        public Task <ModalRef <TResult> > CreateModalAsync <TResult>(ModalOptions config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            var modalRef = new ModalRef <TResult>(config, this);

            config.ModalRef = modalRef;
            return(CreateOrOpenModalAsync(modalRef));
        }
        /// <summary>
        /// Create and open a Modal with template
        /// </summary>
        /// <typeparam name="TComponent"></typeparam>
        /// <typeparam name="TComponentOptions"></typeparam>
        /// <param name="config"></param>
        /// <param name="componentOptions"></param>
        /// <returns></returns>
        public Task <ModalRef> CreateModalAsync <TComponent, TComponentOptions>(ModalOptions config, TComponentOptions componentOptions) where TComponent : FeedbackComponent <TComponentOptions>
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            ModalRef modalRef = new ModalRef(config, this);

            void Child(RenderTreeBuilder builder)
            {
                builder.OpenComponent <TComponent>(0);
                builder.AddAttribute(1, "FeedbackRef", modalRef);
                builder.AddAttribute(2, "Options", componentOptions);
                builder.CloseComponent();
            }

            config.Content  = Child;
            config.ModalRef = modalRef;
            return(CreateOrOpenModalAsync(modalRef));
        }
Ejemplo n.º 3
0
 internal ModalRef(ModalOptions config, ModalService modalService)
 {
     Config   = config;
     _service = modalService;
 }