/// <summary> /// Callback that's invoked whenever the client (<see cref="_vncConnection"/>) receives screen data from the server. We use this method to determine /// when we are *really* connected: we have successfully established a network connection to the server *and* we have started receiving screen data. /// It's only at that point that we actually display the VNC UI. /// </summary> /// <param name="sender">Object from which this event originated, in this case, <see cref="_vncConnection"/>.</param> /// <param name="e">Arguments associated with this event.</param> void _vncConnection_VncUpdated(object sender, VncEventArgs e) { if (!IsConnected) { OnConnected(sender, e); } }
// This event handler deals with Framebuffer Updates coming from the host. An // EncodedRectangle object is passed via the VncEventArgs (actually an IDesktopUpdater // object so that *only* Draw() can be called here--Decode() is done elsewhere). // The VncClient object handles thread marshalling onto the UI thread. private void VncUpdate(object sender, VncEventArgs e) { e.DesktopUpdater.Draw(desktop); if (state != RuntimeState.Connected) { return; } // Make sure the next screen update is incremental vnc.FullScreenRefresh = false; }
// This event handler deals with Frambebuffer Updates coming from the host. An // EncodedRectangle object is passed via the VncEventArgs (actually an IDesktopUpdater // object so that *only* Draw() can be called here--Decode() is done elsewhere). // The VncClient object handles thread marshalling onto the UI thread. protected void VncUpdate(object sender, VncEventArgs e) { if (VncUpdated != null) { VncUpdated(sender, e); } e.DesktopUpdater.Draw(desktop); Invalidate(desktopPolicy.AdjustUpdateRectangle(e.DesktopUpdater.UpdateRectangle)); if (state == RuntimeState.Connected) { vnc.RequestScreenUpdate(fullScreenRefresh); // Make sure the next screen update is incremental fullScreenRefresh = false; } }