예제 #1
0
        /// <summary>
        /// Adds a Material.Blazor <see cref="IMBAnimatedNavigationManager"/> to the service collection to apply
        /// fade out/in animation to Blazor page navigation.
        /// <example>
        /// <para>You can optionally add configuration:</para>
        /// <code>
        /// services.AddMBAnimatedNavigationService(new MBAnimatedNaviationServiceConfiguration()
        /// {
        ///     ApplyAnimation = true,
        ///     AnimationTime = 300   /* milliseconds */
        /// });
        /// </code>
        /// </example>
        /// </summary>
        private static IServiceCollection AddMBAnimatedNavigationService(this IServiceCollection services, MBAnimatedNavigationManagerServiceConfiguration configuration = null)
        {
            if (configuration == null)
            {
                configuration = new MBAnimatedNavigationManagerServiceConfiguration();
            }

            return(services.AddScoped <IMBAnimatedNavigationManager, AnimatedNavigationManagerService>(serviceProvider => new AnimatedNavigationManagerService(serviceProvider.GetRequiredService <NavigationManager>(), configuration)));
        }
 public AnimatedNavigationManagerService(NavigationManager navigationManager, MBAnimatedNavigationManagerServiceConfiguration configuration)
 {
     NavigationManager = navigationManager;
     Configuration     = configuration;
 }
예제 #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());
 }
예제 #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());
 }