Пример #1
0
        public Task <object> OpenAsync(Type componentType, MatDialogOptions options)
        {
            var item = new MatDialogReference()
            {
                Service              = this,
                ComponentType        = componentType,
                Options              = options,
                IsOpen               = true,
                TaskCompletionSource = new TaskCompletionSource <object>(),
            };

            item.PortalReference = PortalService.Add(typeof(MatDialogServiceItem), new Dictionary <string, object>()
            {
                { "DialogReference", item }
            });


            return(item.TaskCompletionSource.Task);
        }
Пример #2
0
        public static async Task <object> OpenFullPageAsync(this IMatDialogService matDialogService, Type componentType, MatDialogOptions options)
        {
            #region null checks
            if (matDialogService is null)
            {
                throw new ArgumentNullException(nameof(matDialogService));
            }

            if (componentType is null)
            {
                throw new ArgumentNullException(nameof(componentType));
            }
            #endregion

            options ??= new MatDialogOptions();

            options.SurfaceClass = (options.SurfaceClass ?? string.Empty) + " full-page-dialog";
            options.SurfaceClass = options.SurfaceClass.Trim();

            return(await matDialogService.OpenAsync(componentType, options).ConfigureAwait(true));
        }