コード例 #1
0
        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();
        }
コード例 #2
0
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            if (AdminNotif != null)
            {
                AdminNotif.Abort();
                AdminNotif = null;
            }
            TimerProgramador.Stop();

            if (Lfx.Workspace.Master != null)
            {
                Lfx.Workspace.Master.Dispose();
            }

            base.OnClosing(e);
        }
コード例 #3
0
ファイル: Inicio.cs プロジェクト: LeoIlla777/Gestion777
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            if (AdminNotif != null)
            {
                AdminNotif.Abort();
                AdminNotif = null;
            }
            TimerProgramador.Stop();

            if (Lfx.Workspace.Master != null)
            {
                Lfx.Workspace.Master.Dispose();
            }


            try
            {
                System.Diagnostics.Process[] tempProc = System.Diagnostics.Process.GetProcessesByName("Fiscal.exe");
                foreach (System.Diagnostics.Process pro in tempProc)
                {
                    pro.CloseMainWindow();
                    pro.WaitForExit();
                }
                foreach (System.Diagnostics.Process pro in tempProc)
                {
                    try
                    {
                        pro.Kill();
                        pro.WaitForExit();
                    }
                    catch { }
                }
            }
            catch { }

            base.OnClosing(e);
        }