|
|
@ -16,26 +16,22 @@ namespace BlazorApp.Components
|
|
|
|
[Inject]
|
|
|
|
[Inject]
|
|
|
|
public IDataService DataService { get; set; }
|
|
|
|
public IDataService DataService { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int totalItem;
|
|
|
|
private int totalItem;
|
|
|
|
|
|
|
|
|
|
|
|
public Item CurrentDragItem { get; set; }
|
|
|
|
public Item CurrentDragItem { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public int CurrentDragItemIndex { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[CascadingParameter]
|
|
|
|
|
|
|
|
public InventoryComponent Parent { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool choiceSort = false;
|
|
|
|
private bool choiceSort = false;
|
|
|
|
public List<Item> RecipeItems { get; set; }
|
|
|
|
public List<Item> RecipeItems { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
[Parameter]
|
|
|
|
public List<Item> Items { get; set; } = new List<Item>();
|
|
|
|
public List<Item> Items { get; set; } = new List<Item>();
|
|
|
|
public ObservableCollection<InventoryAction> Actions { get; set; }
|
|
|
|
public ObservableCollection<InventoryAction> Actions { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
[Inject]
|
|
|
|
internal IJSRuntime JavaScriptRuntime { get; set; }
|
|
|
|
internal IJSRuntime JavaScriptRuntime { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Constructor
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public InventoryComponent()
|
|
|
|
public InventoryComponent()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Actions = new ObservableCollection<InventoryAction>();
|
|
|
|
Actions = new ObservableCollection<InventoryAction>();
|
|
|
@ -43,37 +39,19 @@ namespace BlazorApp.Components
|
|
|
|
this.RecipeItems = new List<Item> { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null };
|
|
|
|
this.RecipeItems = new List<Item> { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async Task OnReadData(DataGridReadDataEventArgs<Item> e)
|
|
|
|
/// <summary>
|
|
|
|
{
|
|
|
|
/// method that call the javascript
|
|
|
|
if (e.CancellationToken.IsCancellationRequested)
|
|
|
|
/// </summary>
|
|
|
|
{
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
return;
|
|
|
|
/// <param name="e"></param>
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!e.CancellationToken.IsCancellationRequested)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Items = await DataService.List(e.Page, e.PageSize);
|
|
|
|
|
|
|
|
totalItem = await DataService.Count();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnActionsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
|
|
|
private void OnActionsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
JavaScriptRuntime.InvokeVoidAsync("Crafting.AddActions", e.NewItems);
|
|
|
|
JavaScriptRuntime.InvokeVoidAsync("Crafting.AddActions", e.NewItems);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
|
|
/// <summary>
|
|
|
|
{
|
|
|
|
/// method to sort by name or id simultaneoustly
|
|
|
|
base.OnAfterRenderAsync(firstRender);
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
|
|
|
|
if (!firstRender)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void SortByame()
|
|
|
|
private void SortByame()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (choiceSort)
|
|
|
|
if (choiceSort)
|
|
|
|