public static int AnswerStop() { int ret = 3; if (isDati) { ret = AnswersCollection.HX_Stop(); if (ret >= 0) { isDati = false; } else { } } return(ret); }
public static void CardClose() { if (isDati) { int ret = AnswersCollection.HX_Stop(); if (ret >= 0) { isDati = false; } else { //ret = AnswersCollection.HX_Stop(); //如果失败,在尝试一下; //if (ret >= 0) //{ // isDati = false; //} //else //{ // //answer_card.Message(); //} } } }
public static void CardClose() { if (isDati) { int ret = AnswersCollection.HX_Stop(); if (ret >= 0) { isDati = false; } else { ret = AnswersCollection.HX_Stop(); //如果失败,在尝试一下; if (ret >= 0) { isDati = false; } else { answer_card.Message(); } } } }
public void CallbackFun(int iDevice, AnswersCollection.CALLBACK_MSG msg, int param1, string param2) { if (msg == AnswersCollection.CALLBACK_MSG.MSG_PULLEDOUT) { MessageBox.Show("设备拔出"); if (isDati) { AnswersCollection.HX_Stop(); } AnswersCollection.HX_CloseDevice(); } if (msg == AnswersCollection.CALLBACK_MSG.MSG_ANSWER_DATA) { for (int i = 0; i < param1; i++) { Console.WriteLine(param2); string[] s = param2.ToString().Split(new char[] { '"' }); //this.BeginInvoke((MethodInvoker)delegate //{ // textBox1.AppendText("StudentID:" + s[3] + " " + "CardID:" + s[7] + " " + "answer:" + s[11] + "\r\n"); //}); if (answer_card == null) { answer_card = new AnswerCard(); answer_card.Raise = false; } if (answer_card.Raise) { Console.WriteLine("有人举手"); if (Global.RaiseStu == "") { Global.RaiseStu = s[7]; } else { Global.RaiseStu += "|" + s[7]; } if (Global.setSeatBtn) { Httpd.setSeatfn(Global.RaiseStu); } else { Httpd.setHandon(Global.RaiseStu); //Console.WriteLine(Global.RaiseStu); } } else { if (Global.AnswerStu == "") { if (s[11].Replace(" ", "") == "√") { Global.judgeAnsewer = "R"; Global.AnswerStu = s[7] + ":" + Global.judgeAnsewer; } else if (s[11].Replace(" ", "") == "×") { Global.judgeAnsewer = "W"; Global.AnswerStu = s[7] + ":" + Global.judgeAnsewer; } else { Global.AnswerStu = s[7] + ":" + s[11].Replace(" ", ""); } } else { if (Global.AnswerStu.IndexOf(s[7]) >= 0) { //有的话去重 string[] stringArray = Global.AnswerStu.Split('|'); List <string> listString = new List <string>(stringArray); int count = listString.Count; for (int t = 0; t < count; t++) { if (listString[t].IndexOf(s[7]) >= 0) { listString.Remove(listString[t]); if (s[11].Replace(" ", "") == "√") { Global.judgeAnsewer = "R"; listString.Add(s[7] + ":" + Global.judgeAnsewer); } else if (s[11].Replace(" ", "") == "×") { Global.judgeAnsewer = "W"; listString.Add(s[7] + ":" + Global.judgeAnsewer); } else { listString.Add(s[7] + ":" + s[11].Replace(" ", "")); } } } //foreach (string eachString in listString) //{ // if (eachString.IndexOf(s[3]) >= 0) // { // listString.Remove(eachString); // listString.Add(s[3] + ":" + s[11].Replace(" ", "")); // } //} Global.AnswerStu = string.Join("|", listString); } else { //没有 if (s[11].Replace(" ", "") == "√") { Global.judgeAnsewer = "R"; Global.AnswerStu += "|" + s[7] + ":" + Global.judgeAnsewer; } else if (s[11].Replace(" ", "") == "×") { Global.judgeAnsewer = "W"; Global.AnswerStu += "|" + s[7] + ":" + Global.judgeAnsewer; } else { Global.AnswerStu += "|" + s[7] + ":" + s[11].Replace(" ", ""); } } } Httpd.setPracticeResult(Global.AnswerStu); } } } else if (msg == AnswersCollection.CALLBACK_MSG.MSG_DOUTE_DATA) { Console.WriteLine(param2); string[] s2 = param2.ToString().Split(new char[] { '"' }); //this.BeginInvoke((MethodInvoker)delegate //{ // textBox1.AppendText("StudentID:" + s2[3] + " " + "CardID:" + s2[7] + "\r\n"); //}); } if (msg == AnswersCollection.CALLBACK_MSG.MSG_ERROR) { Console.Write("ErrCode:{0:D} ", param1); Console.WriteLine("Description:" + param2); } }