private void RobotForm_Load(object sender, EventArgs e) { // asc.controllInitializeSize(this); // MultiLanguage.lang = MultiLanguage.ReadDefaultLanguage(); // MultiLanguage.getNames(this); // // IList list = MultiLanguage.GetLanguageList(MultiLanguage.lang); // asc.controllInitializeSize(this); // if (Localization.HasLang) // { // Localization.RefreshLanguage(this); // changeDGV(); // } robotPtr = Handle; switchRobot.Items.Clear(); foreach (ROBOT eachRobot in MainForm.robotlist) { string str = "Robot:"; str += eachRobot.EQUIP_CODE; switchRobot.Items.Add(str); } if (switchRobot.Items.Count > 0 && PLCDataShare.m_plclist.Count > 0) { plc = PLCDataShare.m_plclist[0]; switchRobot.SelectedIndex = 0; robot = MainForm.robotlist[switchRobot.SelectedIndex]; timer1.Enabled = true; } }
private void comboBoxRFIDPLCSele_TextChanged(object sender, EventArgs e) { plc = PLCDataShare.m_plclist[comboBoxRFIDPLCSele.SelectedIndex]; plcserial = plc.serial; String[] comboBoxRFIDSeletStr12 = new String[comboBoxRFIDSeletStr[comboBoxRFIDPLCSele.SelectedIndex].Length]; for (int ii = 0; ii < comboBoxRFIDSeletStr[comboBoxRFIDPLCSele.SelectedIndex].Length; ii++) { comboBoxRFIDSeletStr12[ii] = comboBoxRFIDSeletStr[comboBoxRFIDPLCSele.SelectedIndex][ii][(int)m_xmlDociment.Attributes_RFID.serial] + ":" + comboBoxRFIDSeletStr[comboBoxRFIDPLCSele.SelectedIndex][ii][(int)m_xmlDociment.Attributes_RFID.id]; } comboBoxRFIDSelet.DataSource = comboBoxRFIDSeletStr12; }
private void MITSUBISHIPlcRFIDAutoUpDataHandler(object sender, PLC.MITSUBISHIPLCRFIDEvent Args) { if (Args.plcserial == -1) { PLC.PLC_MITSUBISHI_HNC8 m_PLC = (PLC.PLC_MITSUBISHI_HNC8)sender; RFIDconneted = m_PLC.conneted; } else { if (plcserial == Args.plcserial) { if (Args.RFIDserial == RFIDserial) { DataSource = plc.m_RFIDList[Args.RFIDserial].RFIDReadDataDataTable; timer_UpData_OK = true; // DataTable DataSource = plc.m_RFIDList[Args.RFIDserial].RFIDReadDataDataTable; // if (dataGridViewRFIDReadMessage.InvokeRequired)//等待异步 // { // // 当一个控件的InvokeRequired属性值为真时,说明有一个创建它以外的线程想访问它 // Action<DataTable> actionDelegate = (x) => // { // lock (plc.m_RFIDList[Args.RFIDserial].RFIDReadDataDataTable_Look) // { // dataGridViewRFIDReadMessage.DataSource = null; // dataGridViewRFIDReadMessage.DataSource = x; // } // }; // dataGridViewRFIDReadMessage.Invoke(actionDelegate, DataSource); // } // else // { // lock (plc.m_RFIDList[Args.RFIDserial].RFIDReadDataDataTable_Look) // { // dataGridViewRFIDReadMessage.DataSource = null; // dataGridViewRFIDReadMessage.DataSource = DataSource; // } // } } } } }