/// <summary> /// Comprueba cambios en la seleccion del listview lvMenu, para abrir el usercontrol correspondiente según la opción elegida por el usuario. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LvMenu_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "lvHome": HomeTicketControl contenido = new HomeTicketControl(usuarioCliente); principal.Children.Insert(1, contenido); principal.Children.RemoveAt(0); panelActual.VentanaActiva = "HomeTicketControl"; break; case "lvCrear": CrearTicketControl contenido2 = new CrearTicketControl(usuarioCliente); principal.Children.Insert(1, contenido2); principal.Children.RemoveAt(0); panelActual.VentanaActiva = "CrearTicketControl"; break; case "lvVer": VerHistoricoTicketsControl contenido3 = new VerHistoricoTicketsControl(usuarioCliente); principal.Children.Insert(1, contenido3); principal.Children.RemoveAt(0); panelActual.VentanaActiva = "VerHistoricoTicketsControl"; break; } } catch (IOException error) { gestionarBarra(Brushes.IndianRed, error.Message); } }
//-------------------------------------------------------------------FUNCIONES AUXILIARES------------------------------------------------------------------------------------------ /// <summary> /// Permite gestionar la barra de estado de la aplicación, mostrando errores relacionados con el acceso a la base de datos. /// </summary> /// <param name="color"></param> /// <param name="error"></param> private void gestionarBarra(Brush color, string error) { switch (panelActual.VentanaActiva) { case "HomeTicketControl": HomeTicketControl control1 = (HomeTicketControl)principal.Children[0]; control1.statusBar.Background = color; control1.tbStatusInformation.Text = error; break; case "CrearTicketControl": CrearTicketControl control = (CrearTicketControl)principal.Children[0]; control.statusBar.Background = color; control.tbStatusInformation.Text = error; break; case "VerHistoricoTicketsControl": VerHistoricoTicketsControl control2 = (VerHistoricoTicketsControl)principal.Children[0]; control2.statusBar.Background = color; control2.tbStatusInformation.Text = error; break; } }
//--------------------------------------------------------------------------------FUNCIONES AUXILIARES--------------------------------------------------------------------------- private void gestionarBarra(Brush color, string error) { switch (panelActual.VentanaActiva) { case "TicketTecnicoControl": TicketTecnicoControl control25 = (TicketTecnicoControl)principal.Children[0]; control25.statusBar.Background = color; control25.tbStatusInformation.Text = error; break; case "GestionarTecnicoTicketcontrol": GestionarTecnicoTicketControl control24 = (GestionarTecnicoTicketControl)principal.Children[0]; control24.statusBar.Background = color; control24.tbStatusInformation.Text = error; break; case "GestionarTicketsAdminControl": GestionarTicketsAdminControl control23 = (GestionarTicketsAdminControl)principal.Children[0]; control23.statusBar.Background = color; control23.tbStatusInformation.Text = error; break; case "HomeTicketControl": HomeTicketControl control22 = (HomeTicketControl)principal.Children[0]; control22.statusBar.Background = color; control22.tbStatusInformation.Text = error; break; case "CrearCodigoBarrasControl": CrearCodigoBarrasContorl control20 = (CrearCodigoBarrasContorl)principal.Children[0]; control20.statusBar.Background = color; control20.tbStatusInformation.Text = error; break; case "CrearTicketControl": CrearTicketControl control21 = (CrearTicketControl)principal.Children[0]; control21.statusBar.Background = color; control21.tbStatusInformation.Text = error; break; case "ticketsPendientescontrol": ticketsPendientescontrol control1 = (ticketsPendientescontrol)principal.Children[0]; control1.statusBar.Background = color; control1.tbStatusInformation.Text = error; break; case "CrearTicketsAdminControl": CrearTicketsAdminControl control = (CrearTicketsAdminControl)principal.Children[0]; control.statusBar.Background = color; control.tbStatusInformation.Text = error; break; case "VerHistoricoTicketsControl": VerHistoricoTicketsControl control2 = (VerHistoricoTicketsControl)principal.Children[0]; control2.statusBar.Background = color; control2.tbStatusInformation.Text = error; break; case "EditarTicketsAdminControl": EditarTicketsAdminControl control3 = (EditarTicketsAdminControl)principal.Children[0]; control3.statusBar.Background = color; control3.tbStatusInformation.Text = error; break; case "UsuariosControl": UsuariosControl control4 = (UsuariosControl)principal.Children[0]; control4.statusBar.Background = color; control4.tbStatusInformation.Text = error; break; case "SedesControl": SedesControl control5 = (SedesControl)principal.Children[0]; control5.statusBar.Background = color; control5.tbStatusInformation.Text = error; break; case "LocalidadesControl": LocalidadesControl control6 = (LocalidadesControl)principal.Children[0]; control6.statusBar.Background = color; control6.tbStatusInformation.Text = error; break; case "CategoriasControl": CategoriasControl control7 = (CategoriasControl)principal.Children[0]; control7.statusBar.Background = color; control7.tbStatusInformation.Text = error; break; case "EquiposControl": EquiposControl control8 = (EquiposControl)principal.Children[0]; control8.statusBar.Background = color; control8.tbStatusInformation.Text = error; break; } }