private void Window_PreviewKeyDown(object sender, KeyEventArgs e) { int count = StackPanelContainer.Children.Count; if (e.Key == Key.Down && count > 0 && StackPanelContainer.Children[count - 1].IsFocused) { StackPanelContainer.Children[0].Focus(); e.Handled = true; } else if (e.Key == Key.Up && count > 0 && StackPanelContainer.Children[0].IsFocused) { StackPanelContainer.Children[count - 1].Focus(); e.Handled = true; } else if (e.Key == Key.Escape) { TextBoxName.Clear(); } else if (e.Key == Key.Enter) { if (count == 1) { IndexButton indexButton = StackPanelContainer.Children[0] as IndexButton; indexButton.IndexButtonClick(indexButton, null); } } else if (e.Key != Key.Up && e.Key != Key.Down) { TextBoxName.Focus(); } }
private void ButtonFindOrAddPlayer_Click(object sender, RoutedEventArgs e) { string name = TextBoxName.Text; // Om empty vissa messagebox if (!string.IsNullOrEmpty(name)) { Player getPlayer = dataHandeler.GetPlayerByName(name); // Om spelare finns skriv all info till listbox if (getPlayer != null) { guiHandeler.GenerateListData(ref ListBoxStatsInfo, getPlayer, dataHandeler.GetPlayers()); } else { // Om ej finns skapa ny spelare dataHandeler.AddNewPlayer(name); // For Debug WriteNamesAndLevelsToListBoxesForDebugPurpes(); MessageBox.Show("La till spelare " + name); } TextBoxName.Clear(); } else { MessageBox.Show("Du angav inget namn!"); } }
private bool CheckedUser() { String strName = TextBoxName.Text.Trim(); if (_strDic.Count > 0 && _strDic.ContainsKey(strName)) { MessageBox.Show("用户名【" + strName + "】已经存在,请重新输入!", "操作提示"); return(false); } if (!strName.Equals("260905")) { if (strName.Equals(string.Empty)) { TextBoxName.Clear(); TextBoxName.Focus(); MessageBox.Show("用户名不能为空!", "操作提示"); return(false); } else if (TextBoxPassword.Text.Trim().Equals(string.Empty)) { TextBoxPassword.Clear(); TextBoxPassword.Focus(); MessageBox.Show("密码不能为空!", "操作提示"); return(false); } } else { MessageBox.Show("不能创建该用户!", "操作提示"); return(false); } return(true); }
public void ClearUsersTextBox() { TextBoxName.Clear(); TextBoxPassword.Clear(); RadioAdmi.IsChecked = false; RadioUser.IsChecked = false; }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { _dbReactor.AddUser(TextBoxName.Text.ToUpper(), TextBoxPassword.Text.ToUpper()); lableAnswer.Content = $"User {TextBoxName.Text} created"; TextBoxName.Clear(); TextBoxPassword.Clear(); }
private void ClearControls() { TextBoxCode.Clear(); TextBoxName.Clear(); TextBoxCost.Clear(); ComboBoxCategory.ResetText(); }
private void TextBoxName_GotFocus(object sender, RoutedEventArgs e) { if (TextBoxName.Text == "请输入姓名+学号") { TextBoxName.Clear(); } }
//Updates the edited user private void UpdateButton_Click(object sender, RoutedEventArgs e) { if (CheckInput()) { if (CheckForDuplicate()) { NewUser(); if (((User)ListBoxUsers.SelectedItem != null)) { ((User)ListBoxUsers.SelectedItem).Name = TextBoxName.Text; ((User)ListBoxUsers.SelectedItem).Email = TextBoxEmail.Text; ListBoxUsers.Items.Remove(ListBoxUsers.SelectedItem); } else if (((User)ListBoxAdmins.SelectedItem != null)) { ((User)ListBoxAdmins.SelectedItem).Name = TextBoxName.Text; ((User)ListBoxAdmins.SelectedItem).Email = TextBoxEmail.Text; ListBoxAdmins.Items.Remove(ListBoxAdmins.SelectedItem); } ButtonsDisabled(); UpdateButton.IsEnabled = false; ButtonCreateUser.IsEnabled = true; ListBoxUsers.IsEnabled = true; ListBoxAdmins.IsEnabled = true; TextBoxName.Clear(); TextBoxEmail.Clear(); } } }
//Очистка текстбоксов private void ClearTextBoxes() { TextBoxSurname.Clear(); TextBoxName.Clear(); TextBoxPatronymic.Clear(); TextBoxSalary.Clear(); }
private void BtnCancel_Click(object sender, RoutedEventArgs e) { TextBoxName.Clear(); TextBoxFamily.Clear(); TextBoxThirdName.Clear(); TextBoxAddress.Clear(); TextBoxNumber.Clear(); }
private void addWorkersToPlaces() { name = TextBoxName.Text.ToString(); department = TextBoxName.Text.ToString(); TextBoxName.Clear(); TextBoxDepartment.Clear(); state = true; }
public void CLearFields() { TextBoxSurname.Clear(); TextBoxName.Clear(); MaskedTBPhone.Clear(); TextBoxEmail.Clear(); LabelNumber.Text = ""; }
/// <summary> /// Clears the TextBoxes after they have been used. /// </summary> private void CRUDTextBoxClear() { TextBoxName.Clear(); TextBoxYearOfBirth.Clear(); TextBoxPlaceOfBirth.Clear(); comboBoxMother.Items.Clear(); comboBoxFather.Items.Clear(); TextBoxYearOfDeath.Clear(); TextBoxPlaceOfDeath.Clear(); }
void clear() { TextBoxName.Clear(); TextBoxDes.Clear(); venue.Clear(); organize.Clear(); satrt.ResetText(); strtime.ResetText(); Endt.ResetText(); Endtime.ResetText(); }
private void ClearButton_Click(object sender, RoutedEventArgs e) { TextBoxID.Clear(); TextBoxName.Clear(); TextBoxCompany.Clear(); TextBoxCity.Clear(); TextBoxCountry.Clear(); ListBoxLog.Items.Insert(0, ""); ListBoxLog.Items.Insert(0, DateTime.Now); ListBoxLog.Items.Insert(0, "USER CLEARED TEXT"); }
//Create user button private void ButtonCreateUser_Click(object sender, RoutedEventArgs e) { if (CheckInput()) { if (CheckForDuplicate()) { NewUser(); TextBoxName.Clear(); TextBoxEmail.Clear(); } } ListBoxUsers.UnselectAll(); ListBoxAdmins.UnselectAll(); ButtonsDisabled(); }
private void buttonSearchByName_Click(object sender, EventArgs e) { if (myPhoneBook.ContainsKey(TextBoxName.Text)) // checks if the value from the textbox exists in the dictionary as a key { var searchedValue = myPhoneBook.FirstOrDefault(x => x.Key == TextBoxName.Text).Value; // lambda expression to take the value of the selected key MessageBox.Show(TextBoxName.Text + " - " + searchedValue, "Contact Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); // message box that shows the searched contact information TextBoxName.Clear(); // if such a value is found, the textbox is cleared } else if (TextBoxName.Text == string.Empty) // checks to make sure the text box is not empty and a message appears if it is { MessageBox.Show("Please, enter a contact name to search for", "No contact", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } else // if no contact is found, a message appears { MessageBox.Show("No such contact", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } }
private void buttonAddContact_Click(object sender, EventArgs e) { int phoneNumber; try // checks if all the entries are correctly inputed { phoneNumber = int.Parse(TextBoxPhone.Text); if (TextBoxName.Text != string.Empty && phoneNumber != 0) // checks if textboxes are not empty { listBoxItemsCollection.Items.Add(TextBoxName.Text + "-0" + phoneNumber); // adds the name from the textboxName and the phone number to the listboxcollection } else if (TextBoxName.Text == string.Empty) // checks if TextBoxName is empty and shows a warning message { MessageBox.Show("Please enter a contact name!", "Input value missing", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk); } else if (phoneNumber == 0) // checks if the a phone number is entered and shows a message if empty { MessageBox.Show("Please enter a phone number!", "Input value missing", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk); } } catch (FormatException) // Makes sure the format of the number input is correct { MessageBox.Show("Incorrect input", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop); } try { myPhoneBook.Add(TextBoxName.Text, TextBoxPhone.Text); // Checks if an entry already exists in the dictionary } catch (ArgumentException) { MessageBox.Show("Such name or number already exists", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } TextBoxName.Clear(); // clears the name textbox after the entry is added TextBoxPhone.Clear(); // clears the number textbox after the entry is added }
private void OnNewItemLoaded(object sender, RoutedEventArgs e) { TextBoxName.Clear(); TextBoxName.Focus(); }
private void OnUserInputViewLoaded(object sender, RoutedEventArgs e) { TextBoxName.Clear(); TextBoxName.Focus(); }
private void Button_Click_Clear(object sender, RoutedEventArgs e) { TextBoxName.Clear(); }
private void ClearControls() { TextBoxAddress.Clear(); TextBoxName.Clear(); TextBoxClasses.Clear(); }
private void ButtonSignOut_Click(object sender, RoutedEventArgs e) { SignOut(); TextBoxName.Clear(); this.Focus(); }