From d907627dcbea7ae745377967174553c57572981a Mon Sep 17 00:00:00 2001 From: Ddggdd135 <1306334428@qq.com> Date: Sat, 11 Jan 2025 16:53:32 +0800 Subject: [PATCH] Remove ClearAllInventoryView --- .../Snap.Hutao/Service/Inventory/IInventoryService.cs | 2 +- .../Snap.Hutao/Service/Inventory/InventoryRepository.cs | 5 ----- .../Snap.Hutao/Service/Inventory/InventoryService.cs | 4 ++-- .../Snap.Hutao/UI/Xaml/View/Page/CultivationPage.xaml | 1 + .../Snap.Hutao/ViewModel/Cultivation/CultivationViewModel.cs | 4 ++-- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Inventory/IInventoryService.cs b/src/Snap.Hutao/Snap.Hutao/Service/Inventory/IInventoryService.cs index 6acd652f03..16343307da 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Inventory/IInventoryService.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Inventory/IInventoryService.cs @@ -12,7 +12,7 @@ internal interface IInventoryService { ImmutableArray GetInventoryItemViews(ICultivationMetadataContext context, CultivateProject cultivateProject, ICommand saveCommand); - void RemoveAllInventoryItem(); + public void RemoveInventoryItemRangeByProjectId(Guid projectId); void SaveInventoryItem(InventoryItemView item); diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Inventory/InventoryRepository.cs b/src/Snap.Hutao/Snap.Hutao/Service/Inventory/InventoryRepository.cs index 6c2c975e7c..f8d1d95393 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Inventory/InventoryRepository.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Inventory/InventoryRepository.cs @@ -18,11 +18,6 @@ public void RemoveInventoryItemRangeByProjectId(Guid projectId) this.Delete(i => i.ProjectId == projectId); } - public void RemoveAllInventoryItem() - { - this.Delete(); - } - public void AddInventoryItemRangeByProjectId(List items) { this.AddRange(items); diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Inventory/InventoryService.cs b/src/Snap.Hutao/Snap.Hutao/Service/Inventory/InventoryService.cs index 07525f357f..377164234f 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Inventory/InventoryService.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Inventory/InventoryService.cs @@ -44,9 +44,9 @@ public void SaveInventoryItem(InventoryItemView item) inventoryRepository.UpdateInventoryItem(item.Entity); } - public void RemoveAllInventoryItem() + public void RemoveInventoryItemRangeByProjectId(Guid projectId) { - inventoryRepository.RemoveAllInventoryItem(); + inventoryRepository.RemoveInventoryItemRangeByProjectId(projectId); } public async ValueTask RefreshInventoryAsync(ICultivationMetadataContext context, CultivateProject project) diff --git a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/CultivationPage.xaml b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/CultivationPage.xaml index 7ba78cd237..97bff482ba 100644 --- a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/CultivationPage.xaml +++ b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/CultivationPage.xaml @@ -317,6 +317,7 @@