C# Class VncSharpWpf.RemoteDesktopWpf

The RemoteDesktop control takes care of all the necessary RFB Protocol and GUI handling, including mouse and keyboard support, as well as requesting and processing screen updates from the remote VNC host. Most users will choose to use the RemoteDesktop control alone and not use any of the other protocol classes directly.
Inheritance: System.Windows.Controls.UserControl
Afficher le fichier Open project: nakano531/VncSharpWpf Class Usage Examples

Méthodes publiques

Свойство Type Description
GetPassword AuthenticateDelegate

Private Properties

Свойство Type Description
ConvertKeyToAscii char
GetKeyboardLayout System.IntPtr
GetKeyboardState bool
InitializeComponent void
InsureConnection void
KeyDownEventHandler void
KeyUpEventHandler void
ManageKeyDownAndKeyUp void
MapVirtualKeyEx uint
MouseDownUpMoveEventHandler void
MouseWHeelEventHandler void
PressKeys void
SetState void
SizeChangedEventHandler void
System void
ToUnicodeEx int
UpdateRemotePointer void

Méthodes publiques

Méthode Description
Authenticate ( string password ) : void

Authenticate with the VNC Host using a user supplied password.

Connect ( string host ) : void

Connect to a VNC Host and determine whether or not the server requires a password.

Connect ( string host, bool viewOnly ) : void

Connect to a VNC Host and determine whether or not the server requires a password.

Connect ( string host, bool viewOnly, bool scaled ) : void

Connect to a VNC Host and determine whether or not the server requires a password.

Connect ( string host, int display ) : void

Connect to a VNC Host and determine whether or not the server requires a password.

Connect ( string host, int display, bool viewOnly ) : void

Connect to a VNC Host and determine whether or not the server requires a password.

Connect ( string host, int display, bool viewOnly, bool scaled ) : void

Connect to a VNC Host and determine whether or not the server requires a password.

ConnectedFromServerEventHandler ( object sender, bool authentication ) : void

Event Handler for Event "ConnectedFromServer"

Disconnect ( ) : void

Stops the remote host from sending further updates and disconnects.

FillServerClipboard ( ) : void

Fills the remote server's clipboard with the text in the client's clipboard, if any.

FillServerClipboard ( string text ) : void

Fills the remote server's clipboard with text.

FullScreenUpdate ( ) : void

Get a complete update of the entire screen from the remote host.

You should allow users to call FullScreenUpdate in order to correct corruption of the local image. This will simply request that the next update be for the full screen, and not a portion of it. It will not do the update while blocking.

Listen ( string host, int port = 5500, bool viewOnly = false, bool scaled = false ) : void

Wait for a connection from VNC Server.

RemoteDesktopWpf ( ) : System
SendSpecialKeys ( SpecialKeys keys ) : void

Sends a keyboard combination that would otherwise be reserved for the client PC.

Keyboard combinations are Pressed and then Released, while single keys (e.g., SpecialKeys.Ctrl) are only pressed so that subsequent keys will be modified.

SendSpecialKeys ( SpecialKeys keys, bool release ) : void

Sends a keyboard combination that would otherwise be reserved for the client PC.

Keyboard combinations are Pressed and then Released, while single keys (e.g., SpecialKeys.Ctrl) are only pressed so that subsequent keys will be modified.

SetInputMode ( bool viewOnly ) : void

Changes the input mode to view-only or interactive.

SetScalingMode ( bool scaled ) : void

Set the remote desktop's scaling mode.

StopListen ( ) : void

Stop Listening.

Méthodes protégées

Méthode Description
Initialize ( ) : void

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.

OnClipboardChanged ( ) : void
OnConnectComplete ( ConnectEventArgs e ) : void

Dispatches the ConnectComplete event if any targets have registered.

OnConnectionLost ( ) : void

Dispatches the ConnectionLost event if any targets have registered.

OnStoppedListen ( ) : void
SetupDesktop ( ) : void

Creates and initially sets-up the local bitmap that will represent the remote desktop image.

VncClientConnectionLost ( object sender, EventArgs e ) : void

RemoteDesktop listens for ConnectionLost events from the VncClient object.

VncServerCutText ( object sender, EventArgs e ) : void
VncUpdate ( object sender, VncEventArgs e ) : void

Private Methods

Méthode Description
ConvertKeyToAscii ( Key key ) : char

Convert Key to Ascii Character.

GetKeyboardLayout ( uint idThread ) : IntPtr
GetKeyboardState ( byte lpKeyState ) : bool
InitializeComponent ( ) : void
InsureConnection ( bool connected ) : void

