private void logoutToolStripMenuItem_Click(object sender, EventArgs e) { var form2 = new PappyjoeMVC.View.Login(); form2.Closed += (sender1, args) => this.Close(); this.Hide(); form2.Show(); }
private void btnproceed_Click(object sender, EventArgs e) { if (txtip.Text != "" && txtservername.Text != "" && txtserverusername.Text != "") { string strPassword = ""; string strYesNo = "NO"; if (lbltestresult.Visible == false || lbltestresult.Text != "Success") { DialogResult dialogResult = MessageBox.Show("Test connection failed...Anyway to continue...?", "Continue...", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dialogResult == DialogResult.Yes) { strYesNo = "YES"; } else { strYesNo = "NO"; } } else { strYesNo = "YES"; } if (strYesNo == "YES") { strPassword = EncryptDecrypt(txtserverpassword.Text, 50); Microsoft.Win32.RegistryKey pappyjoeRegistryKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("pappyjoe"); pappyjoeRegistryKey.SetValue("Server", txtservername.Text); pappyjoeRegistryKey.SetValue("IP", txtip.Text); pappyjoeRegistryKey.SetValue("User", txtserverusername.Text); pappyjoeRegistryKey.SetValue("Password", strPassword.ToString()); pappyjoeRegistryKey.SetValue("Status", "1"); PappyjoeMVC.Model.Connection.MyGlobals.globalPath = txtservername.Text; pappyjoeRegistryKey.Close(); var form2 = new Login(); form2.Show(); form2.Closed += (sender1, args) => this.Close(); this.Hide(); } } else { MessageBox.Show("An error occurred trying to access the network computers", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }