private bool setConnect() { bool isMaster = false; if (masterTextBox.Visible && !masterTextBox.Text.Equals(ipBox1.Value)) { isMaster = true; } hostName = masterTextBox.Visible ? masterTextBox.Text : ipBox1.Value; userName = usernameTextBox.Text; password = passwordTextBox.Text; try { ConnectManager.MasterHostName = ""; ConnectManager.Connect(hostName, userName, password, isMaster); ConnectManager.TargetHostName = ipBox1.Value; } catch (Exception) { if (!String.IsNullOrEmpty(ConnectManager.MasterHostName)) { return(false); } else { throw; } } return(true); }