Ejemplo n.º 1
0
 private void ejecucionToolStripMenuItem_Click(object sender, EventArgs e)
 {
     // Ejecutar C3D
     if (instrucciones != null && instrucciones.Count > 0)
     {
         Ejecutor ejecutar = new Ejecutor(instrucciones, this.txtConsola);
     }
 }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
 private void PersonaNombre_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (TablaActual != null && ItemActual > 0)
     {
         object Res = Ejecutor.Exec("EDITAR " + TablaActual + " " + ItemActual.ToString());
         if (Res != null)
         {
             Aplicacion.FormularioPrincipal.ProcesarObjeto(Res);
         }
     }
 }
Ejemplo n.º 4
0
 private void AplicarActualizacion()
 {
     this.Close();
     if (Lfx.Updates.Updater.Master != null && Lfx.Updates.Updater.Master.UpdatesPending())
     {
         Lui.Forms.YesNoDialog Pregunta = new Lui.Forms.YesNoDialog("Se descargó 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");
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Maneja los eventos Click de los menús
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Menu_Click(object sender, System.EventArgs e)
        {
            MenuItem     ItemClicked = (MenuItem)sender;
            MenuItemInfo ItmInfo     = MenuItemInfoTable[ItemClicked.Tag.ToString()];

            int Hits = Lfx.Workspace.Master.CurrentConfig.ReadLocalSettingInt("MenuStats", ItmInfo.FullPath, 0);

            Lfx.Workspace.Master.CurrentConfig.WriteLocalSetting("MenuStats", ItmInfo.FullPath, Hits + 1);
            if (ItmInfo.Funcion == "MENU Lbl.Cajas.Caja")
            {
                // Nada
            }
            else
            {
                Ejecutor.Exec(ItmInfo.Funcion);
            }
        }
Ejemplo n.º 6
0
 private void BotonBackup_Click(System.Object sender, System.EventArgs e)
 {
     BotonBackup.Enabled = false;
     Ejecutor.Exec("BACKUP NOW");
 }
Ejemplo n.º 7
0
        private void FormPrincipal_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.F10:
            case Keys.F12:
                if (e.Shift == false && e.Alt == false && e.Shift == false)
                {
                    e.Handled = true;
                    if (FormInicio == null)
                    {
                        MostrarAyuda("Menú principal", "Utilice las teclas de cursor (flechas) para navegar el menú. Pulse <Intro> (o <Enter>) para ejecutar una opción.");
                        System.Windows.Forms.SendKeys.Send("%S");
                    }
                    else
                    {
                        MostrarAyuda("Pantalla de inicio", "Si no encuentra lo que busca en la pantalla de inicio utilice el menú en la parte superior.");
                        FormInicio.Focus();
                    }
                }
                break;

            case Keys.I:
                if (e.Control == true && e.Alt == true && Lbl.Sys.Config.Actual.UsuarioConectado.TieneAccesoGlobal())
                {
                    e.Handled = true;
                    System.Windows.Forms.OpenFileDialog DialogoArchivo = new System.Windows.Forms.OpenFileDialog();
                    DialogoArchivo.DefaultExt  = "sql";
                    DialogoArchivo.Filter      = "Archivo SQL|*.sql";
                    DialogoArchivo.Multiselect = false;
                    DialogoArchivo.Title       = "Inyectar SQL";
                    if (DialogoArchivo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        using (System.IO.Stream Archivo = System.IO.File.OpenRead(DialogoArchivo.FileName))
                            using (System.IO.StreamReader Lector = new System.IO.StreamReader(Archivo, System.Text.Encoding.Default))
                                using (Lfx.Data.Connection ConexionActualizar = Lfx.Workspace.Master.GetNewConnection("Inyectar SQL"))
                                    using (IDbTransaction Trans = ConexionActualizar.BeginTransaction()) {
                                        string SqlActualizacion = ConexionActualizar.CustomizeSql(Lector.ReadToEnd());
                                        do
                                        {
                                            string Comando = Lfx.Data.Connection.GetNextCommand(ref SqlActualizacion);
                                            try {
                                                ConexionActualizar.ExecuteSql(Comando);
                                            } catch (Exception ex) {
                                                Lfx.Workspace.Master.RunTime.Toast(Comando + System.Environment.NewLine + System.Environment.NewLine + ex.Message, "Error al inyectar datos");
                                            }
                                        }while (SqlActualizacion.Length > 0);
                                        Trans.Commit();
                                    }
                    }
                }
                break;

            case Keys.B:
                if (e.Control && e.Alt == false && e.Shift == false)
                {
                    e.Handled             = true;
                    BarraInferior.Visible = !BarraInferior.Visible;
                    Lfx.Workspace.Master.CurrentConfig.WriteLocalSetting("Sistema", "Apariencia.BarraInformacion", BarraInferior.Visible ? 1 : 0);
                }
                break;

            case Keys.J:
                if (e.Control == true && e.Alt == false && e.Shift == false)
                {
                    e.Handled = true;
                    string Cmd = Lui.Forms.InputBox.ShowInputBox("Comando");
                    if (Cmd != null && Cmd.Length > 0)
                    {
                        Ejecutor.Exec(Cmd);
                    }
                }
                break;

            case Keys.F:
                if (e.Control == true && e.Alt == false && e.Shift == false)
                {
                    e.Handled = true;
                    Ejecutor.Exec("CREAR Lbl.Comprobantes.Factura");
                }
                break;

            case Keys.T:
                if (e.Control == true && e.Alt == false && e.Shift == false)
                {
                    e.Handled = true;
                    Ejecutor.Exec("CREAR Lbl.Comprobantes.Ticket");
                }
                break;

            case Keys.P:
                if (e.Control == true && e.Alt == false && e.Shift == false)
                {
                    e.Handled = true;
                    Ejecutor.Exec("CREAR Lbl.Comprobantes.Presupuesto");
                }
                break;

            case Keys.R:
                if (e.Control == true && e.Alt == false && e.Shift == false)
                {
                    e.Handled = true;
                    Ejecutor.Exec("CREAR Lbl.Comprobantes.ReciboDeCobro");
                }
                break;

            case Keys.L:
                if (e.Control == true && e.Alt == false && e.Shift == false)
                {
                    e.Handled = true;
                    Ejecutor.Exec("CALC");
                }
                break;
            }
        }
