private async void BtnSave_Click(object sender, System.Windows.RoutedEventArgs e) { if (voters.Count != 0) { var window = Window.GetWindow(this) as MetroWindow; var dialogResult = await window.ShowMessageAsync("Save Voter List", "Are You Sure You Want To Add this List Of Voters", MessageDialogStyle.AffirmativeAndNegative); if (dialogResult == MessageDialogResult.Affirmative) { try { BtnSave.IsEnabled = false; _added = await ElectionConfigurationService.AddVotersAsync(voters); AddedCount.Visibility = Visibility.Visible; AddedCount.Content = $"Added {_added} Voters"; voters.Clear(); _dataSet.Reset(); BtnSave.IsEnabled = true; } catch (Exception exception) { await metroWindow.ShowMessageAsync("Voter Addition Error", exception.Message); } } } }