コード例 #1
0
        /// <summary>
        /// Function to display a simple SweetAlert2 modal.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <param name="icon"></param>
        /// <returns></returns>
        public async Task <SweetAlertResult> FireAsync(string title = null, string message = null, SweetAlertIcon icon = null)
        {
            var  tcs       = new TaskCompletionSource <SweetAlertResult>();
            Guid requestId = Guid.NewGuid();

            PendingFireRequests.Add(requestId, tcs);
            await jSRuntime.InvokeAsync <object>(
                $"{JS_NAMESPACE}.Fire",
                requestId,
                title,
                message,
                icon?.ToString(),
                (int)theme,
                colorSchemeThemes)
            .ConfigureAwait(false);

            return(await tcs.Task.ConfigureAwait(false));
        }
コード例 #2
0
        /// <summary>
        /// Function to display a simple SweetAlert2 modal.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <param name="icon"></param>
        /// <returns></returns>
        public Task <SweetAlertResult> FireAsync(string title = null, string message = null, SweetAlertIcon icon = null)
        {
            SweetAlertOptions newSettings = this.Mix(this.storedOptions);

            newSettings.Title = title;
            newSettings.Html  = message ?? newSettings.Html;
            newSettings.Icon  = icon ?? newSettings.Icon;
            return(this.swal.FireAsync(newSettings));
        }