diff --git a/Blazor/Blazor/Components/Inventory.razor.cs b/Blazor/Blazor/Components/Inventory.razor.cs index efd1a4c..71240a3 100644 --- a/Blazor/Blazor/Components/Inventory.razor.cs +++ b/Blazor/Blazor/Components/Inventory.razor.cs @@ -23,6 +23,9 @@ namespace Blazor.Components [Inject] public ILocalStorageService LocalStorage { get; set; } + + [Inject] + public HttpClient Http { get; set; } public Inventory() { @@ -32,7 +35,7 @@ namespace Blazor.Components public async void update() { this.StateHasChanged(); - await LocalStorage.SetItemAsync("list", inventory.inventoryItems); + await JavaScriptRuntime.InvokeVoidAsync("localStorage.setItem", "list", inventory.inventoryItems); return; } @@ -42,22 +45,21 @@ namespace Blazor.Components JavaScriptRuntime.InvokeVoidAsync("Crafting.AddActions", e.NewItems); } - - /* + + private async Task OnReadData(DataGridReadDataEventArgs e) { if (e.CancellationToken.IsCancellationRequested) { return; } - - var response = (await LocalStorage.GetItemAsync>("list")); + var response = await JSRuntime.InvokeAsync>("localStorage.getItemAsync", "list"); if (!e.CancellationToken.IsCancellationRequested) { inventory.inventoryItems = response; } - }*/ + } } } diff --git a/Blazor/Blazor/Components/InventoryList.razor b/Blazor/Blazor/Components/InventoryList.razor index 4055e5e..179f036 100644 --- a/Blazor/Blazor/Components/InventoryList.razor +++ b/Blazor/Blazor/Components/InventoryList.razor @@ -13,7 +13,7 @@ - + @context.DisplayName diff --git a/Blazor/Blazor/Components/InventoryList.razor.cs b/Blazor/Blazor/Components/InventoryList.razor.cs index f0dc2a0..172d6d0 100644 --- a/Blazor/Blazor/Components/InventoryList.razor.cs +++ b/Blazor/Blazor/Components/InventoryList.razor.cs @@ -1,4 +1,5 @@ using Blazor.Models; +using Blazor.Pages; using Blazor.Services; using Blazored.Modal; using Blazored.Modal.Services; @@ -18,7 +19,7 @@ namespace Blazor.Components public IDataService DataService { get; set; } [Inject] - public IWebHostEnvironment WebHostEnvironment { get; set; } + public IWebHostEnvironment WebHostEnvironment { get; set;} [Inject] public NavigationManager NavigationManager { get; set; } diff --git a/Blazor/Blazor/Components/ItemInventory.razor.cs b/Blazor/Blazor/Components/ItemInventory.razor.cs index fce08e7..7a927b0 100644 --- a/Blazor/Blazor/Components/ItemInventory.razor.cs +++ b/Blazor/Blazor/Components/ItemInventory.razor.cs @@ -44,6 +44,7 @@ namespace Blazor.Components Parent.inventory.inventoryItems[this.Index] = this.Items; if (this.Items == null) return; Parent.Actions.Add(new InventoryAction("On Drop",this.Index,Items.item)); + Parent.update(); return; } if(Parent.CurrentDragItem == null) diff --git a/Blazor/Blazor/Pages/Index.razor b/Blazor/Blazor/Pages/Index.razor index a7a3191..2fc9f9b 100644 --- a/Blazor/Blazor/Pages/Index.razor +++ b/Blazor/Blazor/Pages/Index.razor @@ -1,5 +1,12 @@ @page "/" @using Blazor.Components; +@using System.Globalization +

Welcome

+ +

+ CurrentCulture: @CultureInfo.CurrentCulture +

+
diff --git a/Blazor/Blazor/Pages/InventoryPage.razor b/Blazor/Blazor/Pages/InventoryPage.razor index 4275e28..37793d9 100644 --- a/Blazor/Blazor/Pages/InventoryPage.razor +++ b/Blazor/Blazor/Pages/InventoryPage.razor @@ -1,8 +1,10 @@ @page "/inventory" @using Blazor.Components +@using Microsoft.Extensions.Localization; -Inventory +@Localizer["Title"] -

Inventory

+

@Localizer["Title"]

