Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor and Radzen set up #2

Merged
merged 5 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions VSOP.Application/VSOP.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.9.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" />
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@inherits LayoutComponentBase

<RadzenComponents />
<div class="page">
<div class="sidebar">
<NavMenu />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">VSOP.WebApp</a>
<a class="navbar-brand" href="">VSOP</a>
</div>
</div>

Expand Down
1 change: 0 additions & 1 deletion VSOP.WebApp/VSOP.WebApp.Client/Pages/Counter.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@page "/counter"
@rendermode InteractiveWebAssembly

<PageTitle>Counter</PageTitle>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@page "/weather"
@attribute [StreamRendering]

<PageTitle>Weather</PageTitle>

Expand Down Expand Up @@ -41,7 +40,7 @@ else

protected override async Task OnInitializedAsync()
{
// Simulate asynchronous loading to demonstrate streaming rendering
// Simulate asynchronous loading to demonstrate a loading indicator
await Task.Delay(500);

var startDate = DateOnly.FromDateTime(DateTime.Now);
Expand Down
5 changes: 5 additions & 0 deletions VSOP.WebApp/VSOP.WebApp.Client/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Radzen;

namespace VSOP.WebApp.Client
{
internal class Program
{
static async Task Main(string[] args)
{

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

builder.Services.AddRadzenComponents();

await builder.Build().RunAsync();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Router AppAssembly="typeof(Program).Assembly" AdditionalAssemblies="new[] { typeof(Client._Imports).Assembly }">
<Router AppAssembly="typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
<FocusOnNavigate RouteData="routeData" Selector="h1" />
Expand Down
3 changes: 2 additions & 1 deletion VSOP.WebApp/VSOP.WebApp.Client/VSOP.WebApp.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -10,6 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.1" />
<PackageReference Include="Radzen.Blazor" Version="4.24.7" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions VSOP.WebApp/VSOP.WebApp.Client/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using VSOP.WebApp.Client
@using Radzen
@using Radzen.Blazor
10 changes: 6 additions & 4 deletions VSOP.WebApp/VSOP.WebApp/Components/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
<base href="/" />
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="app.css" />
<link rel="stylesheet" href="VSOP.WebApp.styles.css" />
<link rel="stylesheet" href="VSOP.WebApp.styles.css" />
<link rel="stylesheet" href="_content/Radzen.Blazor/css/material-base.css">
<link rel="icon" type="image/png" href="favicon.png" />
<HeadOutlet />
<HeadOutlet @rendermode="InteractiveWebAssembly" />
</head>

<body>
<Routes />
<Routes @rendermode="InteractiveWebAssembly" />
<script src="_framework/blazor.web.js"></script>
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
</body>

</html>
</html>
3 changes: 3 additions & 0 deletions VSOP.WebApp/VSOP.WebApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.OpenApi.Models;
using Radzen;
using System.Reflection;
using VSOP.Application;
using VSOP.Persistence;
Expand All @@ -12,6 +13,7 @@ public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);


builder.Services.AddControllers();

#region SolutionDI's
Expand All @@ -22,6 +24,7 @@ public static void Main(string[] args)
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveWebAssemblyComponents();
builder.Services.AddRadzenComponents();


builder.Services.AddEndpointsApiExplorer();
Expand Down