public void CtkSend(CtkWcfMessage msg) { var ea = new CtkWcfDuplexEventArgs(); ea.WcfMsg = msg; ea.IsWcfNeedReturnMsg = false; this.OnReceiveMsg(ea); }
void OnReceiveMsg(CtkWcfDuplexEventArgs ea) { if (this.EhReceiveMsg == null) { return; } this.EhReceiveMsg(this, ea); }
void OnReceiveMsg(CtkWcfDuplexEventArgs tcpstate) { if (this.EhReceiveMsg == null) { return; } this.EhReceiveMsg(this, tcpstate); }
public CtkWcfMessage CtkSendReply(CtkWcfMessage msg) { var ea = new CtkWcfDuplexEventArgs(); ea.WcfMsg = msg; ea.IsWcfNeedReturnMsg = true; this.OnReceiveMsg(ea); return(ea.WcfReturnMsg); }
public int ConnectTryStart() { if (this.IsLocalReadyConnect) { return(0); } try { if (!Monitor.TryEnter(this, 1000)) { return(-1); //進不去先離開 } if (this.IsLocalReadyConnect) { return(0); } this.CleanDisconnected(); this.CleanHost(); this.NewHost(); this.host.Opened += (ss, ee) => { var ea = new CtkWcfDuplexEventArgs(); //ea.WcfChannel = this.GetCallback();//Listener(or call Host, Service) 開啟後, 並沒有Channel連線進來 this.OnFirstConnect(ea); }; this.SvrInst.EhReceiveMsg += (ss, ee) => { var ea = ee; ea.WcfChannel = this.GetCallback(); this.OnDataReceive(ea); }; this.host.Closed += (ss, ee) => { var ea = new CtkWcfDuplexEventArgs(); //ea.WcfChannel = this.GetCallback();//Listerner關閉, 會關閉所有Channel, 並沒有特定哪一個 this.OnDisconnect(ea); }; this.Open(); return(0); } finally { Monitor.Exit(this); } }