public frmMain() { Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); InitializeComponent(); MainPanel = panMain; RegistryPersistence.LoadUserFromRegistry(ref User, ref Password, ref Server); var f = new frmLogin(); f.User = User; f.Password = Password; f.Server = Server; while (true) { if (f.ShowDialog() == DialogResult.Cancel) { UI.ShowMessage(this, "No ha sido posible iniciar una sesión en el servidor. \n\nServidor: " + HttpInvoker.GetServer("No indicado")); Process.GetCurrentProcess().Kill(); return; } else { this.User = f.User; this.Password = f.Password; HttpInvoker.Server = f.Server; } if (Login()) { break; } } }
private void cmdOK_Click(object sender, EventArgs e) { if (txtServer.Text == "") { MessageBox.Show(this, "Atención", "Debe indicar un servidor."); return; } if (txtUsername.Text == "" || txtPassword.Text == "") { MessageBox.Show(this, "Atención", "Debe indicar un usuario y contraseña."); return; } RegistryPersistence.SaveUserToRegistry(User, (chStorePassword.Checked ? Password : ""), Server); this.DialogResult = DialogResult.OK; this.Close(); }