Пример #1
0
 private void buttonAddUser_Click(object sender, EventArgs e)
 {
     try
     {
         UserFormController controller = createNewUserController();
         var userForm = new UserForm(controller);
         if (userForm.ShowDialog() == DialogResult.OK)
         {
             addUser(controller.User);
             listViewUsers.SelectedItems.Clear();
             ListViewItem listViewUser = addUserToList(controller.User);
             listViewUser.Selected = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #2
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                UserFormController controller = createEditController();
                var userForm = new UserForm(controller);

                if (userForm.ShowDialog() == DialogResult.OK)
                {
                    UserData.Instance.Save();
                    loadUsers();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }