using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace presentacion
{
    public partial class buscar : Form
    {
        List<string[]> consultando;
        public buscar()
        {
            this.consultando=new List<string[]>();
            InitializeComponent();
        }

        private void volver_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void limpiar_Click(object sender, EventArgs e)
        {
            this.consultando.Clear();
            consulta.Text = "";

        }

        private void anyadir_Click(object sender, EventArgs e)
        {
            if (!((introduccion.Text.Length)==0)) 
            {
                string[] add = new string[3];
                add[0]=introduccion.Text;
                add[1]="literal";
                add[2]=int.Parse(intervalo.Text).ToString();
                consultando.Add(add);
                consulta.Text += introduccion.Text + " ";
                introduccion.Text = "";

            }
        }

        private void sucesion_inmediata_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Sucesion inmediata";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += sucesion_inmediata.Text + " ";
        }

        private void mantenimiento_del_turno_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Mantenimiento del turno";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += mantenimiento_del_turno.Text + " ";
        }

        private void inicio_solapamiento_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Inicio solapamiento";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += inicio_solapamiento.Text + " ";
        }

        private void fragmento_indescifrable_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Fragmento indescifrable";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += fragmento_indescifrable.Text + " ";
        }

        private void pausa_intermedia_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Pausa intermedia";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += pausa_intermedia.Text + " ";
        }

        private void reconstruido_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Reconstruido";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += reconstruido.Text + " ";
        }

        private void pausa_larga_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Pausa larga";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += pausa_larga.Text + " ";

        }

        private void final_solapamiento_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Final solapamiento";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += final_solapamiento.Text + " ";
        }

        private void reinicio_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Reinicio";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += reinicio.Text + " ";
        }

        private void pausa_corta_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Pausa corta";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += pausa_corta.Text + " ";
        }

        private void transcripcion_dudosa_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Transcripcion dudosa";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += transcripcion_dudosa.Text + " ";
        }

        private void silencio_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Silencio";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += silencio.Text + " ";
        }

        private void bajo_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Bajo";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += bajo.Text + " ";
        }

        private void interrupcion_de_la_grabacion_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Interrupcion de la grabacion";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += interrupcion_de_la_grabacion.Text + " ";
        }

        private void entonacion_ascendente_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Entonacion ascendente";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += entonacion_ascendente.Text + " ";
        }

        private void entonacion_descendente_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Entonacion descendente";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += entonacion_descendente.Text + " ";
        }

        private void entonacion_mantenida_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Entonacion mantenida";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += entonacion_mantenida.Text + " ";
        }

        private void entre_risas_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Entre risas";
            add[1] = "simbolo";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += entre_risas.Text + " ";
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                intervalo.ReadOnly = true;
            }
            else intervalo.ReadOnly = false;
        }

        private void adjetivo_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "A";
            add[1] = "etiqueta_gramatical";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += adjetivo.Text + " ";
        }

        private void adverbio_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "R";
            add[1] = "etiqueta_gramatical";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += adverbio.Text + " ";
        }

        private void determinante_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "D";
            add[1] = "etiqueta_gramatical";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += determinante.Text + " ";
        }

        private void nombre_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "N";
            add[1] = "etiqueta_gramatical";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += nombre.Text + " ";
        }

        private void verbo_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "V";
            add[1] = "etiqueta_gramatical";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += verbo.Text + " ";
        }

        private void pronombre_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "P";
            add[1] = "etiqueta_gramatical";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += pronombre.Text + " ";
        }

        private void conjuncion_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "C";
            add[1] = "etiqueta_gramatical";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += conjuncion.Text + " ";
        }

        private void interjeccion_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "I";
            add[1] = "etiqueta_gramatical";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += interjeccion.Text + " ";
        }

        private void preposición_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "S";
            add[1] = "etiqueta_gramatical";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += preposición.Text + " ";
        }

        private void cifra_Click(object sender, EventArgs e)
        {
            string[] add = new string[3];
            add[0] = "Z";
            add[1] = "etiqueta_gramatical";
            add[2] = int.Parse(intervalo.Text).ToString();
            consultando.Add(add);
            consulta.Text += cifra.Text + " ";
        }

        private void consultar_Click(object sender, EventArgs e)
        {
            string ruta_xml = "..\\..\\..\\..\\..\\xml";
            List<string[]> lista = new List<string[]>();
            //bool simbolos=false;
            //if(radioButton1.Checked) simbolos=true;
            classes.Consultas cons = new classes.Consultas();
            lista=cons.consultar(this.consultando,int.Parse(mostrar.Text),ruta_xml);

            resultado res = new resultado(lista,consulta.Text);
            res.ShowDialog();

            consulta.Text = "";
            this.consultando.Clear();
        }
    }
}
