private void LoginBtn_Click(object sender, RoutedEventArgs e) { Login_Page lg = new Login_Page(); lg.Owner = this; this.Hide(); lg.ShowDialog(); }
private void SignUpBtn_Click(object sender, RoutedEventArgs e) { if (PasswordTexBox1.Password == PasswordTexBox1.Password) { string login = UserNameTextBox.Text; string name = FirsNameTextBox.Text; string email = EmailTexBox.Text; string passw = PasswordTexBox1.Password; DateTime regDate = DateTime.Now; User userSignUp = new User() { Name = name, Login = login, Email = email, Password = passw, RegistrationDate = regDate, RoleId = 1, StatusId = 2, FuncName = "UserSignUp" }; commands.SendUser(userSignUp); //User userSignUp = new User(0, name, login, email, passw, regDate, 1, 2, "UserSignUp"); /* * string ipConnect = "127.0.0.1"; * int port = 1488; * IPAddress ip = IPAddress.Parse(ipConnect); * TcpClient client = new TcpClient(); * client.Connect(ip, port); * * NetworkStream ns = client.GetStream(); * BinaryFormatter bf = new BinaryFormatter(); * bf.Serialize(ns, userSignUp); * * ns.Close(); * client.Close(); */ Login_Page lg = new Login_Page(); lg.Owner = this; this.Hide(); lg.ShowDialog(); } else { MessageBox.Show("Паролі не співпадають"); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Login_Page login = new Login_Page(); login.ShowDialog(); if (login.DialogResult == DialogResult.OK) { login.Dispose(); Application.Run(new Main_Page()); } else if (login.DialogResult == DialogResult.Cancel) { login.Dispose(); return; } }