void Vision_Cam1ResultAvailable(object sender, VisionResultAvailableEventArgs e) { string[] NGKeys = e.DataResult["NGKeys"].Split(','); CogGraphicLabel rsg = new CogGraphicLabel(); rsg.SelectedSpaceName = "*"; rsg.Alignment = CogGraphicLabelAlignmentConstants.TopLeft; rsg.SetXYText(10, 10, e.DataResult["ResultString"]); rsg.Color = e.DataResult["Result"] == "1" ? CogColorConstants.Green : CogColorConstants.Red; this.Invoke(new Action(() => { cogRecordDisplay1.StaticGraphics.Clear(); cogRecordDisplay1.Record = e.LastRunRecord.SubRecords[0]; cogRecordDisplay1.StaticGraphics.Add(rsg, "rs"); string key = ""; string value = ""; foreach (int item in cam1Rows) { key = dataGridView1.Rows[item].Cells[1].Value.ToString(); e.DataResult.TryGetValue(key, out value); dataGridView1.Rows[item].Cells[2].Value = value; dataGridView1.Rows[item].Cells[2].Style.BackColor = NGKeys.Contains(key) ? Color.Red : Color.White; } })); }
void Vision_Cam2ResultAvailable(object sender, VisionResultAvailableEventArgs e) { }