private void TimerProgramador_Tick(object sender, EventArgs e) { TimerProgramador.Stop(); if (this.Visible) { //Ejecuto tareas del programador Lfx.Services.Task ProximaTarea = null; // En conexiones lentas, 1 vez por minuto // En conexiones rápidas, cada 5 segundos if (Lfx.Workspace.Master.SlowLink) { if (Lfx.Workspace.Master.DefaultScheduler.LastGetTask == System.DateTime.MinValue || (DateTime.Now - Lfx.Workspace.Master.DefaultScheduler.LastGetTask).Minutes >= 1) { ProximaTarea = Lfx.Workspace.Master.DefaultScheduler.GetNextTask("lazaro"); } } else { if (Lfx.Workspace.Master.DefaultScheduler.LastGetTask == System.DateTime.MinValue || (DateTime.Now - Lfx.Workspace.Master.DefaultScheduler.LastGetTask).Seconds >= 5) { ProximaTarea = Lfx.Workspace.Master.DefaultScheduler.GetNextTask("lazaro"); } } if (ProximaTarea != null) { // Lanzo la tarea en un nuevo thread System.Threading.ThreadStart ParamInicio = delegate { Ejecutor.Exec(ProximaTarea.Command, ProximaTarea.ComputerName); }; new System.Threading.Thread(ParamInicio).Start(); } if (YaSubiEstadisticas == false && Lfx.Workspace.Master.DebugMode == false) { YaSubiEstadisticas = true; System.Threading.ThreadStart ParamInicio = delegate { Aplicacion.EnviarEstadisticas(); }; System.Threading.Thread Thr = new System.Threading.Thread(ParamInicio); Thr.IsBackground = true; Thr.Start(); } if (YaPregunteReiniciar == false && Lfx.Updates.Updater.Master != null && Lfx.Updates.Updater.Master.UpdatesPending() && ActiveForm == this) { YaPregunteReiniciar = true; Lui.Forms.YesNoDialog Pregunta = new Lui.Forms.YesNoDialog("Existe una nueva versión de Lázaro. Debe reiniciar la aplicación para instalar la actualización.", "¿Desea reiniciar ahora?"); Pregunta.DialogButtons = Lui.Forms.DialogButtons.YesNo; DialogResult Respuesta = Pregunta.ShowDialog(); if (Respuesta == DialogResult.OK) { Ejecutor.Exec("REBOOT"); } } } TimerProgramador.Start(); }