Ejemplo n.º 1
0
 private async void SignIn()
 {
     if (String.IsNullOrWhiteSpace(Login) || String.IsNullOrWhiteSpace(Password))
     {
         MessageBox.Show("Login or password is empty");
     }
     else
     {
         var  authService = new AuthenticationService();
         User user        = null;
         try
         {
             IsEnabled = false;
             user      = await Task.Run(() => authService.Authenticate(_authUser));
         }
         catch (Exception ex)
         {
             MessageBox.Show($"Sign in failed {ex.Message}");
             return;
         }
         finally // is done independently from exception
         {
             IsEnabled = true;
         }
         MessageBox.Show($"Sign in was successful for user {user.FirstName} {user.LastName}");
         _gotoWalletsView.Invoke();
         WalletsViewModel.UpdateWalletsCollection(); // here collection of wallets for concrete user is updated because constuctor does it only one time
     }
 }