private void logeoExitoso(int cargo) { home = new CrewPantalla(); home.Boton = btnHome; home.Tipo = BTNtipo.vacio; pnlLateralIzquierdo.Visible = true; ishome = true; //Limpiamos las pantallas en caso se hizo un cierre de cesión. while (Program.pantallas.Count > 0) { if (Program.pantallas.Last().Formulario != null) { Program.pantallas.Last().Formulario.Close(); } Program.pantallas.RemoveAt(Program.pantallas.Count - 1); } if (cargo == 1) { btnHome.Text = " VENDEDOR"; pnlJefeDeVentas.Visible = false; home.Formulario = new frmHomeVendedor(); } else if (cargo == 2) { btnHome.Text = " JEFE DE VENTAS"; pnlEmpleado.Visible = false; home.Formulario = new frmHomeJefe(); } else { MessageBox.Show(" ERROR!!!!!!!!"); } Program.pantallas.Add(home); llamarFormulario(home.Formulario); }
private void CreaPantalla(IconButton sender, CrewPantalla padreb, Panel panel, Color color, BTNtipo tipo, Form formulario) { Program.pantallas.Add(new CrewPantalla(sender, padreb, panel, color, formulario, tipo)); if (Program.pantallas.Count > nMaxAnt) { //NUMERO COMO MAXIMO DE FORMULARIOS EN LA COLA Program.pantallas.RemoveAt(1); } }
public CrewPantalla(IconButton boton, CrewPantalla padre, Panel panel, Color color, Form formulario, BTNtipo tipo) { Boton = boton; Padre = padre; Panel = panel; Color = color; Formulario = formulario; Tipo = tipo; }
private void ClickBoton(IconButton sender, CrewPantalla padreb, Panel panel, Color color, BTNtipo tipo, Form formulario, bool n, bool a, bool e, bool b, bool f) { if (sender != null) //si el boton existe { //BOTON DE CABECERA if (Program.pantallas.Last().Tipo == BTNtipo.cabecera) { Program.pantallas.Last().Formulario.Hide(); Program.pantallas.Last().Formulario.Close(); Program.pantallas.RemoveAt(Program.pantallas.Count - 1); } //BOTON NUEVO if (Program.pantallas.Last().Boton != sender) { if (tipo != BTNtipo.btnDePanel) //SI EL NUEVO NO ES DE PANEL { if (padre != null && padre.Boton == sender) //SI ME HAGO CLICK SIENDO PADRE ACTIVO { DesactivaBoton(padre); ActivaBoton(Program.pantallas.First()); return; } DesactivaBoton(Program.pantallas.Last()); //Desactivamos el anterior DesactivaBoton(Program.pantallas.Last().Padre); //y su padre por si acaso } else //SI ES DE PANEL { frmVentanaPrincipal.antBtn = 0; if (Program.pantallas.Last().Tipo == BTNtipo.btnDePanel) { DesactivaBoton(Program.pantallas.Last()); //Desactivamos el anterior que sea de panel } } CreaPantalla(sender, padreb, panel, color, tipo, formulario); Program.pantallas.Last().SetCabecera(n, a, e, b, f); //Activo lo que tiene que hacer ese botón y muestro su cabecera respectiva ActivaBoton(Program.pantallas.Last()); ocultaBotonesCabecera(n, a, e, b, f); if (Program.pantallas.Last().Tipo == BTNtipo.btnConPanel) { btnRecarga.Visible = true; } } else //MISMO BOTON { DesactivaBoton(Program.pantallas.Last()); Program.pantallas.RemoveAt(Program.pantallas.Count - 1); ActivaBoton(Program.pantallas.First()); } btnRight.Visible = btnLeft.Visible = false; } }
private void ActivaBoton(CrewPantalla sender) { if (sender != null) { switch (sender.Tipo) { case BTNtipo.btnConPanel: ishome = true; padre = sender; pintaBoton(sender.Boton, Program.colorR); showSubMenu(sender.Panel); btnRecarga.Visible = true; break; case BTNtipo.btnDePanel: ishome = false; //desactivaBotonesCabecera(true, true, true, true, true); sender.Boton.ForeColor = Program.colorR; llamarFormulario(sender.Formulario); break; case BTNtipo.btnSinPanel: ishome = false; pintaBoton(sender.Boton, Program.colorR); llamarFormulario(sender.Formulario); break; case BTNtipo.cabecera: ishome = false; llamarFormulario(sender.Formulario); break; case BTNtipo.vacio: ishome = true; lblCountRows.Text = ""; Program.pantallas.First().Formulario.BringToFront(); Program.pantallas.First().Formulario.Show(); ocultaBotonesCabecera(false, false, false, false, false); btnRecarga.Visible = true; break; default: MessageBox.Show("BTNtipo aun no declarado"); break; } btnRight.Visible = btnLeft.Visible = false; } }
private void DesactivaBoton(CrewPantalla sender) { if (sender != null) { switch (sender.Tipo) { case BTNtipo.btnConPanel: hideSubMenu(sender.Panel); despintaBoton(sender.Boton); padre = null; break; case BTNtipo.btnDePanel: sender.Formulario.Visible = false; sender.Boton.ForeColor = Color.Gainsboro; break; case BTNtipo.btnSinPanel: sender.Formulario.Visible = false; despintaBoton(sender.Boton); break; case BTNtipo.cabecera: sender.Formulario.Visible = false; break; case BTNtipo.vacio: ocultaBotonesCabecera(false, false, false, false, false); break; default: break; } estado = BTNestado.vacio; estadoBotones(); btnRight.Visible = btnLeft.Visible = false; } }