/// <summary> /// 客户端发送send请求会被触发,接收请求数据 /// </summary> protected override void OnMessage(MessageEventArgs e) { String result; try { string type = JsonHelper.DeserializeJsonToObject <MessageEvent <string> >(e.Data).data; result = ICCardUtils.Read(type); } catch (Exception ex) { result = "读卡出错【" + ex.Message + "】"; } Send(result); }
private void button3_Click(object sender, EventArgs e) { string res = ICCardUtils.Read(this.comboBox2.Text); res = res == null ? "" : res; if (res.IndexOf("读卡出错") >= 0) { this.lab_readCard.ForeColor = System.Drawing.Color.Red; } else { res = "读卡结果:" + res; } this.lab_readCard.Text = res; }