// 点击注册,向数据库添加记录 private void btnRegist_Click(object sender, EventArgs e) { if (ValidateInput()) { EditInfoRequestModel requestModel = new EditInfoRequestModel(); requestModel.age = Convert.ToInt32(txtAge.Text); requestModel.blood = cboBlood.Text; requestModel.conste = cboConste.Text; if (rdoMan.Checked) { requestModel.gender = "男"; } else { requestModel.gender = "女"; } requestModel.nickname = txtNickName.Text.Trim(); requestModel.userpass = txtUserPass.Text.Trim(); requestModel.faceimg = Convert.ToInt32(picFace.Tag); SystemHelper.EditInfo(requestModel, new Action <bool>(m => { if (!m) { MessageBox.Show("信息发送失败"); } else { this.Invoke(new Action(() => { this.Close(); })); } })); } }
public static void EditInfo(EditInfoRequestModel requestModel, Action <bool> action) { sendMess(MessType.EditInfo, requestModel, action); }