void _forum_LoginEvent(object sender, LoginEventArgs e) { switch (e.LoginEventType) { case LoginEventType.LoginSuccess: { this.Text += " : " + e.Username; if (chkRememberMe.Checked) { PogSettings.Write("TitanModName", e.Username); PogSettings.Write("TitanModPassword", txtPassword.Text); } else { PogSettings.Write("TitanModName", ""); PogSettings.Write("TitanModPassword", ""); } LoadGame(); } break; case LoginEventType.LoginFailure: { MessageBox.Show("Login Failure as " + e.Username); txtPassword.ReadOnly = false; txtUsername.ReadOnly = false; chkRememberMe.Enabled = true; btnLogin.Enabled = true; } break; } }
private void LoginDialog_Load(object sender, EventArgs e) { txtVersion.Text = String.Format("Fennic Fox Vote Counter Version " + Assembly.GetExecutingAssembly().GetName().Version.ToString()); _forum.LoginEvent += new EventHandler <LoginEventArgs>(_forum_LoginEvent); PogSettings.Write("username", String.Empty); PogSettings.Write("password", String.Empty); }
void _forum_LoginEvent(object sender, LoginEventArgs e) { switch (e.LoginEventType) { case Forum.LoginEventType.LoginFailure: { MessageBox.Show(this, "Login failed! Check the username and password."); btnLogin.Enabled = true; } break; case Forum.LoginEventType.LoginSuccess: { btnLogin.Enabled = false; txtUsername.ReadOnly = true; txtPassword.ReadOnly = true; txtPassword.PasswordChar = '*'; if (chkRememberMe.Checked) { PogSettings.Write("username", txtUsername.Text.Trim()); PogSettings.Write("password", txtPassword.Text.Trim()); } DialogResult = System.Windows.Forms.DialogResult.OK; } break; case Forum.LoginEventType.LogoutSuccess: { btnLogin.Enabled = true; txtUsername.Text = ""; txtPassword.Text = ""; txtUsername.ReadOnly = false; txtPassword.ReadOnly = false; txtPassword.PasswordChar = '\0'; } break; } }