private void btn_entrar_Click(object sender, RoutedEventArgs e) { Thread T = new Thread(new ThreadStart(show_dialogs.showLoading)); T.SetApartmentState(ApartmentState.STA); if (network_status.checkConectionOk()) { T.Start(); Login login = new Login(); if (login.Userlogin(txtbox_cpf.Text, txtbox_senha.Text)) { T.Abort(); MongodbAcess mongodbAcess = new MongodbAcess(); HomeWindow home = new HomeWindow(mongodbAcess.getAllInfoUser(txtbox_cpf.Text)); this.Hide(); this.ShowInTaskbar = false; home.ShowDialog(); this.ShowInTaskbar = true; this.Show(); } else { T.Abort(); MessageBox.Show("usuario ou senha invalida"); } } }
public void InsertNewUser(string full_name, string cpf_id, string cpf, string email, string password) { User user_info = new User(); MongodbAcess mongodbAcess = new MongodbAcess(); if (validade_user(full_name, cpf, email, password)) { Thread T = new Thread(new ThreadStart(show_dialogs.showLoading)); T.SetApartmentState(ApartmentState.STA); user_info.full_name = full_name; user_info.CPF_ID = cpf_id; user_info.CPF = cpf; user_info.email = email; user_info.password = password; T.Start(); if (!network_status.checkConectionOk()) { MessageBox.Show("Parece que você não esta conectado a internet..."); } else { if (mongodbAcess.getUser(cpf)) { T.Abort(); MessageBox.Show("Usuario ja existente..."); } else { mongodbAcess.insertUser(user_info); T.Abort(); show_dialogs.showRegisterOk(); } } } else { MessageBox.Show("Algumas dados são invalidos..."); } }