예제 #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 ToAdminButton_Click(object sender, RoutedEventArgs e)
 {
     User.ToAdmin(currentUser);
     currentUser = null;
     UserListBox.UnselectAll();
     RefreshListBoxes();
     ClearTextFields();
     UserListBox.UnselectAll();
     SetUserButtons(false);
 }
예제 #4
0
        private void AdminListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (AdminListBox.SelectedItem != null)
            {
                UserListBox.UnselectAll();
                ClearTextFields();
                SetUserButtons(false);
                SetAdminButtons(true);
                currentUser = null;

                currentAdmin           = (AdminListBox.SelectedItem as User);
                NameTextBox.Text       = currentAdmin.Name;
                MailTextBox.Text       = currentAdmin.Mail;
                MailAdminLabel.Content = $"Mail: {currentAdmin.Mail}";
            }
        }
예제 #5
0
 private void AdminListBox_SelectionChange(object sender, SelectionChangedEventArgs e)
 {
     DemoteButton.IsEnabled            = true;
     UserDeletionButton.IsEnabled      = true;
     UsrerModificationButton.IsEnabled = true;
     if ((User)AdminListBox.SelectedItem != null)
     {
         UserListBox.UnselectAll();
         UserInfoLabel.Content = "Admin: " + ((User)AdminListBox.SelectedItem).UserName +
                                 "\nEmail Adress: " + ((User)AdminListBox.SelectedItem).Email;
     }
     else
     {
         UserInfoLabel.Content = string.Empty;
     }
 }
예제 #6
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);
     }
 }