/// <summary> /// Raises the <see cref="CreatingDesktop"/> event. /// </summary> /// <param name="e"> /// The event arguments. /// </param> protected virtual void OnCreatingDesktop(CreatingDesktopEventArgs e) { var ev = this.CreatingDesktop; if (ev != null) { ev(this, e); } }
private void NegotiateDesktop() { Logger.Info("Negotiating desktop settings"); byte shareDesktopSetting = this.c.ReceiveByte(); bool shareDesktop = shareDesktopSetting != 0; var e = new CreatingDesktopEventArgs(shareDesktop); this.OnCreatingDesktop(e); var fbSource = this.fbSource; this.Framebuffer = fbSource != null ? fbSource.Capture() : null; VncStream.Require( this.Framebuffer != null, "No framebuffer. Make sure you've called SetFramebufferSource. It can be set to a VncFramebuffer.", VncFailureReason.SanityCheckFailed); this.clientPixelFormat = this.Framebuffer.PixelFormat; this.clientWidth = this.Framebuffer.Width; this.clientHeight = this.Framebuffer.Height; this.fbuAutoCache = null; this.c.SendUInt16BE((ushort)this.Framebuffer.Width); this.c.SendUInt16BE((ushort)this.Framebuffer.Height); var pixelFormat = new byte[VncPixelFormat.Size]; this.Framebuffer.PixelFormat.Encode(pixelFormat, 0); this.c.Send(pixelFormat); this.c.SendString(this.Framebuffer.Name, true); Logger.Info($"The desktop {this.Framebuffer.Name} has initialized with pixel format {this.clientPixelFormat}; the screen size is {this.clientWidth}x{this.clientHeight}"); }
/// <summary> /// Raises the <see cref="CreatingDesktop"/> event. /// </summary> /// <param name="e"> /// The event arguments. /// </param> protected virtual void OnCreatingDesktop(CreatingDesktopEventArgs e) { var ev = this.CreatingDesktop; if (ev != null) { ev(this, e); } }
protected virtual void OnCreatingDesktop(CreatingDesktopEventArgs e) { RaiseCreatingDesktop(e); }
/// <summary> /// Raises the <see cref="CreatingDesktop"/> event. /// </summary> /// <param name="e"> /// The event arguments. /// </param> protected virtual void OnCreatingDesktop(CreatingDesktopEventArgs e) { this.CreatingDesktop?.Invoke(this, e); }