From 451bed271b8b2b7a155dc6a3e6f3acc27d6a0639 Mon Sep 17 00:00:00 2001 From: Thomas Chazot Date: Wed, 7 Dec 2022 11:02:20 +0100 Subject: [PATCH] =?UTF-8?q?une=20sorte=20de=20merge=20bizarre=20mais=20?= =?UTF-8?q?=C3=A7a=20marche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BlazorApp/Components/InventoryComp.razor | 74 ++++++++++++++++++- .../Components/InventoryComp.razor.cs | 57 +++++++++++++- 2 files changed, 129 insertions(+), 2 deletions(-) diff --git a/BlazorApp/BlazorApp/Components/InventoryComp.razor b/BlazorApp/BlazorApp/Components/InventoryComp.razor index e02abfc..5e627f9 100644 --- a/BlazorApp/BlazorApp/Components/InventoryComp.razor +++ b/BlazorApp/BlazorApp/Components/InventoryComp.razor @@ -1 +1,73 @@ - +@using BlazorApp.Components; +@using BlazorApp.Pages; +@using BlazorApp.Models; + + +
+
+
+ +
Inventory:
+
+ + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
Available items:
+ +
+ + + + + + @if (!string.IsNullOrWhiteSpace(context.ImageBase64)) + { + @context.DisplayName + } + else + { + @context.DisplayName + } + + + + + +
+ + +
+
+
+
\ No newline at end of file diff --git a/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs b/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs index 5f28270..cb699ea 100644 --- a/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs +++ b/BlazorApp/BlazorApp/Components/InventoryComp.razor.cs @@ -1 +1,56 @@ - \ No newline at end of file +using System; +using BlazorApp.Models; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using BlazorApp.Services; +using Blazorise.DataGrid; + +namespace BlazorApp.Components +{ + public partial class InventoryComp + { + + public Item CurrentDragItem { get; set; } + + [Inject] + public IDataService DataService { get; set; } + + [Parameter] + public List Items { get; set; } + + public List RecipeItems { get; set; } + + private int totalItem; + + public InventoryComp() + { + this.RecipeItems = new List { }; + for (int i = 0; i < 18; i++) + { + this.RecipeItems.Append(null); + } + } + + private async Task OnReadData(DataGridReadDataEventArgs e) + { + if (e.CancellationToken.IsCancellationRequested) + { + return; + } + + if (!e.CancellationToken.IsCancellationRequested) + { + Items = await DataService.List(e.Page, e.PageSize); + totalItem = await DataService.Count(); + } + } + + private async Task SortByName() + { + Items = await DataService.SortedList(); + } + + } +} \ No newline at end of file