pour aurian sous la menace

master
remrem 2 years ago
parent 6e754626cb
commit 9cb1d36242

@ -20,4 +20,7 @@
<div class="actions" id="actions"> <div class="actions" id="actions">
</div> </div>
</div> </div>
<InventoryList/>
</CascadingValue> </CascadingValue>

@ -3,6 +3,7 @@ using Blazor.Pages;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized;
namespace Blazor.Components namespace Blazor.Components
{ {
@ -18,6 +19,7 @@ namespace Blazor.Components
public Inventory() public Inventory()
{ {
Actions = new ObservableCollection<InventoryAction>(); Actions = new ObservableCollection<InventoryAction>();
Actions.CollectionChanged += OnActionsCollectionChanged;
} }
public void update() public void update()
{ {
@ -25,6 +27,9 @@ namespace Blazor.Components
return; return;
} }
private void OnActionsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
JavaScriptRuntime.InvokeVoidAsync("Crafting.AddActions", e.NewItems);
}
} }
} }

@ -5,8 +5,6 @@
width: 40%; width: 40%;
} }
.actions { .actions {
border: 1px solid black; border: 1px solid black;
height: 250px; height: 250px;

@ -11,7 +11,7 @@
<DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="#" Width="15%"/> <DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="#" Width="15%"/>
<DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="Image" Filterable="false"> <DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="Image" Filterable="false">
<DisplayTemplate> <DisplayTemplate>
<InventoryListImage Item="context" /> <InventoryListImage Item="context"/>
</DisplayTemplate> </DisplayTemplate>
</DataGridColumn> </DataGridColumn>
<DataGridColumn TItem="Item" Field="@nameof(Item.DisplayName)" Caption="Display name"> <DataGridColumn TItem="Item" Field="@nameof(Item.DisplayName)" Caption="Display name">

Loading…
Cancel
Save