public EBMCertAuthInfo(OperateType type, bool isCert, EBMCertAuth.Cert cert) { InitializeComponent(); this.type = type; this.CertData = cert ?? new EBMCertAuth.Cert(); this.isCert = isCert; switch (type) { case OperateType.Add: Text = !isCert ? "添加应急广播授权列表数据" : "添加应急广播证书数据"; break; case OperateType.Info: Text = !isCert ? "查看应急广播授权列表数据" : "查看应急广播证书数据"; break; case OperateType.Update: Text = !isCert ? "更新应急广播授权列表数据" : "更新应急广播证书数据"; break; } cbBoxType.SelectedIndex = 0; if (type != OperateType.Add) { InitData(); } }
private void btnOK_Click(object sender, EventArgs e) { CertData.Tag = cbBoxType.SelectedIndex; if (CertData.Tag == 0) { if (string.IsNullOrWhiteSpace(textData.Text)) { CertData = null; return; } CertData.Cert_data = textData.Text.Trim(); } else if (CertData.Tag == 1) { if (string.IsNullOrWhiteSpace(richText.Text)) { CertData = null; return; } CertData.Cert_data = richText.Text.Trim(); } }