/// <summary>
        /// Adds a Material.Blazor <see cref="IMBToastService"/> to the service collection to manage toast messages.
        /// <example>
        /// <para>You can optionally add configuration:</para>
        /// <code>
        /// services.AddMBToastService(new MBToastServiceConfiguration()
        /// {
        ///     Postion = MBToastPosition.TopRight,
        ///     CloseMethod = MBToastCloseMethod.Timeout,
        ///     ... etc
        /// });
        /// </code>
        /// </example>
        /// </summary>
        private static IServiceCollection AddMBToastService(this IServiceCollection services, MBToastServiceConfiguration configuration = null)
        {
            if (configuration == null)
            {
                configuration = new MBToastServiceConfiguration();
            }

            return(services.AddScoped <IMBToastService, ToastService>(serviceProvider => new ToastService(configuration)));
        }
 /// <summary>
 /// Adds Snackbar, Toast, and Logging services for Material.Blazor. This is required for any app that uses one or more
 /// of these components. The configurations are optional.
 /// </summary>
 /// <param name="services"></param>
 /// <param name="snackbarServiceConfiguration"></param>
 /// <param name="toastServiceConfiguration"></param>
 /// <param name="loggingServiceConfiguration"></param>
 /// <returns></returns>
 public static IServiceCollection AddMBServices(
     this IServiceCollection services,
     MBLoggingServiceConfiguration loggingServiceConfiguration   = null,
     MBSnackbarServiceConfiguration snackbarServiceConfiguration = null,
     MBToastServiceConfiguration toastServiceConfiguration       = null)
 {
     return(services
            .AddMBLoggingService(loggingServiceConfiguration)
            .AddMBSnackbarService(snackbarServiceConfiguration)
            .AddMBToastService(toastServiceConfiguration)
            .AddMBTooltipService());
 }
Exemple #3
0
 /// <summary>
 /// Adds Toast, Tooltip and Animated Navigation services for Material.Blazor. This is required for any app that uses one or more
 /// of these components. The two configurations are optional.
 /// </summary>
 /// <param name="services"></param>
 /// <param name="toastServiceConfiguration"></param>
 /// <param name="animatedNavigationManagerServiceConfiguration"></param>
 /// <returns></returns>
 public static IServiceCollection AddMBServices(this IServiceCollection services, MBToastServiceConfiguration toastServiceConfiguration = null, MBAnimatedNavigationManagerServiceConfiguration animatedNavigationManagerServiceConfiguration = null)
 {
     return(services
            .AddMBToastService(toastServiceConfiguration)
            .AddMBAnimatedNavigationService(animatedNavigationManagerServiceConfiguration)
            .AddMBTooltipService());
 }
Exemple #4
0
 /// <summary>
 /// Adds Snackbar, Toast, Tooltip and Animated Navigation services for Material.Blazor. This is required for any app that uses one or more
 /// of these components. The two configurations are optional.
 /// </summary>
 /// <param name="services"></param>
 /// <param name="snackbarServiceConfiguration"></param>
 /// <param name="toastServiceConfiguration"></param>
 /// <param name="animatedNavigationManagerServiceConfiguration"></param>
 /// <returns></returns>
 public static IServiceCollection AddMBServices(this IServiceCollection services, MBSnackbarServiceConfiguration snackbarServiceConfiguration = null, MBToastServiceConfiguration toastServiceConfiguration = null, MBAnimatedNavigationManagerServiceConfiguration animatedNavigationManagerServiceConfiguration = null)
 {
     return(services
            .AddScoped <IBatchingJsRuntime, BatchingJsRuntime>()
            .AddMBSnackbarService(snackbarServiceConfiguration)
            .AddMBToastService(toastServiceConfiguration)
            .AddMBAnimatedNavigationService(animatedNavigationManagerServiceConfiguration)
            .AddMBTooltipService());
 }