Ejemplo n.º 8
0
        public static void CompilarYEjecutar()
        {
            CompiladorAsm compiladorAsm;
            CompiladorC   compiladorC;
            Compilador    compilador;

            compiladorAsm = new CompiladorAsm("", "nasm.exe");
            compiladorC   = new CompiladorC("", "gcc.exe");
            compilador    = new Compilador("", "gcc.exe", "salida.txt", "error.txt");

            try            {
                Ejecutor.ArchivoSalida = salidaPorArchivo? archSalida : "salida.txt";
                Ejecutor.ArchivoError  = "errorEjecucion.txt";

                // if( esAssembler )
                compiladorAsm.Compilar("-fcoff", "timer.asm");

                compiladorC.Compilar("-c -o codigoProbador.o", "codigoProbador.c");

/*
 *              string[] archivos = new string[2];
 *              archivos[1] = "codigoProbador.o";
 *              if( esAssembler )
 *                  archivos[0] = "timer.o";
 *              else
 *                  archivos[0] = archFuncion;
 * */
                string[] archivos;

                if (esAssembler)
                {
                    archivos    = new string[2];
                    archivos[0] = "timer.o";
                    archivos[1] = "codigoProbador.o";
                }
                else
                {
                    archivos    = new string[3];
                    archivos[0] = archFuncion;
                    archivos[1] = "timer.o";
                    archivos[2] = "codigoProbador.o";
                }

                //Genera un .exe resultado de enlazar los 2 anteriores.
                compilador.Enlazar("prueba.exe", archivos);

                Ejecutor.Ejecutar("prueba.exe");
                Console.Write(Ejecutor.ObtenerSalida());
            }
            finally
            {
                if (esAssembler)
                {
                    compiladorAsm.BorrarArchivosSalidaYError();
                }
                compiladorC.BorrarArchivosSalidaYError();
                compilador.BorrarArchivosSalidaYError();
                Ejecutor.BorrarArchivosTemporales(!salidaPorArchivo);
                File.Delete("codigoProbador.o");
                File.Delete("timer.o");
            }
        }