Skip to content

Commit 2bedfa1

Browse files
Init
1 parent 1b8e661 commit 2bedfa1

28 files changed

+1233
-0
lines changed

CompareBlazor/CompareBlazor.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.28917.182
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompareBlazor", "CompareBlazor\CompareBlazor.csproj", "{D680272C-7297-408E-83FD-BF567FB8C64D}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{D680272C-7297-408E-83FD-BF567FB8C64D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{D680272C-7297-408E-83FD-BF567FB8C64D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{D680272C-7297-408E-83FD-BF567FB8C64D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{D680272C-7297-408E-83FD-BF567FB8C64D}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {8F71AF48-2D3C-4954-ACE8-D850E6ABE6FF}
24+
EndGlobalSection
25+
EndGlobal

CompareBlazor/CompareBlazor/App.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Router AppAssembly="typeof(Program).Assembly" />
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<RestoreAdditionalProjectSources>
6+
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
7+
https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
8+
</RestoreAdditionalProjectSources>
9+
<LangVersion>7.3</LangVersion>
10+
<RazorLangVersion>3.0</RazorLangVersion>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview5-19227-01" />
15+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview5-19227-01" PrivateAssets="all" />
16+
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview5-19227-01" PrivateAssets="all" />
17+
</ItemGroup>
18+
19+
</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+
@functions {
10+
int currentCount = 0;
11+
12+
void IncrementCount()
13+
{
14+
currentCount++;
15+
}
16+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@page "/fetchdata"
2+
@inject HttpClient Http
3+
4+
<h1>Weather forecast</h1>
5+
6+
<p>This component demonstrates fetching data from the server.</p>
7+
8+
@if (forecasts == null)
9+
{
10+
<p><em>Loading...</em></p>
11+
}
12+
else
13+
{
14+
<table class="table">
15+
<thead>
16+
<tr>
17+
<th>Date</th>
18+
<th>Temp. (C)</th>
19+
<th>Temp. (F)</th>
20+
<th>Summary</th>
21+
</tr>
22+
</thead>
23+
<tbody>
24+
@foreach (var forecast in forecasts)
25+
{
26+
<tr>
27+
<td>@forecast.Date.ToShortDateString()</td>
28+
<td>@forecast.TemperatureC</td>
29+
<td>@forecast.TemperatureF</td>
30+
<td>@forecast.Summary</td>
31+
</tr>
32+
}
33+
</tbody>
34+
</table>
35+
}
36+
37+
@functions {
38+
WeatherForecast[] forecasts;
39+
40+
protected override async Task OnInitAsync()
41+
{
42+
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("sample-data/weather.json");
43+
}
44+
45+
class WeatherForecast
46+
{
47+
public DateTime Date { get; set; }
48+
49+
public int TemperatureC { get; set; }
50+
51+
public int TemperatureF { get; set; }
52+
53+
public string Summary { get; set; }
54+
}
55+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@page "/"
2+
3+
<h1>Reset Password</h1>
4+
<h2>@result</h2>
5+
<EditForm onvalidsubmit="@submit" model="@model">
6+
<DataAnnotationsValidator />
7+
<label>New Password</label>
8+
<InputText class="form-control" bind-Value="@model.NewPassword" />
9+
<ValidationMessage For="@(() => model.NewPassword)" />
10+
<label>Confirm New Password</label>
11+
<InputText class="form-control" bind-Value="@model.ConfirmNewPassword" />
12+
<ValidationMessage For="@(() => model.ConfirmNewPassword)" />
13+
<button class="btn btn-primary" type="submit">submit</button>
14+
</EditForm>
15+
16+
@functions
17+
{
18+
private ResetPasswordModel model = new ResetPasswordModel();
19+
private string result = "";
20+
21+
public void submit()
22+
{
23+
result = "Form Submitted";
24+
StateHasChanged();
25+
}
26+
27+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@layout MainLayout
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 CompareBlazor
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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
7+
namespace CompareBlazor
8+
{
9+
public class ResetPasswordModel
10+
{
11+
12+
[Required]
13+
[Display(Name = "New Password")]
14+
[StringLength(20, MinimumLength = 6)]
15+
[DataType(DataType.Password)]
16+
public string NewPassword { get; set; }
17+
18+
[Required]
19+
[Display(Name = "Confirm New Password")]
20+
[DataType(DataType.Password)]
21+
[Compare(nameof(NewPassword),
22+
ErrorMessage = "The password and confirmation password do not match.")]
23+
public string ConfirmNewPassword { get; set; }
24+
25+
}
26+
}
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>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<div class="top-row pl-4 navbar navbar-dark">
2+
<a class="navbar-brand" href="">CompareBlazor</a>
3+
<button class="navbar-toggler" onclick="@ToggleNavMenu">
4+
<span class="navbar-toggler-icon"></span>
5+
</button>
6+
</div>
7+
8+
<div class="@NavMenuCssClass" onclick="@ToggleNavMenu">
9+
<ul class="nav flex-column">
10+
<li class="nav-item px-3">
11+
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
12+
<span class="oi oi-home" aria-hidden="true"></span> Home
13+
</NavLink>
14+
</li>
15+
<li class="nav-item px-3">
16+
<NavLink class="nav-link" href="counter">
17+
<span class="oi oi-plus" aria-hidden="true"></span> Counter
18+
</NavLink>
19+
</li>
20+
<li class="nav-item px-3">
21+
<NavLink class="nav-link" href="fetchdata">
22+
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
23+
</NavLink>
24+
</li>
25+
</ul>
26+
</div>
27+
28+
@functions {
29+
bool collapseNavMenu = true;
30+
31+
string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
32+
33+
void ToggleNavMenu()
34+
{
35+
collapseNavMenu = !collapseNavMenu;
36+
}
37+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<div class="alert alert-secondary mt-4" role="alert">
2+
<span class="oi oi-pencil mr-2" aria-hidden="true"></span>
3+
<strong>@Title</strong>
4+
5+
<span class="text-nowrap">
6+
Please take our
7+
<a target="_blank" class="font-weight-bold" href="https://go.microsoft.com/fwlink/?linkid=2086020">brief survey</a>
8+
</span>
9+
and tell us what you think.
10+
</div>
11+
12+
@functions {
13+
// Demonstrates how a parent component can supply parameters
14+
[Parameter] string Title { get; set; }
15+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.AspNetCore.Components.Builder;
2+
using Microsoft.Extensions.DependencyInjection;
3+
4+
namespace CompareBlazor
5+
{
6+
public class Startup
7+
{
8+
public void ConfigureServices(IServiceCollection services)
9+
{
10+
}
11+
12+
public void Configure(IComponentsApplicationBuilder app)
13+
{
14+
app.AddComponent<App>("app");
15+
}
16+
}
17+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@using System.Net.Http
2+
@using Microsoft.AspNetCore.Components.Forms
3+
@using Microsoft.AspNetCore.Components.Layouts
4+
@using Microsoft.AspNetCore.Components.Routing
5+
@using Microsoft.JSInterop
6+
@using CompareBlazor
7+
@using CompareBlazor.Shared

CompareBlazor/CompareBlazor/wwwroot/css/bootstrap/bootstrap.min.css

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CompareBlazor/CompareBlazor/wwwroot/css/bootstrap/bootstrap.min.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
SIL OPEN FONT LICENSE Version 1.1
2+
3+
Copyright (c) 2014 Waybury
4+
5+
PREAMBLE
6+
The goals of the Open Font License (OFL) are to stimulate worldwide
7+
development of collaborative font projects, to support the font creation
8+
efforts of academic and linguistic communities, and to provide a free and
9+
open framework in which fonts may be shared and improved in partnership
10+
with others.
11+
12+
The OFL allows the licensed fonts to be used, studied, modified and
13+
redistributed freely as long as they are not sold by themselves. The
14+
fonts, including any derivative works, can be bundled, embedded,
15+
redistributed and/or sold with any software provided that any reserved
16+
names are not used by derivative works. The fonts and derivatives,
17+
however, cannot be released under any other type of license. The
18+
requirement for fonts to remain under this license does not apply
19+
to any document created using the fonts or their derivatives.
20+
21+
DEFINITIONS
22+
"Font Software" refers to the set of files released by the Copyright
23+
Holder(s) under this license and clearly marked as such. This may
24+
include source files, build scripts and documentation.
25+
26+
"Reserved Font Name" refers to any names specified as such after the
27+
copyright statement(s).
28+
29+
"Original Version" refers to the collection of Font Software components as
30+
distributed by the Copyright Holder(s).
31+
32+
"Modified Version" refers to any derivative made by adding to, deleting,
33+
or substituting -- in part or in whole -- any of the components of the
34+
Original Version, by changing formats or by porting the Font Software to a
35+
new environment.
36+
37+
"Author" refers to any designer, engineer, programmer, technical
38+
writer or other person who contributed to the Font Software.
39+
40+
PERMISSION & CONDITIONS
41+
Permission is hereby granted, free of charge, to any person obtaining
42+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
43+
redistribute, and sell modified and unmodified copies of the Font
44+
Software, subject to the following conditions:
45+
46+
1) Neither the Font Software nor any of its individual components,
47+
in Original or Modified Versions, may be sold by itself.
48+
49+
2) Original or Modified Versions of the Font Software may be bundled,
50+
redistributed and/or sold with any software, provided that each copy
51+
contains the above copyright notice and this license. These can be
52+
included either as stand-alone text files, human-readable headers or
53+
in the appropriate machine-readable metadata fields within text or
54+
binary files as long as those fields can be easily viewed by the user.
55+
56+
3) No Modified Version of the Font Software may use the Reserved Font
57+
Name(s) unless explicit written permission is granted by the corresponding
58+
Copyright Holder. This restriction only applies to the primary font name as
59+
presented to the users.
60+
61+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
62+
Software shall not be used to promote, endorse or advertise any
63+
Modified Version, except to acknowledge the contribution(s) of the
64+
Copyright Holder(s) and the Author(s) or with their explicit written
65+
permission.
66+
67+
5) The Font Software, modified or unmodified, in part or in whole,
68+
must be distributed entirely under this license, and must not be
69+
distributed under any other license. The requirement for fonts to
70+
remain under this license does not apply to any document created
71+
using the Font Software.
72+
73+
TERMINATION
74+
This license becomes null and void if any of the above conditions are
75+
not met.
76+
77+
DISCLAIMER
78+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
79+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
80+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
81+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
82+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
83+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
84+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
85+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
86+
OTHER DEALINGS IN THE FONT SOFTWARE.

0 commit comments

Comments
 (0)