Example #1
0
        /// <summary>
        /// Initializes the NInject kernel.
        /// </summary>
        /// <param name="kernel">The dependency injection container.</param>
        /// <param name="settings">The settings of the application.</param>
        private static async Task PrepareDIContainer(IKernel kernel, JsonConfiguration settings)
        {
            // And the constructor module
            kernel.AddConstructor();

            // Bind the rule provider
            kernel.Bind <IDrawingRuleProvider>().To <DrawingRuleProvider>().WithConstructorArgument(settings.GetSettings <DrawingRuleProviderSettings>());

            // Bind the drawer with its settings
            kernel.Bind <IDrawer>().To <MetapostDrawer>().WithConstructorArgument(settings.GetSettings <MetapostDrawerSettings>())
            // And its loaded rules
            .WithConstructorArgument(new MetapostDrawerData(await kernel.Get <IDrawingRuleProvider>().GetDrawingRulesAsync()));

            // Add the ranked theorem IO
            kernel.AddRankedTheoremIO();
        }