From 4bfa49f0c240674ff8555403875d836a12d72aa5 Mon Sep 17 00:00:00 2001 From: Thomas TISSIER Date: Fri, 28 Oct 2022 11:43:18 +0200 Subject: [PATCH] Ajout Blasorize --- TutoBlazer/Pages/List.razor | 31 +++++++++++++++++++++++++++++++ TutoBlazer/Pages/List.razor.cs | 17 ++++++++++++++++- TutoBlazer/Pages/_Layout.cshtml | 5 +++++ TutoBlazer/Program.cs | 7 +++++++ TutoBlazer/TutoBlazer.csproj | 6 ++++++ TutoBlazer/TutoBlazer.sln | 25 +++++++++++++++++++++++++ TutoBlazer/_Imports.razor | 1 + 7 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 TutoBlazer/TutoBlazer.sln diff --git a/TutoBlazer/Pages/List.razor b/TutoBlazer/Pages/List.razor index e85a1c1..c4428e9 100644 --- a/TutoBlazer/Pages/List.razor +++ b/TutoBlazer/Pages/List.razor @@ -2,4 +2,35 @@

List

+@if (items != null) +{ + + + + + + + + + + + + + + @foreach (var item in items) + { + + + + + + + + + + } + +
IdDisplay NameStack SizeMaximum DurabilityEnchant CategoriesRepair WithCreated Date
@item.Id@item.DisplayName@item.StackSize@item.MaxDurability@(string.Join(", ", item.EnchantCategories))@(string.Join(", ", item.RepairWith))@item.CreatedDate.ToShortDateString()
+ +} diff --git a/TutoBlazer/Pages/List.razor.cs b/TutoBlazer/Pages/List.razor.cs index 2b47474..27cb4b1 100644 --- a/TutoBlazer/Pages/List.razor.cs +++ b/TutoBlazer/Pages/List.razor.cs @@ -1,6 +1,21 @@ -namespace TutoBlazer.Pages +using Microsoft.AspNetCore.Components; +using TutoBlazer.Models; + +namespace TutoBlazer.Pages { public partial class List { + private Item[] items; + + [Inject] + public HttpClient Http { get; set; } + + [Inject] + public NavigationManager NavigationManager { get; set; } + + protected override async Task OnInitializedAsync() + { + items = await Http.GetFromJsonAsync($"{NavigationManager.BaseUri}fake-data.json"); + } } } diff --git a/TutoBlazer/Pages/_Layout.cshtml b/TutoBlazer/Pages/_Layout.cshtml index c785386..3577ddf 100644 --- a/TutoBlazer/Pages/_Layout.cshtml +++ b/TutoBlazer/Pages/_Layout.cshtml @@ -28,5 +28,10 @@ + + + + + diff --git a/TutoBlazer/Program.cs b/TutoBlazer/Program.cs index 6d30eaf..dad9253 100644 --- a/TutoBlazer/Program.cs +++ b/TutoBlazer/Program.cs @@ -1,3 +1,6 @@ +using Blazorise; +using Blazorise.Bootstrap; +using Blazorise.Icons.FontAwesome; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using TutoBlazer.Data; @@ -9,6 +12,10 @@ builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); builder.Services.AddSingleton(); builder.Services.AddHttpClient(); +builder.Services + .AddBlazorise() + .AddBootstrapProviders() + .AddFontAwesomeIcons(); var app = builder.Build(); diff --git a/TutoBlazer/TutoBlazer.csproj b/TutoBlazer/TutoBlazer.csproj index b775b09..6033f3c 100644 --- a/TutoBlazer/TutoBlazer.csproj +++ b/TutoBlazer/TutoBlazer.csproj @@ -6,4 +6,10 @@ enable + + + + + + diff --git a/TutoBlazer/TutoBlazer.sln b/TutoBlazer/TutoBlazer.sln new file mode 100644 index 0000000..2fe57ed --- /dev/null +++ b/TutoBlazer/TutoBlazer.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32616.157 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TutoBlazer", "TutoBlazer.csproj", "{7CD1577B-C2D9-4882-A7F7-F97BD66B4977}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7CD1577B-C2D9-4882-A7F7-F97BD66B4977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7CD1577B-C2D9-4882-A7F7-F97BD66B4977}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7CD1577B-C2D9-4882-A7F7-F97BD66B4977}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7CD1577B-C2D9-4882-A7F7-F97BD66B4977}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {40DBD66E-A2AD-48B0-937B-2D07E4875D39} + EndGlobalSection +EndGlobal diff --git a/TutoBlazer/_Imports.razor b/TutoBlazer/_Imports.razor index 69c1724..2bbafed 100644 --- a/TutoBlazer/_Imports.razor +++ b/TutoBlazer/_Imports.razor @@ -8,3 +8,4 @@ @using Microsoft.JSInterop @using TutoBlazer @using TutoBlazer.Shared +@using Blazorise.DataGrid