private void OnTcpConnecting(object sender, TcpConnectingEventArgs e) { try { _productCache.AddTail(e); } catch (System.Exception) { } }
void IAleTunnelEventNotifier.NotifyTcpConnecting(TcpConnectingEventArgs args) { try { if (this.TcpConnecting != null) { this.TcpConnecting(null, args); } } catch (System.Exception) { } }
void IAleClientTunnelObserver.OnTcpConnecting(AleClientTunnel theConnection) { try { var args = new TcpConnectingEventArgs(theConnection.ID, this.RsspEP.LocalID, theConnection.LocalEndPoint, this.RsspEP.RemoteID, theConnection.RemoteEndPoint); this.TunnelEventNotifier.NotifyTcpConnecting(args); } catch (System.Exception ex) { LogUtility.Error(ex.ToString()); } }
private void ShowTcpConnectingEvent(TcpConnectingEventArgs args) { try { this.Invoke(new Action(() => { // 添加Device节点 TreeNode nodeRemoteDevice = null; if (args.RemoteID == this.SiblingID) { nodeRemoteDevice = this.AddSibling(this.SiblingID); } else { nodeRemoteDevice = this.AddServer(args.RemoteID); } // 添加Connection节点 var nodeKey = args.ConnectionID; var linkContent = String.Format("尝试连接中: LEP_{0} ---> REP_{1} 开始于 {2}", args.LocalEndPoint.Address, args.RemoteEndPoint, DateTime.Now.ToString("HH:mm:ss")); var nodesTemp = nodeRemoteDevice.Nodes.Find(nodeKey, false); TreeNode nodeConnection = null; if (nodesTemp.Length > 0) { nodeConnection = nodesTemp[0]; nodeConnection.Text = linkContent; } else { nodeConnection = nodeRemoteDevice.Nodes.Add(nodeKey, linkContent); } nodeConnection.ForeColor = Color.Gray; nodeConnection.ImageKey = "connecting"; nodeConnection.SelectedImageKey = "connecting"; // nodeRemoteDevice.ExpandAll(); })); } catch (System.Exception ex) { this.ShowLog(ex.Message); } }