protected virtual void OnHostFound(HostFoundEventArgs e) { if (HostFound != null) { HostFound.Invoke(this, e); } }
//收到连接字符串触发 private void HostFinderOnHostFound(object sender, HostFoundEventArgs args) { try { if (args.IsCasting) //如果同意了连接请求 { if (!_isConnected) //如果当前状态为非连接状态 { axRDPViewer1.SmartSizing = true; axRDPViewer1.Connect(args.ConnectionString, Environment.UserName, ""); } } else { if (_isConnected) { notifyIcon1.ShowBalloonTip(1000, "连接失败", args.Additionalinfo, ToolTipIcon.Info); axRDPViewer1.Disconnect(); } } } catch (Exception ex) { Debug.WriteLine("Exception:" + ex.Message); } }