Ejemplo n.º 1
0
        public void ActivarBuscarComandos()
        {
            dgComandos.Rows.Clear();
            dgGramaticas.Rows.Clear();
            tbComando.Text = "";
            string fic;

            // Usar el path del ejecutable
            fic = Application.StartupPath + @"\XULIA.exe.config";
            // La clase debemos instanciarla indicando el path a usar
            // y opcionalmente si se guarda cada vez que se asigne un valor.
            mCfg = new ConfigXml(fic, true);

            //REcuperamos la información de idioma
            Idioma = mCfg.GetValue("appSettings", "IdiomaGramaticas");
            //Recuperamos la información de configuración
            StringCollection secciones = mCfg.Secciones();

            //Cargamos el combobox de gramáticas
            foreach (string s in secciones)
            {
                if ((Strings.InStr(s, "Valores") == 0) &&
                    (Strings.InStr(s, "Precision") == 0) &&
                    (Strings.InStr(s, "Ayuda") == 0) &&
                    (Strings.Right(s, Idioma.Length) == Idioma))
                {
                    string gram = s.Substring(0, s.Length - Idioma.Length);
                    lstGramaticas.Items.Add(gram);
                }
            }
            //Recuperamos la información de MODOS
            Hashtable h = mCfg.Claves("appSettings");

            string[] aVar = new string[2];

            //ICollection ckeys;
            //ckeys = h.Keys;
            foreach (DictionaryEntry entry in h)
            {
                string var = entry.Key.ToString();
                if ((var.Substring(0, 1) == "·") || (var.Substring(0, 1) == "$"))
                { //Modos de operación
                    if (Strings.InStr(var, "·SUSTITUCIONES·") == 0)
                    {
                        lstModos.Items.Add(entry.Key.ToString());
                    }
                }
            }
            this.Show();
            AIMLGUI.ProcesamientoComandos.SiempreEncima((int)this.Handle);
        }
