//private void txt_Algo_KeyDown(object sender, KeyEventArgs e) //{ // if (e.Key == Key.Enter && (!seConfiguroBuscador || !seConfiguroCampos)) // { // HerramientasWindow.MensajeError("El buscador requiere de configuración, Verificar código.", "Error"); // return; // } // if (e.Key != Key.Enter) // { // estaEnSeleccionGrid = false; // } // if (busquedaAnterior.Equals(txt_Algo.Text.Trim()) && !txt_Algo.Text.Trim().Equals("")) // { // estaEnSeleccionGrid = true; // } // if (e.Key == Key.Enter && !estaEnSeleccionGrid) // { // if (buscadorCatalogoPopup.Visibility == System.Windows.Visibility.Visible) // { // buscadorCatalogoPopup.Buscar(txt_Algo.Text.Trim()); // busquedaAnterior = txt_Algo.Text.Trim(); // } // else // { // String query = "select * from " + tipoObjetoABuscar.Name + " where (estaDeshabilitado = 0 or EstaDeshabilitado is null)"; // List<Object> valores = null; // List<ObjetoBase> resultado = null; // try // { // Object valor = Convert.ChangeType(txt_Algo.Text.Trim(), tipoObjetoBusqueda); // query += " and " + campoDefault + " = @" + campoDefault; // valores = new List<object>(); // valores.Add(valor); // resultado = manejador.Cargar(tipoObjetoABuscar, query, valores); // } // catch { } // if (resultado != null && resultado.Count > 0) // { // EscribirEnTextboxEtiqueta(resultado); // mostrarResultado(resultado); // } // else if (HerramientasWindow.MensajeSIoNO("No se encontró ningún resultado. ¿Desea utilizar la ayuda?", "Valores no devueltos")) // { // MostrarPopup(); // } // } // } // else if (e.Key == Key.Enter && estaEnSeleccionGrid) // { // buscadorCatalogoPopup.SeleccionarElemento(); // estaEnSeleccionGrid = false; // busquedaAnterior = ""; // } // else if (e.Key == Key.Escape) // { // OcultarPopup(); // } // else if (e.Key == Key.F1) // { // MostrarPopup(); // } //} //private void EscribirEnTextboxEtiqueta(List<ObjetoBase> resultado) //{ // txt_Etiqueta.Text = ""; // if (resultado.Count == 1) // { // FieldInfo CampoEtiqueta = resultado[0].GetType().GetField(campoEtiqueta, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); // txt_Etiqueta.Text += CampoEtiqueta.GetValue(resultado[0]).ToString(); // } // else // { // txt_Etiqueta.Text = "Multiples elementos"; // } // //foreach (ObjetoBase objetoEnLista in resultado) // //{ // // FieldInfo CampoEtiqueta = objetoEnLista.GetType().GetField(campoEtiqueta, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); // // txt_Etiqueta.Text += CampoEtiqueta.GetValue(objetoEnLista).ToString() + ", "; // //} // txt_Etiqueta.Visibility = System.Windows.Visibility.Visible; // //txt_Etiqueta.Text = txt_Etiqueta.Text.Substring(0, txt_Etiqueta.Text.Length - 2); // txt_Etiqueta.ToolTip = txt_Etiqueta.Text; // txt_Etiqueta.Focus(); // txt_Algo.Text = ""; //} private void MostrarPopup() { try { buscadorCatalogoPopup = new BuscadorCatalogoVentana(); buscadorCatalogoPopup.AsignarCatalogoParaAltas(rutaCatalogo); buscadorCatalogoPopup.AsignarManejadorDB(manejador); if (rutaCatalogo != null) { buscadorCatalogoPopup.ConfigurarBusqueda(tipoObjetoCatalogo, campoBusquedaDefault, campoEtiqueta, aceptaMultipleSeleccion, aceptaBusquedaDeshabilitados); foreach (String campoConAlias in camposConAlias) { buscadorCatalogoPopup.AgregarCampoAMostrarConAlias(campoConAlias); } } else { buscadorCatalogoPopup.ConfigurarBusqueda(tipoObjetoCatalogo, Query, aceptaMultipleSeleccion, aceptaBusquedaDeshabilitados); } buscadorCatalogoPopup.clickAceptar += buscadorCatalogoPopup_clickAceptar; buscadorCatalogoPopup.PalabraBusqueda = txt_Algo.Text; HerramientasWindow.MostrarVentanaDialogo(buscadorCatalogoPopup, false); //buscadorCatalogoPopup.ShowDialog(); } catch (Exception ex) { HerramientasWindow.MensajeError(ex, ex.Message, "Error en buscador catálogos"); } }