Skip to content

Commit 3c99727

Browse files
ClientBlazor
1 parent 4c730c3 commit 3c99727

35 files changed

+1408
-0
lines changed

ClientApp/ClientApp.sln

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29319.158
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientApp.Server", "ClientApp\Server\ClientApp.Server.csproj", "{6D2A630B-AA37-4A68-A1C0-F7D5B93FB0E4}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientApp.Client", "ClientApp\Client\ClientApp.Client.csproj", "{B0CE1826-A431-49B6-9443-9E4C62594888}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientApp.Shared", "ClientApp\Shared\ClientApp.Shared.csproj", "{3FE06A3A-BE62-4004-B29E-C8390890857C}"
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
14+
Debug|Any CPU = Debug|Any CPU
15+
Release|Any CPU = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{6D2A630B-AA37-4A68-A1C0-F7D5B93FB0E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{6D2A630B-AA37-4A68-A1C0-F7D5B93FB0E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{6D2A630B-AA37-4A68-A1C0-F7D5B93FB0E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{6D2A630B-AA37-4A68-A1C0-F7D5B93FB0E4}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{B0CE1826-A431-49B6-9443-9E4C62594888}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{B0CE1826-A431-49B6-9443-9E4C62594888}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{B0CE1826-A431-49B6-9443-9E4C62594888}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{B0CE1826-A431-49B6-9443-9E4C62594888}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{3FE06A3A-BE62-4004-B29E-C8390890857C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{3FE06A3A-BE62-4004-B29E-C8390890857C}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{3FE06A3A-BE62-4004-B29E-C8390890857C}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{3FE06A3A-BE62-4004-B29E-C8390890857C}.Release|Any CPU.Build.0 = Release|Any CPU
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
GlobalSection(ExtensibilityGlobals) = postSolution
35+
SolutionGuid = {DD5333AD-2EB5-4B39-820A-9F673E9950A9}
36+
EndGlobalSection
37+
EndGlobal
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Router AppAssembly="@typeof(Program).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
</Found>
5+
<NotFound>
6+
<LayoutView Layout="@typeof(MainLayout)">
7+
<p>Sorry, there's nothing at this address.</p>
8+
</LayoutView>
9+
</NotFound>
10+
</Router>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<OutputType>Exe</OutputType>
6+
<LangVersion>7.3</LangVersion>
7+
<RazorLangVersion>3.0</RazorLangVersion>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19424.4" />
12+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19424.4" PrivateAssets="all" />
13+
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview9.19424.4" />
14+
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview9.19424.4" PrivateAssets="all" />
15+
<PackageReference Include="Syncfusion.EJ2.Blazor" Version="17.3.0.10-beta" />
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ProjectReference Include="..\Shared\ClientApp.Shared.csproj" />
19+
</ItemGroup>
20+
21+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ActiveDebugProfile>IIS Express</ActiveDebugProfile>
5+
</PropertyGroup>
6+
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@page "/counter"
2+
3+
<h1>Counter</h1>
4+
5+
<p>Current count: @currentCount</p>
6+
7+
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
8+
9+
@code {
10+
int currentCount = 0;
11+
12+
void IncrementCount()
13+
{
14+
currentCount++;
15+
}
16+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@page "/fetchdata"
2+
@using ClientApp.Shared
3+
@inject HttpClient Http
4+
5+
<h1>Weather forecast</h1>
6+
7+
<p>This component demonstrates fetching data from the server.</p>
8+
9+
@if (forecasts == null)
10+
{
11+
<p><em>Loading...</em></p>
12+
}
13+
else
14+
{
15+
<table class="table">
16+
<thead>
17+
<tr>
18+
<th>Date</th>
19+
<th>Temp. (C)</th>
20+
<th>Temp. (F)</th>
21+
<th>Summary</th>
22+
</tr>
23+
</thead>
24+
<tbody>
25+
@foreach (var forecast in forecasts)
26+
{
27+
<tr>
28+
<td>@forecast.Date.ToShortDateString()</td>
29+
<td>@forecast.TemperatureC</td>
30+
<td>@forecast.TemperatureF</td>
31+
<td>@forecast.Summary</td>
32+
</tr>
33+
}
34+
</tbody>
35+
</table>
36+
}
37+
38+
@code {
39+
WeatherForecast[] forecasts;
40+
41+
protected override async Task OnInitializedAsync()
42+
{
43+
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("WeatherForecast");
44+
}
45+
46+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@page "/"
2+
@using ClientApp.Shared
3+
@inject HttpClient Http
4+
5+
6+
@using Syncfusion.EJ2.Blazor.Grids
7+
8+
Grid With Default Data
9+
10+
<EjsGrid DataSource="@forecasts">
11+
<GridColumns>
12+
<GridColumn Field=@nameof(WeatherForecast.TemperatureF) HeaderText="TemperatureF" Width="120"></GridColumn>
13+
<GridColumn Field=@nameof(WeatherForecast.TemperatureC) HeaderText="TemperatureC" Width="150"></GridColumn>
14+
<GridColumn Field=@nameof(WeatherForecast.Date) HeaderText=" Order Date" Format="yMd" Type="ColumnType.Date" Width="130"></GridColumn>
15+
<GridColumn Field=@nameof(WeatherForecast.Summary) HeaderText="Summary" Width="120"></GridColumn>
16+
</GridColumns>
17+
</EjsGrid>
18+
19+
@code{
20+
WeatherForecast[] forecasts;
21+
22+
protected override async Task OnInitializedAsync()
23+
{
24+
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("WeatherForecast");
25+
}
26+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Microsoft.AspNetCore.Blazor.Hosting;
2+
3+
namespace ClientApp.Client
4+
{
5+
public class Program
6+
{
7+
public static void Main(string[] args)
8+
{
9+
CreateHostBuilder(args).Build().Run();
10+
}
11+
12+
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
13+
BlazorWebAssemblyHost.CreateDefaultBuilder()
14+
.UseBlazorStartup<Startup>();
15+
}
16+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:49990/",
7+
"sslPort": 0
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"ClientApp.Client": {
19+
"commandName": "Project",
20+
"launchBrowser": true,
21+
"environmentVariables": {
22+
"ASPNETCORE_ENVIRONMENT": "Development"
23+
},
24+
"applicationUrl": "http://localhost:49992/"
25+
}
26+
}
27+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="sidebar">
4+
<NavMenu />
5+
</div>
6+
7+
<div class="main">
8+
<div class="top-row px-4">
9+
<a href="http://blazor.net" target="_blank" class="ml-md-auto">About</a>
10+
</div>
11+
12+
<div class="content px-4">
13+
@Body
14+
</div>
15+
</div>

0 commit comments

Comments
 (0)