Ejemplo n.º 1
0
 public NinjectContainer()
 {
     kernel = new StandardKernel(new NinjectSettings()
     {
         InjectAttribute = typeof(InjectableAttribute)
     });
 }
Ejemplo n.º 2
0
 private static void LoadModules(KernelBase kernel)
 {
     kernel.Load <CatalogNinjectModule>();
     kernel.Load <OrderNinjectModule>();
     kernel.Load <LoggingNinjectModule>();
     kernel.Load <StatisticsNinjectModule>();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// The register services.
        /// </summary>
        /// <param name="kernel">
        /// The kernel.
        /// </param>
        private static void RegisterServices(KernelBase kernel)
        {
            //kernel.Bind<IFakeService>()
            //    .To<FakeService>();
            kernel.Bind <BankingDbContext>().ToSelf().InRequestScope();

            kernel.Bind <IBankController>().To <BankController>();
            kernel.Bind <IBankService>().To <BankService>();
            kernel.Bind <IBankRepository>().To <BankRepository>().InRequestScope();

            kernel.Bind <ICurrencyController>().To <CurrencyController>();
            kernel.Bind <ICurrencyService>().To <CurrencyService>();
            kernel.Bind <ICurrencyRepository>().To <CurrencyRepository>().InRequestScope();

            kernel.Bind <IHumanController>().To <HumanController>();
            kernel.Bind <IHumanService>().To <HumanService>();
            kernel.Bind <IHumanRepository>().To <HumanRepository>().InRequestScope();

            kernel.Bind <IAccountController>().To <AccountController>();
            kernel.Bind <IAccountService>().To <AccountService>();
            kernel.Bind <IAccountRepository>().To <AccountRepository>().InRequestScope();

            kernel.Bind <IPlasticController>().To <PlasticController>();
            kernel.Bind <IPlasticService>().To <PlasticService>();
            kernel.Bind <IPlasticRepository>().To <PlasticRepository>().InRequestScope();

            kernel.Bind <IParameterizationsController>().To <ParameterizationsController>();
            kernel.Bind <IParameterizationsService>().To <ParameterizationsService>();
            kernel.Bind <IParameterizationsRepository>().To <ParameterizationsRepository>().InRequestScope();

            kernel.Bind <ICacheProvider>().To <CacheProvider>().InSingletonScope();
        }
Ejemplo n.º 4
0
        public static void Setup(IServiceCollection serviceCollection)
        {
            KernelBase kernel = ((NinjectServiceCollection)serviceCollection).Kernel;

            kernel.Components.Add <IBindingResolver, ContravariantBindingResolver>();

            kernel.Bind(x => x.FromAssemblyContaining <IMediator>().SelectAllClasses().BindDefaultInterface());
            kernel.Bind(x => x.FromAssemblyContaining <CreateSnapshotRequest>().SelectAllClasses().InheritedFrom(typeof(IRequestHandler <,>)).BindAllInterfaces());
            kernel.Bind(x => x.FromAssemblyContaining <CreateSnapshotRequestValidator>().SelectAllClasses().InheritedFrom(typeof(AbstractValidator <>)).BindDefaultInterfaces());

            kernel
            .Bind(typeof(IPipelineBehavior <,>))
            .To(typeof(RequestPerformanceBehavior <,>));

            kernel
            .Bind(typeof(IPipelineBehavior <,>))
            .To(typeof(RequestValidationBehavior <,>));

            kernel
            .Bind <ServiceFactory>()
            .ToMethod(x =>
            {
                return(type => x.Kernel.TryGet(type));
            });
        }
Ejemplo n.º 5
0
        private static void SetupAuth(IAppBuilder app, KernelBase kernel)
        {
            app.UseFormsAuthentication(new FormsAuthenticationOptions
            {
                LoginPath          = "/account/login",
                LogoutPath         = "/account/logout",
                CookieHttpOnly     = true,
                AuthenticationType = Constants.JabbRAuthType,
                CookieName         = "jabbr.id",
                ExpireTimeSpan     = TimeSpan.FromDays(30),
                DataProtection     = kernel.Get <IDataProtection>(),
                Provider           = kernel.Get <IFormsAuthenticationProvider>()
            });

            //var config = new FederationConfiguration(loadConfig: false);
            //config.WsFederationConfiguration.Issuer = "";
            //config.WsFederationConfiguration.Realm = "http://localhost:16207/";
            //config.WsFederationConfiguration.Reply = "http://localhost:16207/wsfederation";
            //var cbi = new ConfigurationBasedIssuerNameRegistry();
            //cbi.AddTrustedIssuer("", "");
            //config.IdentityConfiguration.AudienceRestriction.AllowedAudienceUris.Add(new Uri("http://localhost:16207/"));
            //config.IdentityConfiguration.IssuerNameRegistry = cbi;
            //config.IdentityConfiguration.CertificateValidationMode = X509CertificateValidationMode.None;
            //config.IdentityConfiguration.CertificateValidator = X509CertificateValidator.None;

            //app.UseFederationAuthentication(new FederationAuthenticationOptions
            //{
            //    ReturnPath = "/wsfederation",
            //    SigninAsAuthenticationType = Constants.JabbRAuthType,
            //    FederationConfiguration = config,
            //    Provider = new FederationAuthenticationProvider()
            //});

            app.Use(typeof(WindowsPrincipalHandler));
        }
Ejemplo n.º 6
0
        public async Task <SubmitCode> SubmitCode(KernelBase kernel, string codeFragment, SubmissionType submissionType = SubmissionType.Run)
        {
            var command = new SubmitCode(codeFragment, submissionType: submissionType);
            await kernel.SendAsync(command);

            return(command);
        }
Ejemplo n.º 7
0
        private static void RegisterServices(KernelBase kernel)
        {
            // TODO - put in registrations here...


            kernel.Bind <ILikkleApiLogger>().To <LikkleApiLogger>().InSingletonScope();

            kernel.Bind <ILikkleDbContext>().To <LikkleDbContext>();
            kernel.Bind <ILikkleUoW>().To <LikkleUoW>();

            kernel.Bind <IAreaService>().To <AreaService>();
            kernel.Bind <IGroupService>().To <GroupService>();
            kernel.Bind <IUserService>().To <UserService>();
            kernel.Bind <ISubscriptionService>().To <SubscriptionService>();
            kernel.Bind <IAccelometerAlgorithmHelperService>().To <AccelometerAlgorithmHelperService>();
            kernel.Bind <ISubscriptionSettingsService>().To <SubscriptionSettingsService>();

            kernel.Bind <IConfigurationWrapper>().To <ConfigurationWrapper>();
            kernel.Bind <IGeoCodingManager>().To <GeoCodingManager>();
            kernel.Bind <IPhoneValidationManager>().To <PhoneValidationManager>();

            var mapperConfiguration = new MapperConfiguration(cfg => {
                cfg.AddProfile <EntitiesMappingProfile>();
            });

            kernel.Bind <IConfigurationProvider>().ToConstant(mapperConfiguration);
        }
Ejemplo n.º 8
0
 private static void ConfigureMediator(KernelBase kernel)
 {
     kernel.Components.Add <IBindingResolver, ContravariantBindingResolver>();
     kernel.Bind <SingleInstanceFactory>().ToMethod(ctx => t => ctx.Kernel.Get(t));
     kernel.Bind <MultiInstanceFactory>().ToMethod(ctx => t => ctx.Kernel.GetAll(t));
     kernel.Bind <IMediator>().To <Mediator>();
 }
Ejemplo n.º 9
0
        public static void BindMock <TMock>(this KernelBase kernel, Action <Mock <TMock> > mockSetup) where TMock : class
        {
            var mock = new Mock <TMock>();

            mockSetup(mock);
            kernel.Bind <TMock>().ToConstant(mock.Object);
        }
Ejemplo n.º 10
0
        protected override void DoEntryPointD(Tuple <EMVTerminalProcessingOutcome, EMVSelectApplicationResponse, TerminalSupportedKernelAidTransactionTypeCombination, CardKernelAidCombination, EntryPointPreProcessingIndicators> indicators)
        {
            //3.4.1.1
            KernelBase kernel = EMVContactlessKernelActivation.ActivateKernel(tr, cardQProcessor, tornTransactionLogManager, publicKeyCertificateManager, indicators.Item2, indicators.Item3, indicators.Item4, indicators.Item5, cardExceptionManager, configProvider);

            kernel.ExceptionOccured += Kernel_ExceptionOccured;

            //TODO: change config to load only kernel specific tags
            terminalConfigurationData.LoadTerminalConfigurationDataObjects(((TerminalSupportedContactlessKernelAidTransactionTypeCombination)indicators.Item3).KernelEnum, configProvider);

            TLVList requestInput = new TLVList();

            requestInput.AddToList(indicators.Item2.GetFCITemplateTag());
            requestInput.AddListToList(tr.GetTxDataTLV());
            //TERMINAL_TRANSACTION_QUALIFIERS_9F66_KRN ttq = ((TerminalSupportedContactlessKernelAidTransactionTypeCombination)indicators.Item3).TTQ;
            TERMINAL_TRANSACTION_QUALIFIERS_9F66_KRN ttq = indicators.Item5.TTQ;

            if (ttq != null)
            {
                requestInput.AddToList(TLV.Create(EMVTagsEnum.TERMINAL_TRANSACTION_QUALIFIERS_TTQ_9F66_KRN.Tag, ttq.Value.Value));
            }

            KernelRequest request = new KernelRequest(KernelTerminalReaderServiceRequestEnum.ACT, requestInput);

            kernel.KernelQ.EnqueueToInput(request);
            Task.Run(() => kernel.StartNewTransaction(), cancellationTokenForTerminalApplication.Token);
            Task.Run(() => OnProcessCompleted(StartServiceQPRocess(kernel)));
        }
Ejemplo n.º 11
0
 public async Task SubmitCode(KernelBase kernel, string[] submissions, SubmissionType submissionType = SubmissionType.Run)
 {
     foreach (var submission in submissions)
     {
         var cmd = new SubmitCode(submission, submissionType: submissionType);
         await kernel.SendAsync(cmd);
     }
 }
Ejemplo n.º 12
0
 public async Task SubmitCode(KernelBase kernel, string[] codeFragments, SubmissionType submissionType = SubmissionType.Run)
 {
     foreach (var codeFragment in codeFragments)
     {
         var cmd = new SubmitCode(codeFragment, submissionType: submissionType);
         await kernel.SendAsync(cmd);
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Create an <see cref="ApproximatedKernelMappingEstimator"/> that maps input vectors to a low dimensional
 /// feature space where inner products approximate a shift-invariant kernel function.
 /// </summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="outputColumnName">Name of the column resulting from the transformation of <paramref name="inputColumnName"/>.</param>
 /// <param name="inputColumnName">Name of column to transform. If set to <see langword="null"/>,
 /// the value of the <paramref name="outputColumnName"/> will be used as source.
 /// The data type on this column should be a known-sized vector of <see cref="System.Single"/>.</param>
 /// <param name="rank">The dimension of the feature space to map the input to.</param>
 /// <param name="useCosAndSinBases">If <see langword="true"/>, use both of cos and sin basis functions to create
 /// two features for every random Fourier frequency. Otherwise, only cos bases would be used. Note that if set
 /// to <see langword="true"/>, the dimension of the output feature space will be 2*<paramref name="rank"/>.</param>
 /// <param name="generator">The argument that indicates which kernel to use. The two available implementations
 /// are <see cref="GaussianKernel"/> and <see cref="LaplacianKernel"/>.</param>
 /// <param name="seed">The seed of the random number generator for generating the new features (if unspecified, the global random is used).</param>
 /// <example>
 /// <format type="text/markdown">
 /// <![CDATA[
 /// [!code-csharp[ApproximatedKernelMap](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/ApproximatedKernelMap.cs)]
 /// ]]>
 /// </format>
 /// </example>
 public static ApproximatedKernelMappingEstimator ApproximatedKernelMap(this TransformsCatalog catalog,
                                                                        string outputColumnName,
                                                                        string inputColumnName = null,
                                                                        int rank = ApproximatedKernelMappingEstimator.Defaults.Rank,
                                                                        bool useCosAndSinBases = ApproximatedKernelMappingEstimator.Defaults.UseCosAndSinBases,
                                                                        KernelBase generator   = null,
                                                                        int?seed = null)
 => new ApproximatedKernelMappingEstimator(CatalogUtils.GetEnvironment(catalog),
                                           new[] { new ApproximatedKernelMappingEstimator.ColumnOptions(outputColumnName, rank, useCosAndSinBases, inputColumnName, generator, seed) });
Ejemplo n.º 14
0
 private static void RegisterServices(KernelBase kernel)
 {
     kernel.Bind <ApplicationDbContext>().ToSelf();
     kernel.Bind <ApplicationUserManager>().ToMethod(ctx => HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>()).InRequestScope();
     kernel.Bind <ApplicationRoleManager>().ToMethod(ctx => HttpContext.Current.GetOwinContext().GetUserManager <ApplicationRoleManager>()).InRequestScope();
     kernel.Bind <IHttpControllerActivator>().To <ContextCapturingControllerActivator>().InRequestScope();
     kernel.Bind <IAuthRepository>().To <AuthRepository>();
     kernel.Bind <IAuthHelper>().To <AuthHelper>();
 }
Ejemplo n.º 15
0
 public SubmissionParser(KernelBase kernel)
 {
     _kernel        = kernel ?? throw new ArgumentNullException(nameof(kernel));
     KernelLanguage = kernel switch
     {
         CompositeKernel c => c.DefaultKernelName,
                         _ => kernel.Name
     };
 }
Ejemplo n.º 16
0
        public static async Task <int> Do(StartupOptions startupOptions, KernelBase kernel, IConsole console)
        {
            var disposable = Program.StartToolLogging(startupOptions);
            var server     = CreateServer(kernel, console);

            kernel.RegisterForDisposal(disposable);
            await server.Input.LastOrDefaultAsync();

            return(0);
        }
Ejemplo n.º 17
0
 private static void RegisterServices(KernelBase kernel)
 {
     //kernel.Bind<SimpleAuthorizationServerProvider>().To<SimpleAuthorizationServerProvider>();
     kernel.Bind <IGroupService>().To <GroupService>();
     kernel.Bind <IAuthService>().To <AuthService>();
     kernel.Bind <IUserService>().To <UserService>();
     kernel.Bind <IInfoService>().To <InfoService>();
     kernel.Bind <IClientService>().To <ClientService>();
     kernel.Bind <ISaleService>().To <SaleService>();
 }
Ejemplo n.º 18
0
 private static void RegisterServices(KernelBase kernel)
 {
     kernel.Bind <IMedicoRepository>().To <MedicoRepository>();
     kernel.Bind <IFactory <MenuVoice, Model.MenuVoice> >().To <MenuFactory>();
     kernel.Bind <IFactory <Answer, Model.Answer> >().To <AnswerFactory>();
     kernel.Bind <IFactory <AnswerComment, Model.AnswerComment> >().To <AnswerCommentFactory>();
     kernel.Bind <IFactory <Question, Model.Question> >().To <QuestionFactory>();
     kernel.Bind <IFactory <QuestionComment, Model.QuestionComment> >().To <QuestionCommentFactory>();
     kernel.Bind <IFactory <Tag, Model.Tag> >().To <TagFactory>();
     kernel.Bind <IFactory <User, Model.User> >().To <UserFactory>();
     kernel.Bind <IFactory <Profile, Model.Profile> >().To <ProfileFactory>();
 }
Ejemplo n.º 19
0
        public ClockExtensionTests()
        {
            _kernel = new CompositeKernel
            {
                new CSharpKernel()
            };

            Task.Run(() => new ClockKernelExtension().OnLoadAsync(_kernel))
            .Wait();

            KernelEvents = _kernel.KernelEvents.ToSubscribedList();
        }
Ejemplo n.º 20
0
        public async Task <SubmitCode[]> SubmitCode(KernelBase kernel, string[] codeFragments, SubmissionType submissionType = SubmissionType.Run)
        {
            var commands = new List <SubmitCode>();

            foreach (var codeFragment in codeFragments)
            {
                var cmd = new SubmitCode(codeFragment, submissionType: submissionType);
                await kernel.SendAsync(cmd);

                commands.Add(cmd);
            }
            return(commands.ToArray());
        }
Ejemplo n.º 21
0
Archivo: Program.cs Proyecto: volend/ML
        void RunSingleTest(int[][] inputs, int[] outputs, Codification codebook, KernelBase kernel, List <Record> testSet)
        {
            KernelSupportVectorMachine    machine = new KernelSupportVectorMachine(kernel, inputs[0].Length);
            SequentialMinimalOptimization m       = new SequentialMinimalOptimization(machine, ToDoubles(inputs), Normalize(outputs));

            m.Run();

            SVMLearner learner = new SVMLearner(this, codebook, machine);

            ConfusionMatrix testResults = RunTest(learner.Predict, testSet);

            PrintResults(testResults);
        }
Ejemplo n.º 22
0
        public async Task Directives_can_display_help(string kernelName)
        {
            var cSharpKernel = new CSharpKernel().UseDefaultMagicCommands();

            using var compositeKernel = new CompositeKernel
                  {
                      cSharpKernel
                  };

            var command = new Command("#!hello")
            {
                new Option <bool>("--loudness")
            };

            var findKernel = compositeKernel.FindKernel(kernelName);

            var kernelWithDirective = findKernel switch
            {
                KernelBase k => k,
                _ => throw new ArgumentOutOfRangeException()
            };

            kernelWithDirective.AddDirective(command);

            using var events = compositeKernel.KernelEvents.ToSubscribedList();

            await compositeKernel.SubmitCodeAsync("#!hello -h");

            var stdOut = string.Join(
                "",
                events
                .OfType <StandardOutputValueProduced>()
                .Select(e => e.Value.As <string>()));

            var stdErr = string.Join(
                "",
                events
                .OfType <StandardErrorValueProduced>()
                .Select(e => e.Value.As <string>()));

            stdOut
            .Should()
            .ContainAll("Usage", "#!hello", "[options]", "--loudness");

            stdOut
            .Should()
            .NotContain(new RootCommand().Name,
                        "RootCommand.Name is generally intended to reflect the command line tool's name but in this case it's just an implementation detail and it looks weird in the output.");

            stdErr.Should().BeEmpty();
        }
Ejemplo n.º 23
0
        public static IMediator Setup(KernelBase dependencyContainer)
        {
            dependencyContainer.Components.Add <IBindingResolver, ContravariantBindingResolver>();
            dependencyContainer.Bind(x => x.FromAssemblyContaining <IMediator>().SelectAllClasses().BindDefaultInterface());
            dependencyContainer.Bind(x => x.FromAssemblyContaining <CreateSnapshotRequest>().SelectAllClasses().InheritedFrom(typeof(IRequestHandler <,>)).BindAllInterfaces());
            dependencyContainer.Bind(x => x.FromAssemblyContaining <CreateSnapshotRequestValidator>().SelectAllClasses().InheritedFrom(typeof(AbstractValidator <>)).BindDefaultInterfaces());

            dependencyContainer.Bind(typeof(IPipelineBehavior <,>)).To(typeof(RequestPerformanceBehavior <,>));
            dependencyContainer.Bind(typeof(IPipelineBehavior <,>)).To(typeof(RequestValidationBehavior <,>));

            dependencyContainer.Bind <ServiceFactory>().ToMethod(x => t => x.Kernel.TryGet(t));

            return(dependencyContainer.Get <IMediator>());
        }
Ejemplo n.º 24
0
        internal static StandardIOKernelServer CreateServer(KernelBase kernel, IConsole console)
        {
            var server = new StandardIOKernelServer(
                kernel,
                Console.In,
                Console.Out);

            if (kernel is KernelBase kernelBase)
            {
                kernelBase.RegisterForDisposal(server);
            }

            return(server);
        }
Ejemplo n.º 25
0
        public static void RegisterServices(KernelBase kernel)
        {
            // Services
            kernel.Bind <IOccupationRatingsService>().To <OccupationRatingsService>();
            kernel.Bind <IOccupationsService>().To <OccupationsService>();
            kernel.Bind <IMembersService>().To <MembersService>();

            // Repositories
            kernel.Bind <IOccupationRatingsRepository>().To <OccupationRatingsRepository>();
            kernel.Bind <IOccupationsRepository>().To <OccupationsRepository>();
            kernel.Bind <IMembersRepository>().To <MembersRepository>();

            // Libraries
            kernel.Bind <ILogger>().To <NLogger>();
        }
Ejemplo n.º 26
0
 private static void RegisterServices(KernelBase kernel)
 {
     kernel.Bind <IOAuthAuthorizationServerOptions>().To <MyOAuthAuthorizationServerOptions>();
     kernel.Bind <IOAuthAuthorizationServerProvider>().To <SimpleAuthorizationServerProvider>();
     kernel.Bind <IUnitOfWork>().To <EfUnitOfWork>();
     kernel.Bind <ICreativeService>().To <CreativeService>();
     kernel.Bind <IMedalService>().To <MedalService>();
     kernel.Bind <ITagsService>().To <TagsService>();
     kernel.Bind <IAccountService>().To <AccountService>();
     kernel.Bind <ICommentsService>().To <CommentsService>();
     kernel.Bind <IChaptersService>().To <ChapterService>();
     kernel.Bind <ILikesService>().To <LikesService>();
     kernel.Bind <IRatingService>().To <RatingService>();
     kernel.Bind <ICategoriesService>().To <CategoriesService>();
     kernel.Bind <IAdminService>().To <AdminService>();
 }
Ejemplo n.º 27
0
        private static void RegisterAssemblies(KernelBase kernel)
        {
            List <string> listAssembly = new List <string>()
            {
                "Website.Foundation.*",
                "Website.WebApi.*"
            };
            List <string> listExcludeAssembly = new List <string>()
            {
                "Website.Foundation.Persistence.Repositories"
            };

            kernel.Bind(x =>
            {
                x.FromAssembliesMatching(listAssembly) // Scans all assemblies
                .SelectAllClasses()                    // Retrieve all non-abstract classes
                .NotInNamespaces(listExcludeAssembly)
                .BindDefaultInterface();               // Binds the default interface to them;
            });
        }
Ejemplo n.º 28
0
        public static void SparseTest(KernelBase denseKernel, KernelBase sparseKernel)
        {
            double[][] sparse =
            {
                new double[] {   },
                new double[] {2, 1 },
                new double[] {1, 1 },
                new double[] {1, 1, 2, 1 }
            };

            double[][] dense =
            {
                new double[] { 0, 0 },
                new double[] { 0, 1 },
                new double[] { 1, 0 },
                new double[] { 1, 1 },
            };

            for (int i = 0; i < sparse.Length; i++)
            {
                for (int j = 0; j < sparse.Length; j++)
                {
                    double expected = denseKernel.Function(dense[i], dense[j]);
                    double actual   = sparseKernel.Function(sparse[i], sparse[j]);

                    Assert.AreEqual(expected, actual);
                }
            }

            for (int i = 0; i < sparse.Length; i++)
            {
                for (int j = 0; j < sparse.Length; j++)
                {
                    double expected = denseKernel.Distance(dense[i], dense[j]);
                    double actual   = sparseKernel.Distance(sparse[i], sparse[j]);

                    Assert.AreEqual(expected, actual);
                }
            }
        }
Ejemplo n.º 29
0
        private void InitCommandEngine(KernelBase kernel)
        {
            if (logger.IsTraceEnabled)
            {
                logger.Trace("Настройка командного процессора...");
            }
            commandEngine = kernel.Get <ICommandEngine>();

            commandEngine.RegisterDefaultCommand(kernel.Get <WrongInputCommand>());
            commandEngine.RegisterCommand("help", kernel.Get <HelpCommand>());
            commandEngine.RegisterCommand("exit", kernel.Get <ExitCommand>());
            commandEngine.RegisterCommand("pull", kernel.Get <PullCommand>());
            commandEngine.RegisterCommand("list", kernel.Get <ListCommand>());
            commandEngine.RegisterCommand("remove", kernel.Get <RemoveCommand>());
            commandEngine.RegisterCommand("subs", kernel.Get <SubsCommand>());
            commandEngine.RegisterCommand("addsub", kernel.Get <AddSubCommand>());
            commandEngine.RegisterCommand("remsub", kernel.Get <RemoveSubCommand>());
            commandEngine.RegisterCommand("path", kernel.Get <AppPathCommand>());

            if (logger.IsTraceEnabled)
            {
                logger.Trace("Настройка командного процессора завершена.");
            }
        }
Ejemplo n.º 30
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Application.ThreadException += (sender, args) =>
            {
                var result = DialogResult.Cancel;

                MessageBox.Show(args.Exception.Message, "Opps",
                                MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);

                if (result == DialogResult.Abort)
                {
                    Application.Exit();
                }
            };

            _kernel = NinjectConfiguration.GetKernel();

            var mainForm = _kernel.Get <MainForm>();

            Application.Run(mainForm);
        }