/// <summary> /// Creates an instance of ConnectDialog and uses it to obtain the name of the VNC Host. /// </summary> /// <returns>Returns the VNC Host name entered by the user, or null if he/she clicked Cancel.</returns> public static string GetVncHost() { using(ConnectDialog dialog = new ConnectDialog()) { if (dialog.ShowDialog() == DialogResult.OK) { return dialog.Host; } else { // If the user clicks Cancel, return null and not the empty string. return null; } } }
/// <summary> /// Creates an instance of ConnectDialog and uses it to obtain the name of the VNC Host. /// </summary> /// <returns>Returns the VNC Host name entered by the user, or null if he/she clicked Cancel.</returns> public static string GetVncHost() { using (ConnectDialog dialog = new ConnectDialog()) { if (dialog.ShowDialog() == DialogResult.OK) { return(dialog.Host); } else { // If the user clicks Cancel, return null and not the empty string. return(null); } } }