private void HighlightText(object sender, RoutedEventArgs e) { if (HourTextBox.IsFocused) { HourTextBox.SelectAll(); } else if (MinTextBox.IsFocused) { MinTextBox.SelectAll(); } }
private void addSupplybtn_Click(object sender, RoutedEventArgs e) { int i1 = 0, i2 = 0; foreach (UIElement elem in SupplyAddGrid.Children) { TextBox textbox = new TextBox(); if (elem is TextBox) { textbox = elem as TextBox; i1++; if (textbox.Text != "" && !Validation.GetHasError(textbox)) { i2++; } } } if (i1 == i2 && namebox.Text != "" && datepicker.Text != "") { Supply supply = new Supply(); supply.Company = namebox.Text; supply.Amount = Convert.ToInt32(AmountTextBox.Text); supply.SupDate = Convert.ToDateTime(datepicker.Text + " " + HourTextBox.Text + ":" + MinuteTextBox.Text); db.Supplies.Add(supply); db.SaveChanges(); MessageBox.Show("Добавлено!"); namebox.Text = ""; AmountTextBox.Clear(); datepicker.Text = ""; HourTextBox.Clear(); MinuteTextBox.Clear(); } else { MessageBox.Show("Неккоректные данные"); } }
private void AbortButton_Click(object sender, RoutedEventArgs e) { Process.Start("shutdown.exe", "-a"); HourTextBox.Focus(); }
public MainWindow() { InitializeComponent(); HourTextBox.Focus(); }
private void DayComboBoxSelectedIndexChanged(object sender, EventArgs e) { HourTextBox.Focus(); }