private async void LoginButtonClick(object sender, RoutedEventArgs e) { var pesel = PeselTextBox.Text; if (pesel == DonorPeselTextBlock.Text) { LoginSnackbar.MessageQueue.Enqueue("You are already logged in"); } var password = PasswordTextBox.Password; try { await donorClient.LoginAsync(pesel, password); } catch (InvalidLoginCredentialsException) { LoginSnackbar.MessageQueue.Enqueue("Invalid credentials"); return; } var donorName = await donorClient.GetNameAsync(); LoginSnackbar.MessageQueue.Enqueue("You have been successfully logged in"); LoginSnackbar.MessageQueue.Enqueue($"Welcome {donorName}"); await SetLoggedDonorsPeselInHeader(); }
private async Task SetDonorNamerInHeader() { var donorName = await donorClient.GetNameAsync(); DonorNameTextBlockHeader.Text = donorName; }