private void LoginButton_Click(object sender, RoutedEventArgs e) { if (IfSomeValuesAreDefault()) { MessageBox.Show("Заполните, пожалуйста, все поля.", "Ошибка!"); } else { string login = LoginTextBox.Text; string password = User.GetHash(PasswordBox.Password); User user = _storage.Users.Items.FirstOrDefault(u => ( u.Login.ToLower() == login.ToLower() & u.Password == password)); if (user != null) { ProfileWindow profileWindow = new ProfileWindow(_storage, user); profileWindow.Show(); Close(); } else { MessageBox.Show("Неправильный логин или пароль!", "Ошибка!"); RestartTheWindow(); } } }
private void SavingTheGameAndReturningToProfile() { SaveGame(); ProfileWindow profileWindow = new ProfileWindow(_storage, _user); profileWindow.Show(); }
private void GoingBackToProfileWindow() { ProfileWindow profileWindow = new ProfileWindow(_storage, _user); _storage.CloseGame(); profileWindow.Show(); }