public DeletedAccountsViewer(Webserver ws, List <Person> deletedAccounts, List <Person> failedAccounts)
        {
            InitializeComponent();
            gbDeletedAccounts.Height = this.Height / 2;

            this.ws = ws;
            this.deletedAccounts = deletedAccounts;
            this.failedAccounts  = failedAccounts;
        }
        private async void btnCreateAccounts_Click(object sender, EventArgs e)
        {
            // Check if a group is selected to create accounts for
            string group = (string)cmbGroups.SelectedItem;

            if (string.IsNullOrEmpty(group))
            {
                ShowMessage("Selecteer een klas.");
                return;
            }

            // Get the webserver on which the accounts should be created
            Webserver ws = (Webserver)cmbWebservers.SelectedItem;

            if (!webservers.Contains(ws))
            {
                ShowMessage("Selecteer een webserver");
                return;
            }

            // Confirm the button was not clicked on accident.
            var confirm = MessageBox.Show(
                string.Format(
                    "Bij bevestiging worden direct accounts voor {0} aangemaakt op het domein \"{1}\".{2}{2}Weet je zeker dat je dit wilt?",
                    group, ws.domain, Environment.NewLine),
                "Bevestig aanmaken accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (confirm != DialogResult.Yes)
            {
                return;
            }

            // Disable the button to prevent multiple executions
            btnCreateAccounts.Enabled = false;
            btnCreateAccounts.Text    = "Working...";

            List <Person> studentsInGroup = students.FindAll(s => s.group == group);
            var           result          = await ws.createAccounts(studentsInGroup);

            // Split the result in successful and failed account creations
            List <Person> createdAccounts = result.Item1;
            List <Person> failedAccounts  = result.Item2;

            // Null will be returned if there is not enough space
            if (createdAccounts == null)
            {
                ShowMessage("Er is niet genoeg ruimte beschikbaar op de server");
                return;
            }

            // Show the accounts that were successfully created
            dgvSuccessAccounts.DataSource = createdAccounts;
            gbSuccessAccounts.Text        = string.Format("Succesvol aangemaakte accounts ({0})", createdAccounts.Count);

            // Show the accounts that were unsuccessfully created
            dgvFailedAccounts.DataSource = failedAccounts;
            gbFailedAccounts.Text        = string.Format("Onsuccesvol aangemaakte accounts ({0})", failedAccounts.Count);

            // Re-enable the button
            btnCreateAccounts.Enabled = true;
            btnCreateAccounts.Text    = "START";
        }