+ diff --git a/Blazor/Blazor/Pages/InventoryPage.razor.cs b/Blazor/Blazor/Pages/InventoryPage.razor.cs new file mode 100644 index 0000000..49b667b --- /dev/null +++ b/Blazor/Blazor/Pages/InventoryPage.razor.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Localization; + +namespace Blazor.Pages +{ + public partial class InventoryPage + { + + [Inject] + public IStringLocalizer Localizer { get; set; } + + } +} diff --git a/Blazor/Blazor/Resources/Components.InventoryList.fr-FR.resx b/Blazor/Blazor/Resources/Components.InventoryList.fr-FR.resx new file mode 100644 index 0000000..1b615c0 --- /dev/null +++ b/Blazor/Blazor/Resources/Components.InventoryList.fr-FR.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Nom de l'objet + + \ No newline at end of file diff --git a/Blazor/Blazor/Resources/Components.InventoryList.resx b/Blazor/Blazor/Resources/Components.InventoryList.resx new file mode 100644 index 0000000..0dd1f65 --- /dev/null +++ b/Blazor/Blazor/Resources/Components.InventoryList.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Display name + + \ No newline at end of file diff --git a/Blazor/Blazor/Resources/Pages.InventoryPage.fr-FR.resx b/Blazor/Blazor/Resources/Pages.InventoryPage.fr-FR.resx new file mode 100644 index 0000000..67b7493 --- /dev/null +++ b/Blazor/Blazor/Resources/Pages.InventoryPage.fr-FR.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Inventaire + + \ No newline at end of file diff --git a/Blazor/Blazor/Resources/Pages.InventoryPage.resx b/Blazor/Blazor/Resources/Pages.InventoryPage.resx new file mode 100644 index 0000000..6c5f871 --- /dev/null +++ b/Blazor/Blazor/Resources/Pages.InventoryPage.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Inventory + + \ No newline at end of file diff --git a/Blazor/Blazor/Resources/Pages.List.fr-FR.resx b/Blazor/Blazor/Resources/Pages.List.fr-FR.resx new file mode 100644 index 0000000..50bb302 --- /dev/null +++ b/Blazor/Blazor/Resources/Pages.List.fr-FR.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Liste des éléments + + \ No newline at end of file diff --git a/Blazor/Blazor/Resources/Pages.List.resx b/Blazor/Blazor/Resources/Pages.List.resx new file mode 100644 index 0000000..b6fc239 --- /dev/null +++ b/Blazor/Blazor/Resources/Pages.List.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Item List + + \ No newline at end of file diff --git a/Blazor/Blazor/Resources/Shared.NavMenu.fr-FR.resx b/Blazor/Blazor/Resources/Shared.NavMenu.fr-FR.resx new file mode 100644 index 0000000..d907d43 --- /dev/null +++ b/Blazor/Blazor/Resources/Shared.NavMenu.fr-FR.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Compteur + + + Récupérer des données + + + Menu + + + Inventaire + + + Liste + + \ No newline at end of file diff --git a/Blazor/Blazor/Resources/Shared.NavMenu.resx b/Blazor/Blazor/Resources/Shared.NavMenu.resx new file mode 100644 index 0000000..8676cd0 --- /dev/null +++ b/Blazor/Blazor/Resources/Shared.NavMenu.resx @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Counter + + + Fetch Data + + + Home +Counter +Fetch +List +Inventory + + + Inventory + + + List + + \ No newline at end of file diff --git a/Blazor/Blazor/Shared/NavMenu.razor b/Blazor/Blazor/Shared/NavMenu.razor index e792a1e..926525b 100644 --- a/Blazor/Blazor/Shared/NavMenu.razor +++ b/Blazor/Blazor/Shared/NavMenu.razor @@ -11,27 +11,27 @@ diff --git a/Blazor/Blazor/Shared/NavMenu.razor.cs b/Blazor/Blazor/Shared/NavMenu.razor.cs new file mode 100644 index 0000000..0a95123 --- /dev/null +++ b/Blazor/Blazor/Shared/NavMenu.razor.cs @@ -0,0 +1,12 @@ +using Blazor.Pages; +using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Localization; + +namespace Blazor.Shared +{ + public partial class NavMenu + { + [Inject] + public IStringLocalizer Localizer { get; set; } + } +}