private void CargaDatosIniciales() { //no permitir agregar repetidos a la lista try { BackgroundWorker bk = new BackgroundWorker(); BusyBar.IsBusy = true; bk.DoWork += (o, e) => { // }; bk.RunWorkerCompleted += (o, e) => { Partidascombobox.ItemsSource = listacombo; Partidascombobox.DisplayMemberPath = "DESCRIPCION"; Partidascombobox.SelectedValuePath = "VALOR"; Partidascombobox.SelectedIndex = 0; BusyBar.IsBusy = false; }; bk.RunWorkerAsync(); PartidatextBox.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Window_KeyDown(object sender, KeyEventArgs e) { if ((e.Key == Key.Escape)) { if (ArticulotextBox.IsFocused) { ArticulotextBox.Text = ""; } else if (PartidatextBox.IsFocused) { PartidatextBox.Text = ""; } else if (ContratotextBox.IsFocused) { ContratotextBox.Text = ""; } else { Close(); } } else if ((e.Key == Key.Enter)) { if (ArticulotextBox.IsFocused || PartidatextBox.IsFocused || ContratotextBox.IsFocused) { realizarbusquedarticulo(); PartidatextBox.Focus(); } } }
private void Buscarbutton_Click(object sender, RoutedEventArgs e) { try { realizarbusquedarticulo(); PartidatextBox.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void limpiartextsbutton_Click(object sender, RoutedEventArgs e) { try { ArticulotextBox.Text = ""; PartidatextBox.Text = ""; ContratotextBox.Text = ""; PartidatextBox.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void limpiarbusquedabutton_Click(object sender, RoutedEventArgs e) { try { //Limpia la grilla y elimina todos los que no se hayan seleccionado ListArticulos.RemoveAll(x => x.CHECKSEL == false); ArticulosdataGrid.ItemsSource = null; ArticulosdataGrid.ItemsSource = ListArticulos; PartidatextBox.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }