private void Button_Click(object sender, RoutedEventArgs e) { this.Hide(); Main_Menu mm = new Main_Menu(); mm.Show(); }
private void btnLog_Click(object sender, RoutedEventArgs e) { string username = textbox1.Text; string pass = textbox2.Text; Main_Menu mm = new Main_Menu(); server = "localhost"; database = "ai fridge"; uid = "root"; password = ""; string connectionString; connectionString = "SERVER=" + server + ";" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD="******";"; connection = new MySqlConnection(connectionString); string query = "SELECT * FROM user"; connection.Open(); MySqlCommand cmd = new MySqlCommand(query, connection); MySqlDataReader dataReader = cmd.ExecuteReader(); int count = 0; while (dataReader.Read()) { User us = new User(); us.Username = dataReader["UserName"].ToString(); us.pass = dataReader["Pass"].ToString(); us.phone = (int)dataReader["Phone"]; if (username == "" || pass == "") { MessageBox.Show("Please Fill Up Username and Password!!!"); } else { if (us.Username == username && us.pass == pass) { count++; break; } } } if (count == 1) { this.Hide(); mm.Show(); MessageBox.Show("Access Granted!"); } else { MessageBox.Show("Wrong usenrame or Password"); } dataReader.Close(); connection.Close(); }
private void btnback_Click(object sender, RoutedEventArgs e) { spe.RecognizeAsyncCancel(); Main_Menu g = new Main_Menu(); this.Hide(); g.Show(); }
private void Recognizer(object sender, SpeechRecognizedEventArgs e) { string speech = e.Result.Text; if (speech == "Go Back") { Main_Menu g = new Main_Menu(); spe.RecognizeAsyncCancel(); this.Hide(); g.Show(); } }