public void Registrate(object sender, RoutedEventArgs e) { var _login = Login.Text; var _password = Hashing.GetHash(Password.Password); long.TryParse(Phone.Text, out var _phone); if (_login != "" && _password != "" && Phone.Text != "") { try { if (CheckEmailOnCorrect()) { user = new User(_login, _password, _phone); if (User.users == null) { User.users = new List <User>(); } User.users.Add(user); Registration.Registrate(); var sW = new Successfully(); sW.Show(); Close(); } else { MessageBox.Show("Incorrectly entered E-mail"); } } catch (ArgumentException) { MessageBox.Show("We select tables based on your preferences. Add them please.", "Preferences error"); } } else { MessageBox.Show("You have to fill the gaps with stars. It's necessary.", "Error"); } }
public void Registrate(object sender, RoutedEventArgs e) { var _login = Login.Text; var _password = Hashing.GetHash(Password.Password); long.TryParse(Phone.Text, out var _phone); //Было бы неплохо создать определенный метод CheckData для работы со всем этим добром if (Login.Text != "" && Password.Password != "" && Phone.Text != "") { try { if (CheckEmailOnCorrect()) { user = new User(_login, _password, _phone); User.users.Add(user); Registration.Registrate(); //Необходимо сделать вызов окна доступным только при всех верно введенных данных var sW = new Successfully(); sW.Show(); Close(); } else { MessageBox.Show("Incorrectly entered E-mail"); } } catch (ArgumentException) { MessageBox.Show("We select tables based on your preferences. Add them please.", "Preferences error"); } } else { MessageBox.Show("You have to fill the gaps with stars. It's necessary.", "Error"); } }