/// <summary> /// Handles the Click event of the btnDeleteGroup control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private async void btnDeleteGroup_Click(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure you want to delete this group and database matches?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { try { await RetryHelper.VoidOperationWithBasicRetryAsync(() => _faceServiceClient.DeleteLargePersonGroupAsync(SelectedGroup.Group.LargePersonGroupId), new[] { "RateLimitExceeded" }, traceWriter : _mainWindowLogTraceWriter); _db.RemovePersonsForGroup(SelectedGroup.Group.LargePersonGroupId); FaceGroups.Remove(SelectedGroup); SelectedGroup = null; MainWindow.Log($"Selected group deleted successfully"); } catch (Exception ex) { MainWindow.Log($"Error deleting group: {ex.Message}"); } } }
private async void btnDeleteGroup_Click(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure you want to delete this group and database matches?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { try { while (true) { try { await faceServiceClient.DeleteLargePersonGroupAsync(SelectedGroup.Group.LargePersonGroupId); break; } catch (Exception ex) { MainWindow.Log($"Error deleting group: {ex.Message}, retrying"); await Task.Delay(1000); } } db.RemovePersonsForGroup(SelectedGroup.Group.LargePersonGroupId); //Dispatcher.Invoke(() => //{ FaceGroups.Remove(SelectedGroup); SelectedGroup = null; MainWindow.Log($"Selected group deleted successfully"); // }); } catch (Exception ex) { MainWindow.Log($"Error deleting group: {ex.Message}"); } } }