예제 #1
0
 private void UpdateButton_Click(object sender, RoutedEventArgs e)
 {
     nameInput = NameTextBox.Text.Trim();
     mailInput = MailTextBox.Text.Replace(" ", "");
     if (!IsNameAndMailCorrect(nameInput, mailInput, "Updating user"))
     {
         return;
     }
     if (currentUser != null)
     {
         currentUser.Name = nameInput;
         currentUser.Mail = mailInput;
         RefreshListBoxes();
         ClearTextFields();
         UserListBox.UnselectAll();
         SetUserButtons(false);
     }
     else if (currentAdmin != null)
     {
         currentAdmin.Name = nameInput.Trim();
         currentAdmin.Mail = mailInput.Replace(" ", "");
         RefreshListBoxes();
         ClearTextFields();
         AdminListBox.UnselectAll();
         SetAdminButtons(false);
     }
 }
예제 #2
0
 private void UserCreationButton_Click(object sender, RoutedEventArgs e) //todo = conecta till CheckInput
 {
     NewUser();
     EnterNameTextbox.Clear();
     EnterEmailTextbox.Clear();
     AdminListBox.UnselectAll();
     UserListBox.UnselectAll();
     ButtonsDisabled();
 }
예제 #3
0
 private void ToUserButton_Click(object sender, RoutedEventArgs e)
 {
     User.ToUser(currentAdmin);
     currentAdmin = null;
     AdminListBox.UnselectAll();
     RefreshListBoxes();
     ClearTextFields();
     AdminListBox.UnselectAll();
     SetAdminButtons(false);
 }
예제 #4
0
 private void UserListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (UserListBox.SelectedItem != null)
     {
         AdminListBox.UnselectAll();
         ClearTextFields();
         SetAdminButtons(false);
         SetUserButtons(true);
         currentAdmin          = null;
         currentUser           = (UserListBox.SelectedItem as User);
         NameTextBox.Text      = currentUser.Name;
         MailTextBox.Text      = currentUser.Mail;
         MailUserLabel.Content = $"Mail: {currentUser.Mail}";
     }
 }
예제 #5
0
 private void UserListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     UserPromotionButton.IsEnabled     = true;
     UserDeletionButton.IsEnabled      = true;
     UsrerModificationButton.IsEnabled = true;
     if ((User)UserListBox.SelectedItem != null)
     {
         AdminListBox.UnselectAll();
         UserInfoLabel.Content = "Username: "******"\nEmail Adress: " + ((User)UserListBox.SelectedItem).Email;
     }
     else
     {
         UserInfoLabel.Content = string.Empty;
     }
 }
예제 #6
0
 private void UserListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (UserListBox.SelectedItem != null)
     {
         AdminListBox.UnselectAll();
         ClearTextFields();
         var selected = (UserListBox.SelectedItem as Users);
         NameBox.Text               = selected.Name;
         EmailBox.Text              = selected.Mail;
         MakeAdminButton.IsEnabled  = true;
         EditUserButton.IsEnabled   = true;
         DeleteUserButton.IsEnabled = true;
     }
     else
     {
         MakeAdminButton.IsEnabled  = false;
         EditUserButton.IsEnabled   = false;
         DeleteUserButton.IsEnabled = false;
     }
 }
예제 #7
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     if (currentUser != null)
     {
         User.users.Remove(currentUser);
         currentUser = null;
         RefreshListBoxes();
         ClearTextFields();
         UserListBox.UnselectAll();
         SetUserButtons(false);
     }
     else if (currentAdmin != null)
     {
         User.admins.Remove(currentAdmin);
         currentAdmin = null;
         RefreshListBoxes();
         ClearTextFields();
         AdminListBox.UnselectAll();
         SetAdminButtons(false);
     }
 }