Skip to content

Commit

Permalink
Remove ClearAllInventoryView
Browse files Browse the repository at this point in the history
  • Loading branch information
JWJUN233233 committed Jan 11, 2025
1 parent 90495cd commit d907627
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal interface IInventoryService
{
ImmutableArray<InventoryItemView> GetInventoryItemViews(ICultivationMetadataContext context, CultivateProject cultivateProject, ICommand saveCommand);

void RemoveAllInventoryItem();
public void RemoveInventoryItemRangeByProjectId(Guid projectId);

void SaveInventoryItem(InventoryItemView item);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ public void RemoveInventoryItemRangeByProjectId(Guid projectId)
this.Delete(i => i.ProjectId == projectId);
}

public void RemoveAllInventoryItem()
{
this.Delete();
}

public void AddInventoryItemRangeByProjectId(List<InventoryItem> items)
{
this.AddRange(items);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@
</AppBarElementContainer>
<AppBarButton
Command="{Binding ClearInventoryCommand}"
CommandParameter="{Binding Projects.CurrentItem, Mode=OneWay}"
Icon="{shuxm:FontIcon Glyph=&#xE74D;}"
Label="{shuxm:ResourceString Name=ViewPageCultivationClearInventory}"/>
<AppBarButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private async Task RefreshInventoryAsync()
}

[Command("ClearInventoryCommand")]
private async Task ClearInventoryAsync()
private async Task ClearInventoryAsync(CultivateProject? project)
{
if (Projects?.CurrentItem is null)
{
Expand All @@ -250,7 +250,7 @@ private async Task ClearInventoryAsync()
.ConfigureAwait(false);
using (await contentDialogFactory.BlockAsync(dialog).ConfigureAwait(false))
{
inventoryService.RemoveAllInventoryItem();
inventoryService.RemoveInventoryItemRangeByProjectId(project.InnerId);

await UpdateInventoryItemsAsync().ConfigureAwait(false);
await UpdateStatisticsItemsAsync().ConfigureAwait(false);
Expand Down

0 comments on commit d907627

Please sign in to comment.