|
|
|
@ -24,17 +24,34 @@ namespace BlazorApp.Components
|
|
|
|
|
|
|
|
|
|
public List<Item> InventoryItems { get; set; }
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<CraftingAction> Actions { get; set; }
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
internal IJSRuntime JavaScriptRuntime { get; set; }
|
|
|
|
|
|
|
|
|
|
private int totalItem;
|
|
|
|
|
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
public bool IsSorted { get; set; }
|
|
|
|
|
=======
|
|
|
|
|
private int PageSize { get; set; }
|
|
|
|
|
private int CurrentPage { get; set; }
|
|
|
|
|
|
|
|
|
|
private bool IsSorted { get; set; }
|
|
|
|
|
|
|
|
|
|
>>>>>>> ffa1fa821cc019ca5b6c2b58235c7474e8f62dd1
|
|
|
|
|
|
|
|
|
|
public InventoryComp()
|
|
|
|
|
{
|
|
|
|
|
this.InventoryItems = new List<Item> { };
|
|
|
|
|
for (int i = 0; i < 18; i++)
|
|
|
|
|
{
|
|
|
|
|
this.InventoryItems.Append(null);
|
|
|
|
|
Actions = new ObservableCollection<CraftingAction>();
|
|
|
|
|
Actions.CollectionChanged += OnActionsCollectionChanged;
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
@ -44,6 +61,7 @@ namespace BlazorApp.Components
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
if (!e.CancellationToken.IsCancellationRequested && IsSorted ==false)
|
|
|
|
|
{
|
|
|
|
|
Items = await DataService.List(e.Page, e.PageSize);
|
|
|
|
@ -54,10 +72,26 @@ namespace BlazorApp.Components
|
|
|
|
|
Items = await DataService.SortedList(e.Page, e.PageSize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
=======
|
|
|
|
|
if (!e.CancellationToken.IsCancellationRequested && !IsSorted)
|
|
|
|
|
{
|
|
|
|
|
Items = await DataService.List(e.Page, e.PageSize);
|
|
|
|
|
totalItem = await DataService.Count();
|
|
|
|
|
CurrentPage = e.Page;
|
|
|
|
|
PageSize = e.PageSize;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CurrentPage = e.Page;
|
|
|
|
|
PageSize = e.PageSize;
|
|
|
|
|
Items = await DataService.SortedList(CurrentPage, PageSize);
|
|
|
|
|
}
|
|
|
|
|
>>>>>>> ffa1fa821cc019ca5b6c2b58235c7474e8f62dd1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task SortByName()
|
|
|
|
|
{
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
if (IsSorted)
|
|
|
|
|
{
|
|
|
|
|
IsSorted = false;
|
|
|
|
@ -65,6 +99,12 @@ namespace BlazorApp.Components
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
IsSorted = true;
|
|
|
|
|
=======
|
|
|
|
|
if (!IsSorted)
|
|
|
|
|
{
|
|
|
|
|
IsSorted = true;
|
|
|
|
|
Items = await DataService.SortedList(CurrentPage, PageSize);
|
|
|
|
|
>>>>>>> ffa1fa821cc019ca5b6c2b58235c7474e8f62dd1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|