protected virtual void Rbtn_CheckedChanged(object sender, EventArgs e) { System.Windows.Forms.RadioButton rbtn = sender as System.Windows.Forms.RadioButton; if (rbtn != null) { switch (rbtn.Tag.ToString()) { case "RBTN_ADD": { if (rbtn.Checked) { _accountOperation = ProCommon.Communal.AccountOperation.Add; } } break; case "RBTN_DELETE": { if (rbtn.Checked) { _accountOperation = ProCommon.Communal.AccountOperation.Delete; } } break; case "RBTN_MODIFY": default: { if (rbtn.Checked) { _accountOperation = ProCommon.Communal.AccountOperation.Modify; } } break; } UpdateControlStatus(_accountOperation); } }
private void UpdateControlStatus(ProCommon.Communal.AccountOperation uo) { switch (uo) { case ProCommon.Communal.AccountOperation.Add: { this.txteAccountNameA.ReadOnly = false; this.cmbeAccountAuthorityA.ReadOnly = false; this.txteAccountPassWordA.ReadOnly = false; } break; case ProCommon.Communal.AccountOperation.Delete: { this.txteAccountNameA.ReadOnly = true; this.cmbeAccountAuthorityA.ReadOnly = true; this.txteAccountPassWordA.ReadOnly = true; } break; case ProCommon.Communal.AccountOperation.Modify: { this.txteAccountNameA.ReadOnly = true; this.cmbeAccountAuthorityA.ReadOnly = (_currentAccount.Name == _selectedAccount.Name) ? false : true; this.txteAccountPassWordA.ReadOnly = (_currentAccount.Name == _selectedAccount.Name) ? false : true; } break; case ProCommon.Communal.AccountOperation.NONE: default: break; } this.txteAccountAuthority.ReadOnly = true; this.txteAccountNameG.ReadOnly = true; }