private async void BtnSearch_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(Searchterm.Text)) { var voter = await VotingService.GetVoterPass(new Voter { IndexNumber = Searchterm.Text }); if (voter != null) { var dialogSettings = new MetroDialogSettings { DialogMessageFontSize = 20, AffirmativeButtonText = "Ok" }; await metroWindow.ShowMessageAsync($"Name:{voter.VoterName}", $"Password: {voter.VoterCode}", MessageDialogStyle.Affirmative, dialogSettings); Searchterm.Text = string.Empty; } else { await metroWindow.ShowMessageAsync("Password", $"Voter with Index Number: {Searchterm.Text} not found!"); Searchterm.Text = string.Empty; } } }