コード例 #1
0
        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();
        }
コード例 #2
0
 /// <summary>
 /// Notifies the framebuffer update thread to check for recent changes.
 /// </summary>
 public void FramebufferChanged()
 {
     _requester.Signal();
 }
コード例 #3
0
ファイル: VncClient.cs プロジェクト: qmfrederik/remoteviewing
        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();
        }