public static OperateResult EndDoCommunication() { try { currentCommState = CommState.Idel; if (MainForm.CommMaster is Master) { return(DoCommunicationFunc.EndInvoke(iar)); } else { return(DoCommunicationTcpFunc.EndInvoke(iar)); } } catch (Exception ex) { return(OperateResult.Create(false, ex.Message, new byte[] { }, new byte[] { })); } }
public static bool BeginDoCommunication(ModlesMsg modlesMsg) { if (currentCommState != CommState.Idel) { return(false); } iar = null; currentCommState = modlesMsg.Function; if (MainForm.CommMaster != null) { if (MainForm.CommMaster is Master) { iar = DoCommunicationFunc.BeginInvoke((MainForm.CommMaster as Master), modlesMsg, null, null); } else { iar = DoCommunicationTcpFunc.BeginInvoke((MainForm.CommMaster as TcpMaster), modlesMsg, null, null); } } return(true); }