private void Reg(object sender, RoutedEventArgs e) { if (PasswordReg.Password.ToString() == PasswordReg2.Password.ToString() && us.CheckNick(NickName.Text) && us.CheckMail2(Mail.Text)) { User users = new User(); Info info = new Info(); users.Nick = NickName.Text; users.Pass = PasswordReg.Password.ToString(); info.Name = Name.Text; info.Surname = Surname.Text; info.Mail = Mail.Text; users.person = info; Ur.Add(users); MainWindow main = new MainWindow() { WindowStartupLocation = WindowStartupLocation.CenterScreen }; main.ShowDialog(); this.Close(); } else { NickName.Text = ""; Name.Text = ""; Surname.Text = ""; Mail.Text = ""; } }