private void DeleteHands() { var handsToDelete = SelectedReportHands?.Select(x => new { x.GameNumber, x.PokerSiteId }).ToArray(); if (handsToDelete == null || handsToDelete.Length == 0) { return; } var notification = new PopupBaseNotification() { Title = handsToDelete.Length == 1 ? CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_SingleTitle") : string.Format(CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_MultipleTitle"), handsToDelete.Length), CancelButtonCaption = CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_Cancel"), ConfirmButtonCaption = CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_Yes"), Content = handsToDelete.Length == 1 ? CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_SingleContent") : CommonResourceManager.Instance.GetResourceString("Notifications_DeleteHand_MultipleContent"), IsDisplayH1Text = true }; PopupRequest.Raise(notification, confirmation => { if (confirmation.Confirmed) { var dataservice = ServiceLocator.Current.GetInstance <IDataService>(); handsToDelete.ForEach(x => dataservice.DeleteHandHistory(x.GameNumber, x.PokerSiteId)); SelectedReportHands.ForEach(x => { ReportSelectedItemStatisticsCollection.Remove(x); ReportSelectedItem.ReportHands.Remove(x); StorageModel.RemoveStatistic(s => s.GameNumber == x.GameNumber && s.PokersiteId == x.PokerSiteId); }); eventAggregator.GetEvent <UpdateViewRequestedEvent>().Publish(new UpdateViewRequestedEventArgs { IsUpdateReportRequested = true }); } }); }
private async void ExportSelectedHandsTo3rdParty(object obj) { if (SelectedReportHands == null || SelectedReportHands.Count == 0) { return; } try { var exportInfos = SelectedReportHands .Select(x => new HandExportInfo { HandNumber = x.GameNumber, Site = (EnumPokerSites)x.PokerSiteId }) .ToArray(); await ExportHandsTo3rdParty(exportInfos); } catch (Exception e) { LogProvider.Log.Error(this, "Failed to export selected hands to 3rd party apps.", e); } }