private void Incoming(object Guest) { IRDPSRAPIAttendee MyGuest = (IRDPSRAPIAttendee)Guest; MyGuest.ControlLevel = CTRL_LEVEL.CTRL_LEVEL_MAX; RDPSRAPITcpConnectionInfo info = (RDPSRAPITcpConnectionInfo)MyGuest.ConnectivityInfo; AxEventHandler <RemoteServerIncomingConnectionEventArgs> handler = this.IncomingConnection; if (handler != null) { handler(new RemoteServerIncomingConnectionEventArgs(new SharpViewCore.RemoteConnectionInfo(info.LocalIP, info.PeerIP, info.LocalPort, info.PeerPort, info.Protocol))); } this.Guests.Add(new RemoteDesktopGuest(MyGuest.ConnectivityInfo, MyGuest.RemoteName, MyGuest.Id, MyGuest.Flags, MyGuest.Invitation) { ControlLevel = MyGuest.ControlLevel }); if (this.StartApplicationsOnConnect) { for (int i = 0; i < Applications.Count; i++) { Process.Start(this.Applications[i]); } } }
private void Disconnect(RDPSession session) { session.Close(); AxEventHandler <RemoteServerDisconnectEventArgs> handler = this.Disconnected; if (handler != null) { handler(new RemoteServerDisconnectEventArgs(session)); } }
private void Connect(RDPSession session) { session.OnAttendeeConnected += Incoming; session.Open(); AxEventHandler <RemoteServerConnectedEventArgs> handler = this.Connected; if (handler != null) { handler(new RemoteServerConnectedEventArgs(session)); } }
/// <summary> /// Initializes a new instance of the <see cref="T:SharpViewCore.RemoteServerSocket"/> class. /// </summary> public RemoteServerSocket() { this.socket = new Socket(SocketType.Stream, ProtocolType.Tcp); System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer(); timer.Tick += (sender, e) => { this.connected = socket.Connected; AxEventHandler <RemoteServerSocketConnectedValueChanged> handler = this.ConnectedValueChaned; if (handler != null) { handler(new RemoteServerSocketConnectedValueChanged(this.connected)); } }; timer.Enabled = true; }