Ejemplo n.º 1
0
        public void CambiarIdiomaSinLogueo()

        {
            TraduccionComponent traduccionComponent = new TraduccionComponent();
            List <Traduccion>   traduccions         = new List <Traduccion>();
            IdiomaComponent     idiomaComponent     = new IdiomaComponent();
            Idioma idioma = new Idioma();

            idioma = (Idioma)cbIdioma.SelectedItem;


            traduccions = traduccionComponent.ReadByIdioma(idioma.Id);



            foreach (var traduccion in traduccions)
            {
                foreach (Control item in this.Controls)
                {
                    if (item.ToString().Contains("Label") || item.ToString().Contains("Button") || item.ToString().Contains("Tile"))
                    {
                        if (traduccion.palabra.palabra == item.Tag.ToString())
                        {
                            item.Text = traduccion.traduccion;
                        }
                    }
                    if (item.ToString().Contains("TabControl"))
                    {
                        foreach (Control subItem in item.Controls)
                        {
                            if (traduccion.palabra.palabra == subItem.Tag.ToString())
                            {
                                subItem.Text = traduccion.traduccion;
                            }

                            foreach (Control tab in subItem.Controls)
                            {
                                if (tab.ToString().Contains("Label") || tab.ToString().Contains("Button") || tab.ToString().Contains("Tile"))
                                {
                                    if (tab.Tag != null)
                                    {
                                        if (traduccion.palabra.palabra == tab.Tag.ToString())
                                        {
                                            tab.Text = traduccion.traduccion;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }



            SingletonIdioma.intance.CambiarIdioma(idioma);
        }
Ejemplo n.º 2
0
        public static void CambiarIdioma(MetroFramework.Forms.MetroForm metroForm)



        {
            TraduccionComponent traduccionComponent = new TraduccionComponent();
            List <Traduccion>   traduccions         = new List <Traduccion>();

            if (SingletonIdioma.intance.getUsuario() != null)
            {
                traduccions = traduccionComponent.ReadByIdioma(SingletonIdioma.intance.getUsuario().Id);

                CambiarIdiomaFormulario(metroForm, traduccions);
                CambiarIdiomaCotrolesFormulario(metroForm, traduccions);
                CambiarIdiomaCotrolesDentroDelTab(metroForm, traduccions);
            }
        }
Ejemplo n.º 3
0
        private void llenarGrilla()
        {
            mgListado.Rows.Clear();
            TraduccionComponent idiomaComponent = new TraduccionComponent();
            List <Traduccion>   idiomas         = new List <Traduccion>();

            idiomas = idiomaComponent.ReadByIdioma(int.Parse(cbIdioma.SelectedValue.ToString()));
            int n = 0;

            foreach (Traduccion item in idiomas)
            {
                n = mgListado.Rows.Add();
                mgListado.Rows[n].Cells[0].Value = item.idioma.Id;
                mgListado.Rows[n].Cells[1].Value = item.palabra.Id;
                mgListado.Rows[n].Cells[2].Value = item.palabra.palabra;
                mgListado.Rows[n].Cells[3].Value = item.traduccion;
                n++;
            }
        }
Ejemplo n.º 4
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            TraduccionComponent traduccionComponent = new TraduccionComponent();

            if (txtIdioma.Text == "")
            {
                MetroMessageBox.Show(this, "Campo Traduccion vacio", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Entities.Idioma idioma = new Entities.Idioma();
                idioma.Id = int.Parse(mgListado.CurrentRow.Cells[0].Value.ToString());
                Palabra palabra = new Palabra();
                palabra.Id = int.Parse(mgListado.CurrentRow.Cells[1].Value.ToString());
                Traduccion traduccion = new Traduccion(idioma, palabra);


                traduccion.traduccion = txtIdioma.Text;
                traduccionComponent.Update(traduccion);
            }
        }
Ejemplo n.º 5
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     if (txtBuscar.Text == "" || mgListado.RowCount == 0)
     {
         MetroMessageBox.Show(this, "Campo buscar vacio o no selecciono el idioma", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         List <Traduccion>   traduccions         = new List <Traduccion>();
         TraduccionComponent traduccionComponent = new TraduccionComponent();
         traduccions = traduccionComponent.buscar(txtBuscar.Text);
         mgListado.Rows.Clear();
         int n = 0;
         foreach (var item in traduccions)
         {
             n = mgListado.Rows.Add();
             mgListado.Rows[n].Cells[0].Value = item.idioma.Id;
             mgListado.Rows[n].Cells[1].Value = item.palabra.Id;
             mgListado.Rows[n].Cells[2].Value = item.palabra.palabra;
             mgListado.Rows[n].Cells[3].Value = item.traduccion;
             n++;
         }
     }
 }