// Pings maindisplayform to call public .getdata() to try and return // values from this current form private void pctBoxSearch_Click(object sender, EventArgs e) { //return search_data; MainDisplayFrame ping = new MainDisplayFrame(); ping.Advance_Search_Ping(); }
// Method that checks username/password and init maindisplayform // Do not modify // -Hieu private void Login_User_Password_Check() { //deserialize bin file so it can be read into the List object using (Stream stream = File.Open(path, FileMode.Open)) { var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); account = (List <Accounts>)bformatter.Deserialize(stream); } // Increment login tries loginTries++; for (int i = 0; i < account.Count(); i++) { if (txtUsername.Text == account[i].getuserName() && txtPassword.Text == account[i].getpassword()) { success = true; // Saves into static variable if there is a 'hit'. CurrentUserName = txtUsername.Text; MainDisplayFrame display_form = new MainDisplayFrame(); display_form.Show(); this.Hide(); } } // Prompts user of incorrect username/password if (!success) { MessageBox.Show("Incorrect username and password."); } // Boots user if too many failed attempts. if (loginTries == 5) { MessageBox.Show("You have made too many attempts."); this.Close(); } }