void ThreadMain() { var requester = new Utility.PeriodicThread(); IsConnected = true; OnConnected(); try { requester.Start(() => { SendFramebufferUpdateRequest(true); return(true); }, () => MaxUpdateRate, true); while (true) { var command = _c.ReceiveByte(); switch (command) { case 0: requester.Signal(); HandleFramebufferUpdate(); break; case 1: HandleSetColorMapEntries(); break; case 2: HandleBell(); break; case 3: HandleReceiveClipboardData(); break; default: VncStream.Require(false, "Unsupported command.", VncFailureReason.UnrecognizedProtocolElement); break; } } } catch (ObjectDisposedException) { } catch (IOException) { } catch (VncException) { } requester.Stop(); _c.Stream = null; IsConnected = false; OnClosed(); }
private void ThreadMain() { var requester = new Utility.PeriodicThread(); this.IsConnected = true; this.OnConnected(); try { requester.Start( () => { this.SendFramebufferUpdateRequest(true); }, () => this.MaxUpdateRate, true); while (true) { this.HandleResponse(requester); } } catch (ObjectDisposedException) { } catch (IOException) { } catch (VncException) { } requester.Stop(); this.c.Stream = null; this.IsConnected = false; this.OnClosed(); }
void ThreadMain() { _requester = new Utility.PeriodicThread(); try { InitFramebufferEncoder(); AuthenticationMethod[] methods; NegotiateVersion(out methods); NegotiateSecurity(methods); NegotiateDesktop();//绘画的桌面 NegotiateEncodings(); _requester.Start(FramebufferSendChanges, () => MaxUpdateRate, false); IsConnected = true; OnConnected(); while (true) { var command = _c.ReceiveByte(); switch (command) { case 0: HandleSetPixelFormat(); break; case 2: HandleSetEncodings(); break; case 3: HandleFramebufferUpdateRequest(); break; case 4: HandleKeyEvent(); break; case 5: HandlePointerEvent(); break; case 6: HandleReceiveClipboardData(); break; default: VncStream.Require(false, "Unsupported command.", VncFailureReason.UnrecognizedProtocolElement); break; } } } catch (ObjectDisposedException ex) { } catch (IOException ex) { } catch (VncException ex) { //Vnc错误 } _requester.Stop(); _c.Stream = null; if (IsConnected) { IsConnected = false; OnClosed(); } else { OnConnectionFailed(); } }
private void ThreadMain() { var requester = new Utility.PeriodicThread(); this.IsConnected = true; this.OnConnected(); try { requester.Start( () => { this.SendFramebufferUpdateRequest(true); }, () => this.MaxUpdateRate, true); while (true) { var command = this.c.ReceiveByte(); switch (command) { case 0: requester.Signal(); this.HandleFramebufferUpdate(); break; case 1: this.HandleSetColorMapEntries(); break; case 2: this.HandleBell(); break; case 3: this.HandleReceiveClipboardData(); break; default: VncStream.Require( false, "Unsupported command.", VncFailureReason.UnrecognizedProtocolElement); break; } } } catch (ObjectDisposedException) { } catch (IOException) { } catch (VncException) { } requester.Stop(); this.c.Stream = null; this.IsConnected = false; this.OnClosed(); }