protected override void OnStart(string[] args) { this.RequestAdditionalTime(1800000); _AppConfiguration = AppConfigurationFactory.Create(); _ServiceBuilder = new AbstractServiceBuilder(_AppConfiguration); _ServiceBuilder.AddConfiguration(_AppConfiguration) .AddAuthenticationService(new AutenticacaoService()) .AddService(new SincroniaService()) .AddService(new ConsultaAcademicaService()) .Build(); _Controller = new ImportadorServiceController(_ServiceBuilder, _AppConfiguration) { UseParallelism = false, CanLog = false }; _Controller.ConfigureMoodleCache(); _SincroniaIniciada = false; _ImportacaoIniciada = false; _TimerSincronia.Interval = _AppConfiguration.TempoSincronizacao; _TimerSincronia.Elapsed += new ElapsedEventHandler(TimerSincroniaElapsed); _TimerSincronia.Start(); _TimerImportacao.Interval = _AppConfiguration.TempoImportacao; _TimerImportacao.Elapsed += new ElapsedEventHandler(TimerImportacaoElapsed); _TimerImportacao.Start(); }
static void SincronizarTest() { var config = AppConfigurationFactory.Create(); var builder = new AbstractServiceBuilder(config); builder.AddAuthenticationService(new AutenticacaoService()) .AddService(new SincroniaService()) .AddService(new ConsultaAcademicaService()) .Build(); System.Console.WriteLine("ServiceBuilder object built"); ImportadorServiceController controller = new ImportadorServiceController(builder, config); controller.ConfigureMoodleCache(); System.Console.WriteLine("Moodle Cache built"); var result = controller.Sincronizar(); System.Console.WriteLine("Syncronizing process finished"); controller.SalvarLogs(result, true); System.Console.WriteLine("Logs saved"); }
static void Main(string[] args) { _AppConfiguration = AppConfigurationFactory.Create(); _ServiceBuilder = new AbstractServiceBuilder(_AppConfiguration); ImportarTest(); System.Console.ReadKey(); }