private void OnOk_Click(object sender, EventArgs e) { string email = this.emailTextBox.Text; string kiteName = this.kiteTextBox.Text; string password = this.passwordTextBox.Text; if (!this.ValidateEmail(email)) { PkLogging.Logger(PkLogging.Level.Warning, "Invalid email address", true); return; } if (string.IsNullOrEmpty(kiteName)) { PkLogging.Logger(PkLogging.Level.Warning, "Invalid kite name", true); return; } if (string.IsNullOrEmpty(password)) { if (this.agreeCheckBox.Checked) { if (PkService.CreateAccount(email, kiteName)) { PkLogging.Logger(PkLogging.Level.Info, "An email containing your password and details has been sent to " + email, true); return; } else { return; } } else { PkLogging.Logger(PkLogging.Level.Warning, "You must agree to the terms of service to continue.", true); } } else { PkServiceInfo info = PkService.Login(email, password, false); if (info != null) { PkLogging.Logger(PkLogging.Level.Info, "Successfully signed in."); password = ""; this.passwordTextBox.Text = ""; this.RememberMe = this.rememberCheckBox.Checked; this.ServiceInfo = info; PkLoginForm parent = (this.Parent as PkLoginForm); parent.Close_Login(); } else { return; } } }
private void OnNotNow_Click(object sender, EventArgs e) { this.Hide(); this.UsePagekiteNet = false; PkLoginForm parent = (this.Parent as PkLoginForm); parent.ShowLogin(); }
private void ShowLoginForm() { using (PkLoginForm login = new PkLoginForm()) { var result = login.ShowDialog(); if (result == DialogResult.OK) { this.data.Options.RememberMe = login.RememberMe; this.data.Options.UsePageKiteNet = login.UsePagekiteNet; this.data.ServiceInfo = login.ServiceInfo; } else { Application.Exit(); } } }