/// <summary> /// 断开PLC连接 /// </summary> public void ClosePLC() { int iReturnCode; //Return code //Displayed output data is cleared. // //Processing of Close method // try { //When ActProgType is selected by the radio button, //The Close method is executed. iReturnCode = lpcom_ReferencesUtlType.Close(); //When The Close method is succeeded, enable the TextBox of 'LogocalStationNumber'. if (iReturnCode == 0) { isPLCConnected = false; } lpcom_ReferencesUtlType = null; //The return code of the method is displayed by the hexadecimal. } //Exception processing catch (Exception exception) { MessageBox.Show(exception.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
public void PLCClose() { int iReturnCode; //Return code // //Processing of Close method // try { //Form_menu.StatusPLCLog("Close PLC Connection"); StatusPLCLog = "Close PLC Connection"; //The Close method is executed. iReturnCode = plc.Close(); } //Exception processing catch (Exception exception) { Debug.WriteLine(exception.Message); return; } Connected = false; //ButtonSendingStatus(false); //The return code of the method is displayed by the hexadecimal. //txt_ReturnCode.Text = String.Format("0x{0:x8} [HEX]", iReturnCode); }