Ejemplo n.º 2
0
        public void CargarGramatica(string gramatica, DataGridView dgGramaticas, string filtro)
        {
            //Recuperamos la información de configuración
            string    Seccion        = gramatica + Idioma;
            string    SeccionValores = "";
            bool      SecPrecision   = false;
            Hashtable h          = mCfg.Claves(Seccion);
            Hashtable hAyuda     = new Hashtable();
            Hashtable hPrecision = new Hashtable();
            Hashtable hValores   = new Hashtable();
            bool      SecAyuda   = false;
            float     Precision  = 0;

            //ICollection ckeys;
            //ckeys = h.Keys;
            if (h.Count == 0)
            {
                return;
            }
            SeccionValores = h["SeccionValores"].ToString();
            hValores       = mCfg.Claves(SeccionValores);
            if (h.Contains("SeccionAyuda"))
            {
                SecAyuda = true;
                hAyuda   = mCfg.Claves(h["SeccionAyuda"].ToString());
            }
            if (h.Contains("SeccionPrecision"))
            {
                SecPrecision = true;
                hPrecision   = mCfg.Claves(h["SeccionPrecision"].ToString());
            }
            if (h.Contains("ValorPrecision"))
            {
                Precision = Convert.ToInt16(h["ValorPrecision"].ToString()) / 100;
            }

            foreach (DictionaryEntry entry in h)
            {
                string   sClave      = "";
                string   sComandoVoz = "";
                string   sAyuda      = "";
                string   sMacro      = "";
                string[] row         = new string[4];

                if ((entry.Key.ToString() != "SeccionValores") && (entry.Key.ToString() != "SeccionAyuda") && (entry.Key.ToString() != "SeccionPrecision"))
                {
                    sClave      = entry.Key.ToString();
                    sComandoVoz = entry.Value.ToString();
                    sAyuda      = mCfg.RecuperarValorSeccion(hAyuda, sClave, SecAyuda);
                    if (SeccionValores != "")
                    {
                        sMacro = hValores[entry.Key.ToString()].ToString();
                    }
                    row[0] = sComandoVoz;
                    row[1] = sAyuda;
                    row[2] = gramatica;
                    row[3] = sMacro;
                    if (sClave != "")
                    {
                        if (Strings.InStr(sComandoVoz, filtro) > 0)
                        {
                            dgGramaticas.Rows.Add(row);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void CargarConfiguracion()
        {
            dgVar.Rows.Clear();
            dgModos.Rows.Clear();
            dgListaSustitucion.Rows.Clear();
            dgGramaticas.Rows.Clear();
            cbListaSustitucion.Items.Clear();
            cbGramaticas.Items.Clear();

            string fic;

            // Usar el path del ejecutable
            fic = Application.StartupPath + @"\XULIA.exe.config";
            // La clase debemos instanciarla indicando el path a usar
            // y opcionalmente si se guarda cada vez que se asigne un valor.
            mCfg = new ConfigXml(fic, true);

            //REcuperamos la información de idioma
            Idioma = mCfg.GetValue("appSettings", "IdiomaGramaticas");
            //Recuperamos la información de configuración
            Hashtable h = mCfg.Claves("appSettings");

            string[] aVar = new string[2];

            //ICollection ckeys;
            //ckeys = h.Keys;
            foreach (DictionaryEntry entry in h)
            {
                string var = entry.Key.ToString();
                if ((var.Substring(0, 1) == "·") || (var.Substring(0, 1) == "$"))
                { //Modos de operación
                    if (Strings.InStr(var, "·SUSTITUCIONES·") > 0)
                    {
                        cbListaSustitucion.Items.Add(entry.Value.ToString());
                    }
                    else if (Strings.Right(var, Idioma.Length) == Idioma)
                    {
                        aVar[0] = entry.Key.ToString();
                        aVar[1] = entry.Value.ToString();
                        dgModos.Rows.Add(aVar);
                    }
                }
                else
                { //Variables
                    if (Strings.Right(var, Idioma.Length) == Idioma)
                    {
                        aVar[0] = entry.Key.ToString();
                        aVar[1] = entry.Value.ToString();
                        dgVar.Rows.Add(aVar);
                    }
                }
            }
            StringCollection secciones = mCfg.Secciones();

            //Cargamos el combobox de gramáticas
            foreach (string s in secciones)
            {
                if ((Strings.InStr(s, "Valores") == 0) &&
                    (Strings.InStr(s, "Precision") == 0) &&
                    (Strings.InStr(s, "Ayuda") == 0) &&
                    (Strings.Right(s, Idioma.Length) == Idioma))
                {
                    string gram = s.Substring(0, s.Length - Idioma.Length);
                    cbGramaticas.Items.Add(gram);
                }
            }
            CargarComandos();
        }
Ejemplo n.º 4
0
        public void CargarGramatica()
        {
            if (cbGramaticas.SelectedIndex != -1)
            {
                //Recuperamos la información de configuración
                string    Seccion        = cbGramaticas.Items[cbGramaticas.SelectedIndex].ToString() + Idioma;
                string    SeccionValores = "";
                Hashtable h            = mCfg.Claves(Seccion);
                Hashtable hAyuda       = new Hashtable();
                Hashtable hPrecision   = new Hashtable();
                Hashtable hValores     = new Hashtable();
                bool      SecAyuda     = false;
                bool      SecPrecision = false;
                float     Precision    = 0;

                //ICollection ckeys;
                //ckeys = h.Keys;
                dgGramaticas.Rows.Clear();
                if (h.Count == 0)
                {
                    return;
                }
                SeccionValores = h["SeccionValores"].ToString();
                hValores       = mCfg.Claves(SeccionValores);
                if (h.Contains("SeccionAyuda"))
                {
                    SecAyuda = true;
                    hAyuda   = mCfg.Claves(h["SeccionAyuda"].ToString());
                }
                if (h.Contains("SeccionPrecision"))
                {
                    SecPrecision = true;
                    hPrecision   = mCfg.Claves(h["SeccionPrecision"].ToString());
                }
                if (h.Contains("ValorPrecision"))
                {
                    Precision = Convert.ToInt16(h["ValorPrecision"].ToString()) / 100;
                }

                foreach (DictionaryEntry entry in h)
                {
                    string   sPrecision;
                    string   sClave      = "";
                    string   sComandoVoz = "";
                    string   sAyuda      = "";
                    string   sMacro      = "";
                    string[] row         = new string[5];

                    sPrecision = "";
                    if ((entry.Key.ToString() != "SeccionValores") && (entry.Key.ToString() != "SeccionAyuda") && (entry.Key.ToString() != "SeccionPrecision"))
                    {
                        sClave      = entry.Key.ToString();
                        sComandoVoz = entry.Value.ToString();
                        sAyuda      = mCfg.RecuperarValorSeccion(hAyuda, sClave, SecAyuda);
                        sPrecision  = mCfg.RecuperarValorSeccion(hPrecision, sClave, SecPrecision);
                        if (SeccionValores != "")
                        {
                            sMacro = hValores[entry.Key.ToString()].ToString();
                        }
                        row[0] = sClave;
                        row[1] = sComandoVoz;
                        row[2] = sPrecision;
                        row[3] = sAyuda;
                        row[4] = sMacro;
                        if (sClave != "")
                        {
                            dgGramaticas.Rows.Add(row);
                        }
                    }
                }
            }
            else
            {
                dgGramaticas.Rows.Clear();
            }
        }