private void AccountIDTextBox_TextChanged(object sender, EventArgs e) { if (ActiveControl != sender) { return; } if (_selectedAccountInfos.Count != 1) { return; } lock (Envir.AccountLock) { if (SMain.Envir.AccountExists(ActiveControl.Text)) { ActiveControl.BackColor = Color.Red; return; } AccountInfoListView.BeginUpdate(); ActiveControl.BackColor = SystemColors.Window; _selectedAccountInfos[0].AccountID = ActiveControl.Text; _selectedAccountInfos[0].Update(); AutoResize(); AccountInfoListView.EndUpdate(); } }
private void ExpiryDateTextBox_TextChanged(object sender, EventArgs e) { if (ActiveControl != sender) { return; } DateTime temp; if (!DateTime.TryParse(ActiveControl.Text, out temp)) { ActiveControl.BackColor = Color.Red; return; } ActiveControl.BackColor = SystemColors.Window; AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].ExpiryDate = temp; _selectedAccountInfos[i].Update(); } AutoResize(); AccountInfoListView.EndUpdate(); }
private void AdminCheckBox_CheckedChanged(object sender, EventArgs e) { if (ActiveControl != sender) { return; } AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].AdminAccount = AdminCheckBox.CheckState == CheckState.Checked ? true : false; _selectedAccountInfos[i].Update(); } AutoResize(); AccountInfoListView.EndUpdate(); }
private void BannedCheckBox_CheckedChanged(object sender, EventArgs e) { if (ActiveControl != sender) { return; } AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].Banned = false; _selectedAccountInfos[i].Update(); } AutoResize(); AccountInfoListView.EndUpdate(); }
private void PasswordChangeCheckBox_CheckedChanged(object sender, EventArgs e) { if (ActiveControl != sender) { return; } AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].RequirePasswordChange = PasswordChangeCheckBox.CheckState == CheckState.Checked; Update(AccountInfoListView.SelectedItems[i], _selectedAccountInfos[i]); } AutoResize(); AccountInfoListView.EndUpdate(); }
private void BanReasonTextBox_TextChanged(object sender, EventArgs e) { if (ActiveControl != sender) { return; } AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].BanReason = ActiveControl.Text; _selectedAccountInfos[i].Update(); } AutoResize(); AccountInfoListView.EndUpdate(); }
private void UserNameTextBox_TextChanged(object sender, EventArgs e) { if (ActiveControl != sender) { return; } AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].UserName = ActiveControl.Text; Update(AccountInfoListView.SelectedItems[i], _selectedAccountInfos[i]); } AutoResize(); AccountInfoListView.EndUpdate(); }
private void PermBanButton_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to ban the selected Accounts?", "Ban Selected.", MessageBoxButtons.YesNoCancel) != DialogResult.Yes) { return; } AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].ExpiryDate = DateTime.MaxValue; _selectedAccountInfos[i].Update(); } RefreshInterface(); AutoResize(); AccountInfoListView.EndUpdate(); }
private void button1_Click(object sender, EventArgs e) { ChangePasswordDialog PasswordDialog = new ChangePasswordDialog(); if (PasswordDialog.ShowDialog(this) == DialogResult.OK && PasswordDialog.PasswordTextBox.Text.Length > 0) { AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].Password = PasswordDialog.PasswordTextBox.Text; _selectedAccountInfos[i].RequirePasswordChange = true; PasswordChangeCheckBox.CheckState = CheckState.Checked; Update(AccountInfoListView.SelectedItems[i], _selectedAccountInfos[i]); MessageBox.Show("密码更改"); } AutoResize(); AccountInfoListView.EndUpdate(); } }
private void PermBanButton_Click(object sender, EventArgs e) { if (MessageBox.Show("是否确实要禁止所选帐户?", "确认菜单.", MessageBoxButtons.YesNoCancel) != DialogResult.Yes) { return; } AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].Banned = true; _selectedAccountInfos[i].ExpiryDate = DateTime.MaxValue; Update(AccountInfoListView.SelectedItems[i], _selectedAccountInfos[i]); } RefreshInterface(); AutoResize(); AccountInfoListView.EndUpdate(); }
private void WeekBanButton_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to ban the selected Accounts?", "Ban Selected.", MessageBoxButtons.YesNoCancel) != DialogResult.Yes) { return; } DateTime expiry = SMain.Envir.Now.AddDays(7); AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].Banned = true; _selectedAccountInfos[i].ExpiryDate = expiry; _selectedAccountInfos[i].Update(); } RefreshInterface(); AutoResize(); AccountInfoListView.EndUpdate(); }
private void BannedCheckBox_CheckedChanged(object sender, EventArgs e) { if (ActiveControl != sender) { return; } AccountInfoListView.BeginUpdate(); for (int i = 0; i < _selectedAccountInfos.Count; i++) { _selectedAccountInfos[i].Banned = BannedCheckBox.Checked;; _selectedAccountInfos[i].Update(); if (BannedCheckBox.Checked == true) { if (_selectedAccountInfos[i].Connection != null) { _selectedAccountInfos[i].Connection.Disconnect(0); } } } AutoResize(); AccountInfoListView.EndUpdate(); }