Insures the state of the connection to the server, either Connected or Not Connected depending on the value of the connected argument.

KeyDownEventHandler ( object sender, System.Windows.Input.KeyEventArgs e ) : void
KeyUpEventHandler ( object sender, System.Windows.Input.KeyEventArgs e ) : void
ManageKeyDownAndKeyUp ( System.Windows.Input.KeyEventArgs e, bool isDown ) : void
MapVirtualKeyEx ( uint uCode, uint uMapType, IntPtr dwhkl ) : uint
MouseDownUpMoveEventHandler ( object sender, MouseEventArgs e ) : void
MouseWHeelEventHandler ( object sender, System.Windows.Input.MouseWheelEventArgs e ) : void
PressKeys ( uint keys, bool release ) : void

Given a list of keysym values, sends a key press for each, then a release.

SetState ( RuntimeState newState ) : void
SizeChangedEventHandler ( object sender, RoutedEventArgs e ) : void

EventHandler for Image Size Change

System ( int connectionId, object target ) : void
ToUnicodeEx ( uint wVirtKey, uint wScanCode, byte lpKeyState, [ pwszBuff, int cchBuff, uint wFlags, IntPtr dwhkl ) : int
UpdateRemotePointer ( ) : void

Method Details

Authenticate() public méthode

Authenticate with the VNC Host using a user supplied password.
Thrown if the RemoteDesktop control is already Connected. See . Thrown if the password is null.
public Authenticate ( string password ) : void
password string The user's password.
Résultat void

Connect() public méthode

Connect to a VNC Host and determine whether or not the server requires a password.
Thrown if host is null. Thrown if display is negative. Thrown if the RemoteDesktop control is already Connected. See .
public Connect ( string host ) : void
host string The IP Address or Host Name of the VNC Host.
Résultat void

Connect() public méthode

Connect to a VNC Host and determine whether or not the server requires a password.
Thrown if host is null. Thrown if display is negative. Thrown if the RemoteDesktop control is already Connected. See .
public Connect ( string host, bool viewOnly ) : void
host string The IP Address or Host Name of the VNC Host.
viewOnly bool Determines whether mouse and keyboard events will be sent to the host.
Résultat void

Connect() public méthode

Connect to a VNC Host and determine whether or not the server requires a password.
Thrown if host is null. Thrown if display is negative. Thrown if the RemoteDesktop control is already Connected. See .
public Connect ( string host, bool viewOnly, bool scaled ) : void
host string The IP Address or Host Name of the VNC Host.
viewOnly bool Determines whether mouse and keyboard events will be sent to the host.
scaled bool Determines whether to use desktop scaling or leave it normal and clip.
Résultat void

Connect() public méthode

Connect to a VNC Host and determine whether or not the server requires a password.
Thrown if host is null. Thrown if display is negative. Thrown if the RemoteDesktop control is already Connected. See .
public Connect ( string host, int display ) : void
host string The IP Address or Host Name of the VNC Host.
display int The Display number (used on Unix hosts).
Résultat void

Connect() public méthode

Connect to a VNC Host and determine whether or not the server requires a password.
Thrown if host is null. Thrown if display is negative. Thrown if the RemoteDesktop control is already Connected. See .
public Connect ( string host, int display, bool viewOnly ) : void
host string The IP Address or Host Name of the VNC Host.
display int The Display number (used on Unix hosts).
viewOnly bool Determines whether mouse and keyboard events will be sent to the host.
Résultat void

Connect() public méthode

Connect to a VNC Host and determine whether or not the server requires a password.
Thrown if host is null. Thrown if display is negative. Thrown if the RemoteDesktop control is already Connected. See .
public Connect ( string host, int display, bool viewOnly, bool scaled ) : void
host string The IP Address or Host Name of the VNC Host.
display int The Display number (used on Unix hosts).
viewOnly bool Determines whether mouse and keyboard events will be sent to the host.
scaled bool Determines whether to use desktop scaling or leave it normal and clip.
Résultat void

ConnectedFromServerEventHandler() public méthode

Event Handler for Event "ConnectedFromServer"
public ConnectedFromServerEventHandler ( object sender, bool authentication ) : void
sender object
authentication bool
Résultat void

Disconnect() public méthode

Stops the remote host from sending further updates and disconnects.
Thrown if the RemoteDesktop control is not already in the Connected state. See .
public Disconnect ( ) : void
Résultat void

FillServerClipboard() public méthode

Fills the remote server's clipboard with the text in the client's clipboard, if any.
public FillServerClipboard ( ) : void
Résultat void

FillServerClipboard() public méthode

Fills the remote server's clipboard with text.
public FillServerClipboard ( string text ) : void
text string The text to put in the server's clipboard.
Résultat void

FullScreenUpdate() public méthode

Get a complete update of the entire screen from the remote host.
You should allow users to call FullScreenUpdate in order to correct corruption of the local image. This will simply request that the next update be for the full screen, and not a portion of it. It will not do the update while blocking.
Thrown if the RemoteDesktop control is not in the Connected state. See .
public FullScreenUpdate ( ) : void
Résultat void

Initialize() protected méthode

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.
Thrown if the RemoteDesktop control is already in the Connected state. See .
protected Initialize ( ) : void
Résultat void

Listen() public méthode

Wait for a connection from VNC Server.
public Listen ( string host, int port = 5500, bool viewOnly = false, bool scaled = false ) : void
host string Hostname or IP Address
port int Listening Port
viewOnly bool Set true if you use viewonly mode
scaled bool Set true if you use scaled mode
Résultat void

OnClipboardChanged() protected méthode

protected OnClipboardChanged ( ) : void
Résultat void

OnConnectComplete() protected méthode

Dispatches the ConnectComplete event if any targets have registered.
Thrown if the RemoteDesktop control is not in the Connected state.
protected OnConnectComplete ( ConnectEventArgs e ) : void
e ConnectEventArgs A ConnectEventArgs object with information about the remote framebuffer's geometry.
Résultat void

OnConnectionLost() protected méthode

Dispatches the ConnectionLost event if any targets have registered.
Thrown if the RemoteDesktop control is in the Connected state.
protected OnConnectionLost ( ) : void
Résultat void

OnStoppedListen() protected méthode

protected OnStoppedListen ( ) : void
Résultat void

RemoteDesktopWpf() public méthode

public RemoteDesktopWpf ( ) : System
Résultat System

SendSpecialKeys() public méthode

Sends a keyboard combination that would otherwise be reserved for the client PC.
Keyboard combinations are Pressed and then Released, while single keys (e.g., SpecialKeys.Ctrl) are only pressed so that subsequent keys will be modified.
Thrown if the RemoteDesktop control is not in the Connected state.
public SendSpecialKeys ( SpecialKeys keys ) : void
keys SpecialKeys SpecialKeys is an enumerated list of supported keyboard combinations.
Résultat void

SendSpecialKeys() public méthode

Sends a keyboard combination that would otherwise be reserved for the client PC.
Keyboard combinations are Pressed and then Released, while single keys (e.g., SpecialKeys.Ctrl) are only pressed so that subsequent keys will be modified.
Thrown if the RemoteDesktop control is not in the Connected state.
public SendSpecialKeys ( SpecialKeys keys, bool release ) : void
keys SpecialKeys SpecialKeys is an enumerated list of supported keyboard combinations.
release bool
Résultat void

SetInputMode() public méthode

Changes the input mode to view-only or interactive.
public SetInputMode ( bool viewOnly ) : void
viewOnly bool True if view-only mode is desired (no mouse/keyboard events will be sent).
Résultat void

SetScalingMode() public méthode

Set the remote desktop's scaling mode.
public SetScalingMode ( bool scaled ) : void
scaled bool Determines whether to use desktop scaling or leave it normal and clip.
Résultat void

SetupDesktop() protected méthode

Creates and initially sets-up the local bitmap that will represent the remote desktop image.
Thrown if the RemoteDesktop control is not already in the Connected state. See .
protected SetupDesktop ( ) : void
Résultat void

StopListen() public méthode

Stop Listening.
public StopListen ( ) : void
Résultat void

VncClientConnectionLost() protected méthode

RemoteDesktop listens for ConnectionLost events from the VncClient object.
protected VncClientConnectionLost ( object sender, EventArgs e ) : void
sender object The VncClient object that raised the event.
e System.EventArgs An empty EventArgs object.
Résultat void

VncServerCutText() protected méthode

protected VncServerCutText ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Résultat void

VncUpdate() protected méthode

protected VncUpdate ( object sender, VncEventArgs e ) : void
sender object
e VncEventArgs
Résultat void

Property Details

GetPassword public_oe property

Points to a Function capable of obtaining a user's password. By default this means using the PasswordDialog.GetPassword() function; however, users of RemoteDesktop can replace this with any function they like, so long as it matches the delegate type.
public AuthenticateDelegate GetPassword
Résultat AuthenticateDelegate