private void btn_Auth_Click(object sender, RoutedEventArgs e) { AuthWindow authWindow = new AuthWindow(); authWindow.Show(); this.Hide(); }
private void Button_Click(object sender, RoutedEventArgs e) { AuthWindow authWindow = new AuthWindow(); authWindow.Show(); this.Close(); }
private void Logout_Click(object sender, RoutedEventArgs e) { var window = new AuthWindow(); window.Show(); this.Close(); }
private void LogOut(object sender, RoutedEventArgs e) { Window authWindow = new AuthWindow(); authWindow.Show(); this.Close(); }
public MainForm() { InitializeComponent(); tabControl.Hide(); this.BackColor = ColorTranslator.FromHtml("#C8C9D0"); objDB = new DataDB(); // Заполним DataGrid objDB.dgvTests = this.dataGridTests; objDB.dgvUsers = this.dataGridUsers; objDB.dgvRules = this.dataGridRules; objDB.dgvAdmins = this.dataGridAdmins; objDB.dgvResults = this.dataGridResults; objDB.statusConnection = this.lblStatusConnection; objDB.serverStatus = this.lblServerStatus; objDB.pbStatus = this.pbStatusConnection; objDB.FillTests(); //Окно авторизации AuthWindow aw = new AuthWindow(objDB.status); aw.Show(); aw.BringToFront(); aw.TopMost = true; }
private void Back_OnClick(object sender, RoutedEventArgs e) { var registrationWindow = Window.GetWindow(this) as RegWindow; var authWindow = new AuthWindow(); authWindow.Show(); registrationWindow?.Close(); }
public void ShowAuthWindow(AuthState state_ = AuthState.LOGIN) { AuthData authData = new AuthData(); UserData user = DataProxy.Instance.WebDb.CurrentUser(); if (user != null) { authData.email = user.email; authData.username = user.username; } AuthWindow.Show(new AuthWindowParams(state_, authData)); }
//выйти private void Logout() { AuthWindow authWindow = new AuthWindow(); authWindow.Show(); var window = System.Windows.Application.Current.Windows[0]; if (window != null) { window.Close(); } }
private void btn_Register_Click(object sender, RoutedEventArgs e) { var login = txtBx_Login.Text.Trim(); var psw = pswBx_pasOrig.Password.Trim(); var pswRepeat = pswBx_pasRepeat.Password.Trim(); var email = txtBx_Email.Text.Trim().ToLower(); if (login.Length < 5) { txtBx_Login.ToolTip = "Поле заполнено некорректно!"; txtBx_Login.Background = Brushes.DarkOrange; } else if (psw.Length < 5) { pswBx_pasOrig.ToolTip = "Поле заполнено некорректно!"; pswBx_pasOrig.Background = Brushes.DarkOrange; } else if (psw != pswRepeat) { pswBx_pasRepeat.ToolTip = "Поле заполнено некорректно!"; pswBx_pasRepeat.Background = Brushes.DarkOrange; } else if (email.Length < 5 || !email.Contains("@") || !email.Contains(".")) { txtBx_Email.ToolTip = "Поле заполнено некорректно!"; txtBx_Email.Background = Brushes.DarkOrange; } else { txtBx_Login.ToolTip = ""; txtBx_Login.Background = Brushes.Transparent; pswBx_pasOrig.ToolTip = ""; pswBx_pasOrig.Background = Brushes.Transparent; pswBx_pasRepeat.ToolTip = ""; pswBx_pasRepeat.Background = Brushes.Transparent; txtBx_Email.ToolTip = ""; txtBx_Email.Background = Brushes.Transparent; MessageBox.Show("Данные корректны!"); User newUser = new User(login, psw, email); //Test var newUser = new User { Login = "******", Pass = "******", Email = "[email protected]" }; db.Users.Add(newUser); db.SaveChanges(); AuthWindow authWindow = new AuthWindow(); authWindow.Show(); this.Hide(); } }
private void ConfirmButton_Click(object sender, RoutedEventArgs e) { string connectionString = ConfigurationManager.AppSettings["connectionString"]; SqlConnection sql = new SqlConnection(connectionString); try { if (sql.State == System.Data.ConnectionState.Closed) { sql.Open(); } string sel = "SELECT COUNT(1) FROM Users WHERE Login=@log AND Password=@pass"; SqlCommand sqlCom = new SqlCommand(sel, sql); sqlCom.CommandType = System.Data.CommandType.Text; sqlCom.Parameters.Add("@log", loginField.Text); sqlCom.Parameters.Add("@pass", passwordField.Password); int cUser = Convert.ToInt32(sqlCom.ExecuteScalar()); if (cUser == 0) { sel = "INSERT INTO Users(Login, Password) VALUES(@log, @pass)"; SqlCommand sqlComUser = new SqlCommand(sel, sql); sqlComUser.CommandType = System.Data.CommandType.Text; sqlComUser.Parameters.Add("@log", loginField.Text); sqlComUser.Parameters.Add("@pass", passwordField.Password); sqlComUser.ExecuteNonQuery(); MessageBox.Show("We joined u in data base!"); } else { MessageBox.Show("You autorization success!"); AuthWindow auPage = new AuthWindow(); auPage.Show(); } } catch (Exception pr) { MessageBox.Show(pr.Message); } finally { sql.Close(); } }
private void Application_Startup(object sender, StartupEventArgs e) { authWindow = new AuthWindow(); authWindow.Show(); }