Ejemplo n.º 1
0
        private static void Main()
        {
            try
            {
                //Подключаем IoC
                var assemblies = AppDomain.CurrentDomain.GetAssemblies();
                var kernel     = BootstrapHelper.LoadNinjectKernel(assemblies);

                HostFactory.Run(configurator =>
                {
                    //конфигурируем Topshelf.Quartz
                    configurator.Service <TopshelfService>(serviceConfigurator =>
                    {
                        serviceConfigurator.ConstructUsing(name => new TopshelfService());
                        serviceConfigurator.WhenStarted((service, control) => service.Start(control));
                        serviceConfigurator.WhenStopped((service, control) => service.Stop(control));

                        //Запуск парсера для Lostfilm
                        LostfilmParseProcess(serviceConfigurator, kernel);

                        //Запуск парсера для AlbumInfo
                        AlbumInfoParseProcess(serviceConfigurator, kernel);
                    });

                    configurator.StartAutomatically();
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Ejemplo n.º 2
0
        private static void Main(string[] args)
        {
            try
            {
                //Подключаем IoC
                var assemblies = AppDomain.CurrentDomain.GetAssemblies();
                var kernel     = BootstrapHelper.LoadNinjectKernel(assemblies);
                MapperConfig.Initialize();

                HostFactory.Run(configurator =>
                {
                    //конфигурируем Topshelf.Quartz
                    configurator.Service <TopshelfService>(serviceConfigurator =>
                    {
                        serviceConfigurator.ConstructUsing(name => new TopshelfService());
                        serviceConfigurator.WhenStarted((service, control) => service.Start(control));
                        serviceConfigurator.WhenStopped((service, control) => service.Stop(control));

                        //Запуск процесса рассылки уведомлений
                        NotificationsProcess(serviceConfigurator, kernel);
                    });

                    configurator.StartAutomatically();
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }