Ejemplo n.º 1
0
        /// <summary>
        /// Create and open a drawer with the template
        /// </summary>
        /// <typeparam name="TComponent">The type of DrawerTemplate implement</typeparam>
        /// <typeparam name="TComponentOptions">The </typeparam>
        /// <typeparam name="TResult">The type of return value</typeparam>
        /// <param name="config"></param>
        /// <param name="options"></param>
        /// <returns>The reference of drawer</returns>
        public async Task <DrawerRef <TResult> > CreateAsync <TComponent, TComponentOptions, TResult>(DrawerOptions config, TComponentOptions options) where TComponent : DrawerTemplate <TComponentOptions, TResult>
        {
            CheckIsNull(config);

            DrawerRef <TResult> drawerRef = new DrawerRef <TResult>(config, this);

            await(OnOpenEvent?.Invoke(drawerRef) ?? Task.CompletedTask);

            RenderFragment child = (builder) =>
            {
                builder.OpenComponent <TComponent>(0);
                builder.AddAttribute(1, "DrawerRef", drawerRef);
                builder.AddAttribute(2, "Options", options);
                builder.CloseComponent();
            };

            config.ChildContent = child;

            return(drawerRef);
        }
Ejemplo n.º 2
0
 internal DrawerRef(DrawerOptions config, DrawerService service) : base(config, service)
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 /// update Confirm dialog config with a new ConfirmOptions
 /// </summary>
 /// <param name="config"></param>
 /// <returns></returns>
 public async Task UpdateConfigAsync(DrawerOptions config)
 {
     Config = config;
     await UpdateConfigAsync();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Create and open a drawer
        /// </summary>
        /// <typeparam name="TComponent"></typeparam>
        /// <typeparam name="TComponentOptions"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="config"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public async Task <TResult> CreateDialogAsync <TComponent, TComponentOptions, TResult>(DrawerOptions config, TComponentOptions options) where TComponent : FeedbackComponent <TComponentOptions, TResult>
        {
            CheckIsNull(config);
            DrawerRef <TResult> drawerRef = new DrawerRef <TResult>(config, this);

            drawerRef.TaskCompletionSource = new TaskCompletionSource <TResult>();;
            await(OnOpenEvent?.Invoke(drawerRef) ?? Task.CompletedTask);

            RenderFragment child = (builder) =>
            {
                builder.OpenComponent <TComponent>(0);
                builder.AddAttribute(1, "FeedbackRef", drawerRef);
                builder.AddAttribute(2, "Options", options);
                builder.CloseComponent();
            };

            config.ChildContent = child;

            return(await drawerRef.TaskCompletionSource.Task);
        }
Ejemplo n.º 5
0
 internal DrawerRef(DrawerOptions options, DrawerService service)
 {
     Config   = options;
     _service = service;
 }