void frmLogin_Shown(object sender, EventArgs e) { //开始收听广播 UDPHelper.StartLogin_UDPServer(15000); UDPHelper.handler = this; this.Activate(); }
private void btnLogin_Click(object sender, EventArgs e) { //向教师端发送登陆请求 string id = this.textBox1.Text; if (id == null || id == string.Empty || id.Length <= 0) { MessageBox.Show("请填写您的学号!", "提示"); return; } else { if (GlobalPara.dest_IP != string.Empty && GlobalPara.dest_login_port != string.Empty) { GlobalPara.clientID = id; string strLoginInfo = string.Format("[id,{0},epc,]", id); UDPHelper.SendData(strLoginInfo, GlobalPara.dest_IP, int.Parse(GlobalPara.dest_login_port)); this.logining = true;//标明窗体处于登陆过程中,不要将登陆按钮重置 this.btnLogin.Enabled = false; this.textBox1.Enabled = false; this.lblStatus.Text = "登录中,请确认您已刷卡..."; } } }