diff --git a/app.client/Pages/Counter.razor b/app.client/Pages/Counter.razor new file mode 100644 index 0000000..ac04d7e --- /dev/null +++ b/app.client/Pages/Counter.razor @@ -0,0 +1,19 @@ +@page "/counter" +@rendermode InteractiveWebAssembly + +Counter + +

Counter

+ +

Current count: @currentCount

+ + + +@code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } +} diff --git a/app.client/Program.cs b/app.client/Program.cs new file mode 100644 index 0000000..524c689 --- /dev/null +++ b/app.client/Program.cs @@ -0,0 +1,5 @@ +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; + +var builder = WebAssemblyHostBuilder.CreateDefault(args); + +await builder.Build().RunAsync(); diff --git a/app.client/_Imports.razor b/app.client/_Imports.razor new file mode 100644 index 0000000..76b6e62 --- /dev/null +++ b/app.client/_Imports.razor @@ -0,0 +1,8 @@ +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop diff --git a/app.client/app.client.csproj b/app.client/app.client.csproj new file mode 100644 index 0000000..82c1eca --- /dev/null +++ b/app.client/app.client.csproj @@ -0,0 +1,15 @@ + + + + net9.0 + enable + enable + true + Default + + + + + + + diff --git a/app.client/wwwroot/appsettings.Development.json b/app.client/wwwroot/appsettings.Development.json new file mode 100644 index 0000000..ff66ba6 --- /dev/null +++ b/app.client/wwwroot/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/app.client/wwwroot/appsettings.json b/app.client/wwwroot/appsettings.json new file mode 100644 index 0000000..ff66ba6 --- /dev/null +++ b/app.client/wwwroot/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/app/Components/Components/NavBar.razor b/app/Components/Components/NavBar.razor index 351552c..a912082 100644 --- a/app/Components/Components/NavBar.razor +++ b/app/Components/Components/NavBar.razor @@ -15,8 +15,10 @@ Events
  • - .NET Conf 2024 + .NET Conf 2024 +
  • +
  • + Counter
  • @*
  • About diff --git a/app/Extensions/Extensions.cs b/app/Extensions/Extensions.cs index 79af1d6..1ee2364 100644 --- a/app/Extensions/Extensions.cs +++ b/app/Extensions/Extensions.cs @@ -27,7 +27,9 @@ public static IServiceCollection AddServices( IHostEnvironment environment) { services.AddRazorComponents() - .AddInteractiveServerComponents(); + .AddInteractiveServerComponents() + .AddInteractiveWebAssemblyComponents(); + if (environment.IsProduction()) { services.AddApplicationInsightsTelemetry(configuration); diff --git a/app/Program.cs b/app/Program.cs index 1066641..5dfb44a 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -37,6 +37,8 @@ app.MapHangfireJobs(); app.MapRazorComponents() - .AddInteractiveServerRenderMode(); + .AddInteractiveServerRenderMode() + .AddInteractiveWebAssemblyRenderMode() + .AddAdditionalAssemblies(typeof(app.client._Imports).Assembly); app.Run(); diff --git a/app/app.csproj b/app/app.csproj index 875a9d8..bb9ecf8 100644 --- a/app/app.csproj +++ b/app/app.csproj @@ -11,12 +11,14 @@ + + diff --git a/dotnetcameroon.sln b/dotnetcameroon.sln index 54d3d94..135db2f 100644 --- a/dotnetcameroon.sln +++ b/dotnetcameroon.sln @@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "app.shared", "app.shared\ap EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "app.domain", "app.domain\app.domain.csproj", "{93EB2875-B349-48BC-8509-86F7365BC945}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "app.client", "app.client\app.client.csproj", "{6E22DCB4-CB51-4976-BB72-3554504B9D59}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -48,5 +50,9 @@ Global {93EB2875-B349-48BC-8509-86F7365BC945}.Debug|Any CPU.Build.0 = Debug|Any CPU {93EB2875-B349-48BC-8509-86F7365BC945}.Release|Any CPU.ActiveCfg = Release|Any CPU {93EB2875-B349-48BC-8509-86F7365BC945}.Release|Any CPU.Build.0 = Release|Any CPU + {6E22DCB4-CB51-4976-BB72-3554504B9D59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6E22DCB4-CB51-4976-BB72-3554504B9D59}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6E22DCB4-CB51-4976-BB72-3554504B9D59}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6E22DCB4-CB51-4976-BB72-3554504B9D59}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal