public static void crear_form_comando()
 {
     if (comando_form != null)
     {
         return;
     }
     comando_form = new clienteMail.comando.comando();
 }
 public asuntos(string llamadoDesde, RichForm formulario_padre)
 {
     InitializeComponent();
     agregar_eventos(seleccionar_asunto, false, "panel", "index", "pictureBox", "asunto");
     formAnterior       = llamadoDesde;
     btnAceptar.Visible = llamadoDesde != "home";
     form_padre         = formulario_padre;
 }
示例#3
0
 public redactar(RichForm formulario_padre, string asunto = "", string para = "", string mensaje = "")
 {
     InitializeComponent();
     form_padre              = formulario_padre;
     asuntoTxt.Text          = asunto;
     toTxt.Text              = para;
     webBrowser.DocumentText = mensaje;
     webBrowser.Visible      = mensaje != "";
 }
 public mensaje_new_update(int id, RichForm form_padre_actual)
 {
     InitializeComponent();
     form_padre = form_padre_actual;
     if (id > 0)
     {
         Mensaje mensaje = G.user.getMensaje(id);
         txtTexto.Text = mensaje.Texto;
         this.Text     = "Modificar mensaje";
     }
     ID = id;
 }
        public asunto_new_update(int id, RichForm form_padre_actual)
        {
            InitializeComponent();
            form_padre = form_padre_actual;

            if (id > 0)
            {
                Asunto asunto = G.user.getAsunto(id);
                txtTexto.Text = asunto.Texto;

                this.Text = "Modificar asunto";
            }
            ID = id;
        }
        public frmContacto(int id, RichForm form_padre_actual)
        {
            InitializeComponent();
            form_padre = form_padre_actual;
            contexto   = "Agregar contacto";
            if (id > 0)
            {
                Contacto contacto = G.user.getContacto(id);
                txtNombre.Text   = contacto.Nombre;
                txtApellido.Text = contacto.Apellido;
                txtMail.Text     = contacto.Mail;

                contexto  = "Modificar contacto";
                this.Text = contexto;
            }
            ID = id;
        }
示例#7
0
        public frmAlert(RichForm form_padre_actual, string titulo, string mensaje, string type)
        {
            InitializeComponent();
            form_padre = form_padre_actual;
            contexto   = titulo;

            this.Text       = titulo;
            lblMensaje.Text = mensaje;
            if (type == "yesno")
            {
                btnAceptar.Show();
                btnCerrar.Text = "Cancelar";
            }
            else
            {
                btnAceptar.Hide();
                btnCerrar.Location = new Point(150, 60);
                btnCerrar.Text     = "Cerrar";
            }
        }
        void recEngine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            RichForm currentForm = (RichForm)Form.ActiveForm;

            if (currentForm == null)
            {
                return;
            }
            txtFormActivo.Text += currentForm.Text + '\n';
            int pos = -1;

            for (int linea = 0; linea < 15; linea++)
            {
                if (pos < 0)
                {
                    pos = richTextBox1.Text.LastIndexOf('\n');
                }
                else if (pos > 0)
                {
                    pos = richTextBox1.Text.LastIndexOf('\n', pos - 1);
                }
                if (pos < 0)
                {
                    break;
                }
            }
            if (pos > 0)
            {
                richTextBox1.Text = richTextBox1.Text.Substring(pos + 1);
            }
            if (e.Result.Text != null)
            {
                richTextBox1.Text += Environment.NewLine + char.ToUpperInvariant(e.Result.Text[0]) + e.Result.Text.Substring(1);
            }
            #if DEBUG
            Console.WriteLine(e.Result.Confidence.ToString());
            #endif
            float confidence = e.Result.Confidence * 100;
            richTextBox1.Text += string.Format(" ({0:0.00}%)", e.Result.Confidence * 100);

            if (currentForm.Name == "entrenamiento_1")
            {
                // Esta en modo entrenamiento, no autenticar y mandar el SpeechRecognized entero
                currentForm.manejar_comando_entrenamiento(e);
            }
            else
            {
                string path         = Path.GetTempFileName();
                Stream outputStream = new FileStream(path, FileMode.Create);
                e.Result.Audio.WriteToWaveStream(outputStream);
                outputStream.Close();
                int res = AV.avf_autenticar_WAV(autenticador, path);
                File.Delete(path);

                if (confidence > G.sensibilidad)
                {
                    G.registrar_comando(e.Result.Text, e.Result.Confidence, (double)res / 10000.0);
                    G.confianza_autenticacion = res;
                    if (res == AV.AVS_PUNTERO_NULO)
                    {
                        currentForm.manejar_comando(e.Result.Text);
                        return;
                    }
                    else if (res < -10000)
                    {
                        richTextBox1.Text += " - error - " + res.ToString("X");
                        currentForm.manejar_comando(e.Result.Text);
                        return;
                    }
                    if (res > 0)
                    {
                        richTextBox1.Text += " - Autenticado - " + (((double)res) / 100).ToString("0.00") + "%";
                        currentForm.manejar_comando(e.Result.Text);
                    }
                    else
                    {
                        res = -res;
                        richTextBox1.Text += " - Acceso denegado - " + (((double)res) / 100).ToString("0.00") + "%";
                        currentForm.manejar_comando(e.Result.Text);
                    }
                }
            }
        }