using BlazorApp1.Models; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using System.Collections.ObjectModel; using System.Collections.Specialized; namespace BlazorApp1.Components { public partial class InventoryComponent { public InventoryComponent() { Actions = new ObservableCollection(); Actions.CollectionChanged += OnActionsCollectionChanged; this.InventoryItems = new List { null, null, null, null, null, null, null, null, null }; } public ObservableCollection Actions { get; set; } public Item CurrentDragItem { get; set; } [Parameter] public List Items { get; set; } public List InventoryItems { get; set; } /// /// Gets or sets the java script runtime. /// [Inject] internal IJSRuntime JavaScriptRuntime { get; set; } private void OnActionsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) { JavaScriptRuntime.InvokeVoidAsync("Crafting.AddActions", e.NewItems); } } }