void LoginAccount() { sql.LoadTable($"select * from Users where Email='{loginUserEmail.Text.Trim()}';", ref dt); if (dt.Rows.Count == 0) { MsgBoxLogin msgBox = new MsgBoxLogin("error", "Can't find an account associated with this email id", "Okay") { Owner = this, Width = ActualWidth, Height = ActualHeight }; msgBox.ShowDialog(); } else { if (loginUserEmail.Text.Trim() == dt.Rows[0][1].ToString() && loginPass.Password.Trim() == dt.Rows[0][2].ToString()) { if (RemMeChck.IsChecked == true) { Properties.Settings.Default.email = loginUserEmail.Text.Trim(); Properties.Settings.Default.pass = loginPass.Password.Trim(); Properties.Settings.Default.Save(); } else { Properties.Settings.Default.Reset(); } Properties.Settings.Default.CurrentUser = loginUserEmail.Text.Trim(); Properties.Settings.Default.Save(); MainWindow mainWindow = new MainWindow(); mainWindow.Show(); Close(); } else { MsgBoxLogin msgBox = new MsgBoxLogin("error", "Password and username doesn't match", "Okay") { Owner = this, Width = ActualWidth, Height = ActualHeight }; msgBox.ShowDialog(); } } }