Skip to content

Commit

Permalink
Merge pull request #378 from runceel/main
Browse files Browse the repository at this point in the history
Release v8.1.0
  • Loading branch information
runceel authored Apr 30, 2022
2 parents 23cc02a + 68aa917 commit 80f23f2
Show file tree
Hide file tree
Showing 111 changed files with 3,532 additions and 223 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:
if: github.ref != 'refs/heads/release'
shell: pwsh
run: |
$doc = [XML](Get-Content 'Source\SharedProperties.csproj')
$doc = [XML](Get-Content 'Source\Directory.Build.props')
$doc.Project.PropertyGroup.Version += '-pre' + (Get-Date).ToString("yyyyMMddHHmm")
$doc.Save('Source\SharedProperties.csproj')
$doc.Save('Source\Directory.Build.props')
- name: Set version to outputs
id: set-version-to-output
shell: pwsh
run: |
$doc = [XML](Get-Content 'Source\SharedProperties.csproj')
$doc = [XML](Get-Content 'Source\Directory.Build.props')
echo "::set-output name=version::$($doc.Project.PropertyGroup.Version)"
- name: Install dependencies
run: dotnet restore ReactiveProperty.sln
Expand Down
30 changes: 30 additions & 0 deletions ReactiveProperty-Samples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MultiUIThread", "MultiUIThr
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultiUIThreadApp", "Samples\MultiUIThreadApp\MultiUIThreadApp.csproj", "{CE48575B-F749-4337-9F6B-C2E650D2A297}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Blazor", "Blazor", "{FED0F033-DD46-4A15-9041-999813FECF73}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorServerApp", "Samples\Blazor\BlazorServerApp\BlazorServerApp.csproj", "{8DE66105-1318-4606-A702-70A78754E036}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorWasmApp", "Samples\Blazor\BlazorWasmApp\BlazorWasmApp.csproj", "{43DD55EB-1220-47D5-8F08-1F0989D8B0F6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorSample.Shared", "Samples\Blazor\BlazorSample.Shared\BlazorSample.Shared.csproj", "{EE15634D-C8A7-40DD-B966-6695A2ECA1E1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveProperty.Platform.Blazor", "Source\ReactiveProperty.Platform.Blazor\ReactiveProperty.Platform.Blazor.csproj", "{3CF8E744-40E0-4874-B82D-1B3AD2523043}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Source\ReactiveProperty.Platform.Shared\ReactiveProperty.Platform.Shared.projitems*{ff52758c-f5fb-49c9-8dee-e4a7dfba4dc1}*SharedItemsImports = 5
Expand Down Expand Up @@ -68,6 +78,22 @@ Global
{CE48575B-F749-4337-9F6B-C2E650D2A297}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE48575B-F749-4337-9F6B-C2E650D2A297}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE48575B-F749-4337-9F6B-C2E650D2A297}.Release|Any CPU.Build.0 = Release|Any CPU
{8DE66105-1318-4606-A702-70A78754E036}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8DE66105-1318-4606-A702-70A78754E036}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8DE66105-1318-4606-A702-70A78754E036}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8DE66105-1318-4606-A702-70A78754E036}.Release|Any CPU.Build.0 = Release|Any CPU
{43DD55EB-1220-47D5-8F08-1F0989D8B0F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43DD55EB-1220-47D5-8F08-1F0989D8B0F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43DD55EB-1220-47D5-8F08-1F0989D8B0F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43DD55EB-1220-47D5-8F08-1F0989D8B0F6}.Release|Any CPU.Build.0 = Release|Any CPU
{EE15634D-C8A7-40DD-B966-6695A2ECA1E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE15634D-C8A7-40DD-B966-6695A2ECA1E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE15634D-C8A7-40DD-B966-6695A2ECA1E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE15634D-C8A7-40DD-B966-6695A2ECA1E1}.Release|Any CPU.Build.0 = Release|Any CPU
{3CF8E744-40E0-4874-B82D-1B3AD2523043}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3CF8E744-40E0-4874-B82D-1B3AD2523043}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CF8E744-40E0-4874-B82D-1B3AD2523043}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CF8E744-40E0-4874-B82D-1B3AD2523043}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -81,6 +107,10 @@ Global
{DC6C40F1-3978-406B-B2EA-55D170037B6F} = {FB70FEE7-6672-421D-A285-8C6FC34B443C}
{B4A8A828-132C-4DBC-9046-EFD9BFAA56FC} = {FB70FEE7-6672-421D-A285-8C6FC34B443C}
{CE48575B-F749-4337-9F6B-C2E650D2A297} = {4A35B740-ADFA-4CBF-9769-9222A68AD42A}
{8DE66105-1318-4606-A702-70A78754E036} = {FED0F033-DD46-4A15-9041-999813FECF73}
{43DD55EB-1220-47D5-8F08-1F0989D8B0F6} = {FED0F033-DD46-4A15-9041-999813FECF73}
{EE15634D-C8A7-40DD-B966-6695A2ECA1E1} = {FED0F033-DD46-4A15-9041-999813FECF73}
{3CF8E744-40E0-4874-B82D-1B3AD2523043} = {69BB0C02-5C1E-4720-AC3E-61E25B9F0143}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C0F7AB85-D9AA-401B-9DAE-0C5394272D48}
Expand Down
66 changes: 66 additions & 0 deletions ReactiveProperty.sln
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveProperty.NETStandar
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveProperty.WPF.Tests", "Test\ReactiveProperty.WPF.Tests\ReactiveProperty.WPF.Tests.csproj", "{BDB9A031-5463-4C47-8990-0D27A31DFE91}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveProperty.Platform.Blazor", "Source\ReactiveProperty.Platform.Blazor\ReactiveProperty.Platform.Blazor.csproj", "{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveProperty.Blazor.Tests", "Test\ReactiveProperty.Blazor.Tests\ReactiveProperty.Blazor.Tests.csproj", "{3E78E840-14B6-407F-80D6-F6F25C5A979B}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Source\ReactiveProperty.Platform.Shared\ReactiveProperty.Platform.Shared.projitems*{523e5506-24df-44ca-83cc-6aa02454f150}*SharedItemsImports = 13
Expand Down Expand Up @@ -316,6 +320,66 @@ Global
{BDB9A031-5463-4C47-8990-0D27A31DFE91}.Release|x64.Build.0 = Release|Any CPU
{BDB9A031-5463-4C47-8990-0D27A31DFE91}.Release|x86.ActiveCfg = Release|Any CPU
{BDB9A031-5463-4C47-8990-0D27A31DFE91}.Release|x86.Build.0 = Release|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Debug|ARM.Build.0 = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Debug|x64.ActiveCfg = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Debug|x64.Build.0 = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Debug|x86.ActiveCfg = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Debug|x86.Build.0 = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Documentation|Any CPU.ActiveCfg = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Documentation|Any CPU.Build.0 = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Documentation|ARM.ActiveCfg = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Documentation|ARM.Build.0 = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Documentation|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Documentation|Mixed Platforms.Build.0 = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Documentation|x64.ActiveCfg = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Documentation|x64.Build.0 = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Documentation|x86.ActiveCfg = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Documentation|x86.Build.0 = Debug|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Release|Any CPU.Build.0 = Release|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Release|ARM.ActiveCfg = Release|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Release|ARM.Build.0 = Release|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Release|x64.ActiveCfg = Release|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Release|x64.Build.0 = Release|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Release|x86.ActiveCfg = Release|Any CPU
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC}.Release|x86.Build.0 = Release|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Debug|ARM.Build.0 = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Debug|x64.ActiveCfg = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Debug|x64.Build.0 = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Debug|x86.ActiveCfg = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Debug|x86.Build.0 = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Documentation|Any CPU.ActiveCfg = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Documentation|Any CPU.Build.0 = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Documentation|ARM.ActiveCfg = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Documentation|ARM.Build.0 = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Documentation|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Documentation|Mixed Platforms.Build.0 = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Documentation|x64.ActiveCfg = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Documentation|x64.Build.0 = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Documentation|x86.ActiveCfg = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Documentation|x86.Build.0 = Debug|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Release|Any CPU.Build.0 = Release|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Release|ARM.ActiveCfg = Release|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Release|ARM.Build.0 = Release|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Release|x64.ActiveCfg = Release|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Release|x64.Build.0 = Release|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Release|x86.ActiveCfg = Release|Any CPU
{3E78E840-14B6-407F-80D6-F6F25C5A979B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -331,6 +395,8 @@ Global
{74DCF7CF-5639-4BEC-9064-C39EDC26C1DE} = {592AA479-AD7F-476B-AEF8-2B0268EA3BD8}
{30D6C298-9EE3-4185-AEAF-18EC93B0C087} = {6B13388E-F781-4F55-AF8B-2E991EA59DB8}
{BDB9A031-5463-4C47-8990-0D27A31DFE91} = {6B13388E-F781-4F55-AF8B-2E991EA59DB8}
{B9C47D43-2EBE-4750-9C67-7FABF5D3A0BC} = {592AA479-AD7F-476B-AEF8-2B0268EA3BD8}
{3E78E840-14B6-407F-80D6-F6F25C5A979B} = {6B13388E-F781-4F55-AF8B-2E991EA59DB8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5AC43AC2-86FE-46EF-B243-5C8E75EAB89B}
Expand Down
17 changes: 17 additions & 0 deletions Samples/Blazor/BlazorSample.Shared/BlazorSample.Shared.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.4" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Source\ReactiveProperty.Platform.Blazor\ReactiveProperty.Platform.Blazor.csproj" />
</ItemGroup>
</Project>
78 changes: 78 additions & 0 deletions Samples/Blazor/BlazorSample.Shared/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
@using Reactive.Bindings
@using Reactive.Bindings.Extensions
@using Reactive.Bindings.Components
@using System.Reactive.Linq
@using System.Reactive.Disposables
@using System.Reactive.Concurrency
@page "/"
@implements IDisposable
@inject ValidationViewModel _validationViewModel
@inject HelloWorldViewModel _helloWorldViewModel

<h1>ReactiveProperty samples</h1>

<h3>Hello world</h3>

<input class="form-control" type="text" @bind="_helloWorldViewModel.Input.Value" @bind:event="oninput" />
<div class="alert alert-primary">
@_helloWorldViewModel.Output.Value
</div>

<h3>Validation sample</h3>

<EditForm Model="_validationViewModel" OnInvalidSubmit="InvalidSubmit" OnValidSubmit="ValidSubmit">
<ReactivePropertiesValidator />

<ValidationSummary />

<div class="mb-3">
<label for="firstName">First name</label>
<InputText @bind-Value="_validationViewModel.FirstName.Value" class="form-control" />
<ValidationMessage For="() => _validationViewModel.FirstName.Value" />
</div>
<div class="mb-3">
<label for="firstName">Last name</label>
<InputText @bind-Value="_validationViewModel.LastName.Value" class="form-control" />
<ValidationMessage For="() => _validationViewModel.LastName.Value" />
</div>

<div class="mb-3">
<span>Full name: @_validationViewModel.FullName.Value</span>
</div>

<button type="submit" class="btn btn-primary">Submit</button>
</EditForm>

@if (!string.IsNullOrEmpty(_message))
{
<div class="alert alert-primary">
<span>@_message</span>
</div>
}

@code {
private readonly CompositeDisposable _disposable = new();
private string? _message;

private void InvalidSubmit(EditContext context)
{
_message = "InvalidSubmit was invoked.";
}

private void ValidSubmit(EditContext context)
{
_message = "ValidSubmit was invoked.";
}

protected override void OnInitialized()
{
_validationViewModel.AddTo(_disposable);
_helloWorldViewModel.AddTo(_disposable);

_helloWorldViewModel.Output
.Subscribe(_ => InvokeAsync(StateHasChanged))
.AddTo(_disposable);
}

public void Dispose() => _disposable.Dispose();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Reactive.Bindings;
using Reactive.Bindings.Extensions;

namespace BlazorSample.Shared.ViewModels;

public class HelloWorldViewModel : IDisposable
{
private readonly CompositeDisposable _disposable = new();

public ReactivePropertySlim<string> Input { get; }
public ReadOnlyReactivePropertySlim<string> Output { get; }

public HelloWorldViewModel()
{
Input = new ReactivePropertySlim<string>("")
.AddTo(_disposable);
Output = Input
.Select(x => x.ToUpperInvariant())
.ToReadOnlyReactivePropertySlim("")
.AddTo(_disposable);
}

public void Dispose() => _disposable.Dispose();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.ComponentModel.DataAnnotations;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Reactive.Bindings;
using Reactive.Bindings.Extensions;

namespace BlazorSample.Shared.ViewModels;

public class ValidationViewModel : IDisposable
{
private readonly CompositeDisposable _disposables = new();

[Required(ErrorMessage = "First name is required.")]
[StringLength(10, ErrorMessage = "First name is under 10 letters.")]
public ReactiveProperty<string> FirstName { get; }
[Required(ErrorMessage = "Last name is required.")]
[StringLength(10, ErrorMessage = "Last name is under 10 letters.")]
public ReactiveProperty<string> LastName { get; }
public ReadOnlyReactivePropertySlim<string> FullName { get; }

public ValidationViewModel()
{
var reactivePropertyMode = ReactivePropertyMode.Default | ReactivePropertyMode.IgnoreInitialValidationError;
FirstName = new ReactiveProperty<string>("", mode: reactivePropertyMode)
.SetValidateAttribute(() => FirstName)
.AddTo(_disposables);
LastName = new ReactiveProperty<string>("", mode: reactivePropertyMode)
.SetValidateAttribute(() => LastName)
.AddTo(_disposables);

FullName = Observable.CombineLatest(new[] { FirstName, LastName }, x => $"{x[0]} {x[1]}")
.ToReadOnlyReactivePropertySlim("")
.AddTo(_disposables);
}

public void Dispose() => _disposables.Dispose();
}
8 changes: 8 additions & 0 deletions Samples/Blazor/BlazorSample.Shared/_Imports.razor
Original file line number Diff line number Diff line change
@@ -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 Microsoft.AspNetCore.Components.Web.Virtualization
@using BlazorSample.Shared
@using BlazorSample.Shared.ViewModels
13 changes: 13 additions & 0 deletions Samples/Blazor/BlazorServerApp/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@using BlazorSample.Shared.ViewModels
<Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="@(new[]{ typeof(ValidationViewModel).Assembly })">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
13 changes: 13 additions & 0 deletions Samples/Blazor/BlazorServerApp/BlazorServerApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BlazorSample.Shared\BlazorSample.Shared.csproj" />
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions Samples/Blazor/BlazorServerApp/Data/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace BlazorServerApp.Data
{
public class WeatherForecast
{
public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string? Summary { get; set; }
}
}
20 changes: 20 additions & 0 deletions Samples/Blazor/BlazorServerApp/Data/WeatherForecastService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace BlazorServerApp.Data
{
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
{
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
}).ToArray());
}
}
}
Loading

0 comments on commit 80f23f2

Please sign in to comment.