//------------------------------------------------------------------------- private void Recognize_FindedBarcodeControllEvent(object sender, BarcodeEventArgs e) { if (e.BarCode != null) { Invoke(new MethodInvoker(delegate { BarCodeItems.Add(e.BarCode); switch (e.BarCode.Name) { case "district_id": if (appSettings.Fields.DistrictId && !string.IsNullOrEmpty(lastDistrictId) && string.IsNullOrEmpty(e.BarCode.Value)) { e.BarCode.Value = lastDistrictId; e.BarCode.Verify = true; BarCodeListItemControl b = barCodeList.ControlList[e.BarCode.Name] as BarCodeListItemControl; b.comboBox1.ForeColor = Color.Red; } break; case "test_id": if (appSettings.Fields.TestId && !string.IsNullOrEmpty(lastTestId) && string.IsNullOrEmpty(e.BarCode.Value)) { e.BarCode.Value = lastTestId; testId = lastTestId; e.BarCode.Verify = true; BarCodeListItemControl b = barCodeList.ControlList[e.BarCode.Name] as BarCodeListItemControl; b.comboBox1.ForeColor = Color.Red; } break; case "amout_of_questions": if (appSettings.Fields.AmoutOfQuestions && !string.IsNullOrEmpty(lastAmoutOfQuestions) && string.IsNullOrEmpty(e.BarCode.Value)) { e.BarCode.Value = lastAmoutOfQuestions; e.BarCode.Verify = true; rec.AmoutOfQuestions = Convert.ToInt32(lastAmoutOfQuestions); BarCodeListItemControl b = barCodeList.ControlList[e.BarCode.Name] as BarCodeListItemControl; b.comboBox1.ForeColor = Color.Red; rec.allBarCodeValues[Array.IndexOf(rec.allBarCodeNames, "amout_of_questions")] = e.BarCode.Value; //BarCodeListItemControl b = barCodeList.ControlList["amout_of_questions"] as BarCodeListItemControl; //b.btnCheck.PerformClick(); //e.BarCode.Barcode = lastAmoutOfQuestions; //e.BarCode.BarcodeMem = lastAmoutOfQuestions; //e.BarCode.VerifyValue(); } break; case "question_number_1": case "index_of_first_question": if (appSettings.Fields.IndexOfFirstQuestion && !string.IsNullOrEmpty(lastIndexOfQuestion) && string.IsNullOrEmpty(e.BarCode.Value)) { e.BarCode.Value = lastIndexOfQuestion; e.BarCode.Verify = true; BarCodeListItemControl b = barCodeList.ControlList[e.BarCode.Name] as BarCodeListItemControl; b.comboBox1.ForeColor = Color.Red; } break; default: break; } if (e.BarCode.Name == "test_id") { testId = e.BarCode.Value; } else if (e.BarCode.Name == "district_id") { districtId = e.BarCode.Value; } else if (e.BarCode.Name == "amout_of_questions") { amoutOfQuestions = e.BarCode.Value; if (bac.CheckBoxArr.Length != 0) { if (e.BarCode.Verify) bac.AmoutOfQuestions = Convert.ToInt32(e.BarCode.Value); } } else if (e.BarCode.Name == "index_of_first_question" || e.BarCode.Name == "question_number_1") { indexOfQuestion = e.BarCode.Value; } //BarCodeItems.Add(e.BarCode); barCodeList.Refresh(); if (!e.BarCode.Verify) { lblErr.Text = "Error in " + e.BarCode.Name; lblErr.Visible = true; if (!errList.Contains(lblErr.Text)) errList.Add(lblErr.Text); } })); } }
public void NotifyUpdated(EventHandler<BarcodeEventArgs> key, object obj, BarcodeEventArgs e) { var handler = key; if (handler != null) handler(obj, e); }