Esempio n. 1
0
        private void BtnOk_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(UsernameText.Text))
            {
                MessageBox.Show("You must enter a name!", "Invalid Name", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            if (AllUsers.Any(u => u.Username.Equals(UsernameText.Text, StringComparison.CurrentCultureIgnoreCase)))
            {
                MessageBox.Show("A user with that name already exists!", "Duplicate Name", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            Username = UsernameText.Text;
            Close();
        }
Esempio n. 2
0
 public bool UserHasRequested(string username)
 {
     return(AllUsers.Any(x => x.Equals(username, StringComparison.OrdinalIgnoreCase)));
 }