Ejemplo n.º 1
0
        /// <summary>
        /// Adds a bootstrap providers and component mappings.
        /// </summary>
        /// <param name="serviceCollection"></param>
        /// <returns></returns>
        public static IServiceCollection AddBootstrap5Providers(this IServiceCollection serviceCollection, Action <IClassProvider> configureClassProvider = null)
        {
            var classProvider = new BootstrapClassProvider();

            configureClassProvider?.Invoke(classProvider);

            serviceCollection.AddSingleton <IClassProvider>(classProvider);
            serviceCollection.AddSingleton <IStyleProvider, Bootstrap5StyleProvider>();
            serviceCollection.AddScoped <IThemeGenerator, BootstrapThemeGenerator>();

            serviceCollection.AddBootstrap5Components();

            serviceCollection.AddScoped <IJSModalModule, Modules.BootstrapJSModalModule>();
            serviceCollection.AddScoped <IJSTooltipModule, Modules.BootstrapJSTooltipModule>();

            return(serviceCollection);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a BootStrap5 providers and component mappings.
        /// </summary>
        /// <param name="serviceCollection"></param>
        /// <returns></returns>
        public static IServiceCollection AddDigniteBootStrap5Providers(this IServiceCollection serviceCollection, Action <IClassProvider> configureClassProvider = null)
        {
            var classProvider = new Blazorise.Bootstrap5.BootstrapClassProvider();

            configureClassProvider?.Invoke(classProvider);
            serviceCollection.AddSingleton <IClassProvider>(classProvider);
            serviceCollection.AddSingleton <IStyleProvider, Bootstrap5StyleProvider>();
            serviceCollection.AddScoped <IThemeGenerator, Blazorise.Bootstrap5.BootstrapThemeGenerator>();
            var components = Blazorise.Bootstrap5.Config.ComponentMap;

            components[typeof(FileEditPlus)] = typeof(Platform.Bootstrap5.FileEditPlus);
            foreach (var mapping in components)
            {
                serviceCollection.AddTransient(mapping.Key, mapping.Value);
            }

            serviceCollection.AddScoped <IJSModalModule, Blazorise.Bootstrap5.Modules.BootstrapJSModalModule>();
            serviceCollection.AddScoped <IJSTooltipModule, Blazorise.Bootstrap5.Modules.BootstrapJSTooltipModule>();

            return(serviceCollection);
        }