|
|
@ -6,12 +6,15 @@ using System.Collections.ObjectModel;
|
|
|
|
using System.Collections.Specialized;
|
|
|
|
using System.Collections.Specialized;
|
|
|
|
using BlazorApp.Services;
|
|
|
|
using BlazorApp.Services;
|
|
|
|
using Blazorise.DataGrid;
|
|
|
|
using Blazorise.DataGrid;
|
|
|
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BlazorApp.Components
|
|
|
|
namespace BlazorApp.Components
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public partial class InventoryComp
|
|
|
|
public partial class InventoryComp
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Item CurrentDragItem { get; set; }
|
|
|
|
public Item CurrentDragItem { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public int CurrentDragIndex { get; set; }
|
|
|
|
public int CurrentDragIndex { get; set; }
|
|
|
@ -24,17 +27,30 @@ namespace BlazorApp.Components
|
|
|
|
|
|
|
|
|
|
|
|
public List<Item> InventoryItems { get; set; }
|
|
|
|
public List<Item> InventoryItems { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<CraftingAction> Actions { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsSorted { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
|
|
|
internal IJSRuntime JavaScriptRuntime { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int totalItem;
|
|
|
|
private int totalItem;
|
|
|
|
|
|
|
|
|
|
|
|
public InventoryComp()
|
|
|
|
public InventoryComp()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.InventoryItems = new List<Item> { };
|
|
|
|
Actions = new ObservableCollection<CraftingAction>();
|
|
|
|
for (int i = 0; i < 18; i++)
|
|
|
|
Actions.CollectionChanged += OnActionsCollectionChanged;
|
|
|
|
{
|
|
|
|
|
|
|
|
this.InventoryItems.Append(null);
|
|
|
|
this.InventoryItems = new List<Item>(new Item[18]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnActionsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
JavaScriptRuntime.InvokeVoidAsync("Crafting.AddActions", e.NewItems);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async Task OnReadData(DataGridReadDataEventArgs<Item> e)
|
|
|
|
private async Task OnReadData(DataGridReadDataEventArgs<Item> e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (e.CancellationToken.IsCancellationRequested)
|
|
|
|
if (e.CancellationToken.IsCancellationRequested)
|
|
|
@ -42,16 +58,33 @@ namespace BlazorApp.Components
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!e.CancellationToken.IsCancellationRequested)
|
|
|
|
if (!e.CancellationToken.IsCancellationRequested && IsSorted==false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Items = await DataService.List(e.Page, e.PageSize);
|
|
|
|
Items = await DataService.List(e.Page, e.PageSize);
|
|
|
|
totalItem = await DataService.Count();
|
|
|
|
totalItem = await DataService.Count();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Items = await DataService.SortedList(e.Page, e.PageSize);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async Task SortByName()
|
|
|
|
private void SortByName()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
<<<<<<< Updated upstream
|
|
|
|
Items = await DataService.SortedList();
|
|
|
|
Items = await DataService.SortedList();
|
|
|
|
|
|
|
|
=======
|
|
|
|
|
|
|
|
if (IsSorted)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IsSorted = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IsSorted = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
|
|
|
>>>>>>> Stashed changes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void refresh()
|
|
|
|
void refresh()
|
|
|
|