示例#1
0
        /// <summary>
        /// After protocol-level initialization and connecting is complete, the local GUI objects have to be set-up,
        /// and requests for updates to the remote host begun.
        /// </summary>
        /// <exception cref="System.InvalidOperationException">Thrown if the RemoteDesktop control is already in the
        /// Connected state.  See <see cref="IsConnected" />.</exception>
        private void Initialize()
        {
            // Finish protocol handshake with host now that authentication is done.
            InsureConnection(false);
            vnc.Initialize(bitsPerPixel, depth);
            SetState(RuntimeState.Connected);

            // Create a buffer on which updated rectangles will be drawn and draw a "please wait..."
            // message on the buffer for initial display until we start getting rectangles
            SetupDesktop();

            // Tell the user of this control the necessary info about the desktop in order to setup the display
            OnConnectComplete(new ConnectEventArgs(vnc.Framebuffer.Width,
                                                   vnc.Framebuffer.Height,
                                                   vnc.Framebuffer.DesktopName));


            // Start getting updates from the remote host (vnc.StartUpdates will begin a worker thread).
            vnc.VncUpdate += VncUpdate;
            vnc.StartUpdates();
        }