private void cargarPreferencias() //se carga desde el id del usuario que se carga en el constructor de la clase
        {
            this.lugarDelAcento = lugarAcento.derechaDeLaEñe;

            XmlDocument xml = new XmlDocument();
            if (File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\Recursos\Preferencias\" + this.idUsuario.ToString() + ".xml"))
                xml.Load(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\Recursos\Preferencias\" + this.idUsuario.ToString() + ".xml");
            else
                xml.Load(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\Recursos\Preferencias\Default.xml");

            XmlNodeList preferencias = xml.GetElementsByTagName("preferencias");

            XmlNodeList pref = ((XmlElement)preferencias[0]).GetElementsByTagName("nombreUsuario");
            this.nombreUsuario = pref[0].InnerText;

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("nombreLetra");
            this.nombreLetra = pref[0].InnerText;

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("tamañoLetra");
            this.tamañoLetra = Int32.Parse(pref[0].InnerText);

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("colorLetra");
            this.colorLetra= pref[0].InnerText;

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("colorFondo");
            this.colorFondo = pref[0].InnerText;

            //pref = ((XmlElement)preferencias[0]).GetElementsByTagName("nivel");
            //switch (pref[0].InnerText)
            //{
            //    case "principiante":
            //        this.nivel = nivelActividad.principiante;
            //        break;
            //    case "intermedio":
            //        this.nivel = nivelActividad.intermedio;
            //        break;
            //    case "experto":
            //        this.nivel = nivelActividad.experto;
            //        break;
            //}

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("nombreSintetizador");
            this.nombreSintetizador = pref[0].InnerText;

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("velocidadSintetizador");
            this.velocidadSintetizador = Int32.Parse(pref[0].InnerText);

            //pref = ((XmlElement)preferencias[0]).GetElementsByTagName("últimaActividad");
            //this.últimaActividad = Int32.Parse(pref[0].InnerText);

            //pref = ((XmlElement)preferencias[0]).GetElementsByTagName("últimaLección");
            //this.últimaLección = Int32.Parse(pref[0].InnerText);

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("swPorTiempo");
            this.swPorTiempo = Boolean.Parse(pref[0].InnerText);

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("swMostrarLetrasEnMayúsculas");
            this.swMostrarLetrasEnMayúsculas = Boolean.Parse(pref[0].InnerText);

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("cantSegundos");
            this.cantSegundosPorTiempo = Int32.Parse(pref[0].InnerText);
        }
Exemple #2
0
        private void cargarPreferencias() //se carga desde el id del usuario que se carga en el constructor de la clase
        {
            this.lugarDelAcento = lugarAcento.derechaDeLaEñe;

            XmlDocument xml = new XmlDocument();

            if (File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\Recursos\Preferencias\" + this.idUsuario.ToString() + ".xml"))
            {
                xml.Load(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\Recursos\Preferencias\" + this.idUsuario.ToString() + ".xml");
            }
            else
            {
                xml.Load(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\Recursos\Preferencias\Default.xml");
            }

            XmlNodeList preferencias = xml.GetElementsByTagName("preferencias");

            XmlNodeList pref = ((XmlElement)preferencias[0]).GetElementsByTagName("nombreUsuario");

            this.nombreUsuario = pref[0].InnerText;

            pref             = ((XmlElement)preferencias[0]).GetElementsByTagName("nombreLetra");
            this.nombreLetra = pref[0].InnerText;

            pref             = ((XmlElement)preferencias[0]).GetElementsByTagName("tamañoLetra");
            this.tamañoLetra = Int32.Parse(pref[0].InnerText);

            pref            = ((XmlElement)preferencias[0]).GetElementsByTagName("colorLetra");
            this.colorLetra = pref[0].InnerText;

            pref            = ((XmlElement)preferencias[0]).GetElementsByTagName("colorFondo");
            this.colorFondo = pref[0].InnerText;

            //pref = ((XmlElement)preferencias[0]).GetElementsByTagName("nivel");
            //switch (pref[0].InnerText)
            //{
            //    case "principiante":
            //        this.nivel = nivelActividad.principiante;
            //        break;
            //    case "intermedio":
            //        this.nivel = nivelActividad.intermedio;
            //        break;
            //    case "experto":
            //        this.nivel = nivelActividad.experto;
            //        break;
            //}

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("nombreSintetizador");
            this.nombreSintetizador = pref[0].InnerText;

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("velocidadSintetizador");
            this.velocidadSintetizador = Int32.Parse(pref[0].InnerText);

            //pref = ((XmlElement)preferencias[0]).GetElementsByTagName("últimaActividad");
            //this.últimaActividad = Int32.Parse(pref[0].InnerText);

            //pref = ((XmlElement)preferencias[0]).GetElementsByTagName("últimaLección");
            //this.últimaLección = Int32.Parse(pref[0].InnerText);

            pref             = ((XmlElement)preferencias[0]).GetElementsByTagName("swPorTiempo");
            this.swPorTiempo = Boolean.Parse(pref[0].InnerText);

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("swMostrarLetrasEnMayúsculas");
            this.swMostrarLetrasEnMayúsculas = Boolean.Parse(pref[0].InnerText);

            pref = ((XmlElement)preferencias[0]).GetElementsByTagName("cantSegundos");
            this.cantSegundosPorTiempo = Int32.Parse(pref[0].InnerText);
        }