public void LoginButton_OnClick(object sender, RoutedEventArgs e) { try { this.UsuarioViewModel = new ViewModel.UsuarioViewModel(); this.UsuarioViewModel.LoginUsuario.Execute(new Usuario(UsuarioTextBox.Text, SenhaPasswordBox.Password)); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// The methods provided in this section are simply used to allow /// NavigationHelper to respond to the page's navigation methods. /// <para> /// Page specific logic should be placed in event handlers for the /// <see cref="NavigationHelper.LoadState"/> /// and <see cref="NavigationHelper.SaveState"/>. /// The navigation parameter is available in the LoadState method /// in addition to page state preserved during an earlier session. /// </para> /// </summary> /// <param name="e">Provides data for navigation methods and event /// handlers that cannot cancel the navigation request.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { this.navigationHelper.OnNavigatedTo(e); this.UsuarioViewModel = new ViewModel.UsuarioViewModel(); this.Usuarios.DataContext = this.UsuarioViewModel; }
//Não utilizando Binding no momento, se preciso alterar depois //private void CreateOrUpdateCommand() //{ // Frame.Navigate(typeof(PivotPage), new Usuario(NomeTextBox.Text, EmailTextBox.Text, SenhaPasswordBox.Password)); //} //Usando método Click do botão private void ButtonSalvar_Click(object sender, RoutedEventArgs e) { this.UsuarioViewModel = new ViewModel.UsuarioViewModel(); this.UsuarioViewModel.SalvarUsuarioAcesso.Execute(new Usuario(NomeTextBox.Text, EmailTextBox.Text, SenhaPasswordBox.Password)); }