private void LoginButton_Click(object sender, RoutedEventArgs e) { this.admins = FileAdapter.GetAllAdmins(); string loginStr = login.Text; string passStr = FileAdapter.ComputeSha256Hash(pass.Password); bool isLoginCorrect = false; string baseName = ""; foreach (Admin admin in admins) { if (admin.name == loginStr && admin.pass == passStr) { isLoginCorrect = true; baseName = admin.baseName; break; } } if (isLoginCorrect) { BaseEditor baseEditor = new BaseEditor(baseName); baseEditor.Show(); this.Close(); } else { MessageBox.Show("wpisałeś błędne hasło lub login", "Błąd logowania"); } }
private void GetHintButton_Click(object sender, RoutedEventArgs e) { List <Admin> admins = FileAdapter.GetAllAdmins(); string loginStr = login.Text; bool isLoginCorrect = false; string hint = ""; foreach (Admin admin in admins) { if (admin.name == loginStr) { isLoginCorrect = true; hint = admin.hint; MessageBox.Show("Podpowiedź brzmi: " + hint, "Podpowiedź", MessageBoxButton.OK, MessageBoxImage.Information); break; } } if (!isLoginCorrect) { MessageBox.Show("Zły login", "Błąd Loginu", MessageBoxButton.OK, MessageBoxImage.Error); } }
public RegisterScreen() { InitializeComponent(); this.admins = FileAdapter.GetAllAdmins(); }