public AbstractActivatedState(Connection connection, ConnectionParameter param, TcpClient tcpControlConnection) { innerState = InnerState.ACTIVE; this.connection = connection; this.param = param; this.tcpControlConnection = tcpControlConnection; this.stream = tcpControlConnection.GetStream(); this.mouse = new MouseExecutor(connection.HeightClientMonitor, connection.WidthClientMonitor); this.keyboard = new KeyboardExecutor(); this.clipboard = null; controlConnectionListener = new BackgroundWorker(); controlConnectionListener.WorkerSupportsCancellation = true; controlConnectionListener.WorkerReportsProgress = true; controlConnectionListener.DoWork += controlConnectionListener_DoWork; controlConnectionListener.RunWorkerCompleted += controlConnectionListener_RunWorkerCompleted; controlConnectionListener.ProgressChanged += controlConnectionListener_ProgressChanged; controlConnectionListener.RunWorkerAsync(); clipboardWorker = new BackgroundWorker(); clipboardWorker.WorkerSupportsCancellation = true; clipboardWorker.WorkerReportsProgress = true; clipboardWorker.DoWork += clipboardWorker_DoWork; clipboardWorker.RunWorkerCompleted += clipboardWorker_RunWorkerCompleted; clipboardWorker.ProgressChanged += clipboardWorker_ProgressChanged; ListeningForMouse(); }
private void ListeningForClipboard(bool remoteCopy) { if (!clipboardWorker.IsBusy) { clipboard = new MyClibpoard(); if (remoteCopy) { clipboard.AcquireClipboardContent(); } clipboardWorker.RunWorkerAsync(remoteCopy); } }