public RdpConnection(ServerConnection context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } _context = context; _connectedEvent = new ManualResetEvent(false); _thread = new Thread(ConnectCore); // The RDP ActiveX control requires STA. _thread.SetApartmentState(ApartmentState.STA); _thread.Start(); if (!_connectedEvent.WaitOne(TimeSpan.FromSeconds(30))) { throw new TimeoutException("Could not connect to server " + _context.Server); } // Unfortunately, there doesn't seem to be any way to pull the session ID from the client, // so we have to pull it from the server. _sessionId = context.TestService.GetLatestSessionId(); // TODO: Sometimes the system takes a while to log on... Thread.Sleep(5000); }
public ServerContext(ServerConfiguration config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } _source = new ServerConnection(config.Source); _target = config.Local ? _source : new ServerConnection(config.Target); }
public ServerContext(ServerConfiguration config) { _source = new ServerConnection(config.Source); _target = config.Local ? _source : new ServerConnection(config.Target); }