Skip to content

Commit bc42773

Browse files
authored
Net6 Support (#66)
* Add net6 monikers, temporary dependency list in WorkerProxy * Add net6 monikers, temporary dependency list in WorkerProxy * Working! Almost ready for a pre-release here. * Update deps to 6, consistent pre-compiler IF * Full test suite for .NET 6 Fixed Failing IoC Examples
1 parent 69dcb9b commit bc42773

File tree

89 files changed

+2831
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2831
-130
lines changed

src/BlazorWorker.Demo.IoCExample/BlazorWorker.Demo.IoCExample.csproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.1;net5.0;net6.0</TargetFrameworks>
55
<Configurations>Debug;Release;Nuget</Configurations>
66
</PropertyGroup>
77

8-
<ItemGroup>
8+
<ItemGroup Condition="'$(TargetFramework)'=='net5.0'">
99
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
10+
</ItemGroup>
11+
12+
<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
13+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
1017
<PackageReference Include="TG.Blazor.IndexedDB" Version="1.5.0-preview" />
1118
</ItemGroup>
1219

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Router AppAssembly="@typeof(App).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
5+
</Found>
6+
<NotFound>
7+
<PageTitle>Not found</PageTitle>
8+
<LayoutView Layout="@typeof(MainLayout)">
9+
<p role="alert">Sorry, there's nothing at this address.</p>
10+
</LayoutView>
11+
</NotFound>
12+
</Router>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.1" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.1" PrivateAssets="all" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\..\..\SharedPages\BlazorWorker.Demo.SharedPages.csproj" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<Content Update="Pages\Index.razor">
20+
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
21+
</Content>
22+
<Content Update="wwwroot\favicon.ico">
23+
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
24+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
25+
</Content>
26+
</ItemGroup>
27+
28+
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@page "/BackgroundServiceMulti"
2+
<BlazorWorker.Demo.SharedPages.Pages.BackgroundServiceMulti />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@page "/CoreExample"
2+
<BlazorWorker.Demo.SharedPages.Pages.CoreExample />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@page "/Http"
2+
<BlazorWorker.Demo.SharedPages.Pages.Http />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@page "/"
2+
<BlazorWorker.Demo.SharedPages.Pages.Index />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@page "/IndexedDB"
2+
<BlazorWorker.Demo.SharedPages.Pages.IndexedDb />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@page "/IoCExample"
2+
<BlazorWorker.Demo.SharedPages.Pages.IoCExamplePage />
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using BlazorWorker.Core;
2+
using BlazorWorker.Demo.Client;
3+
using BlazorWorker.Demo.IoCExample;
4+
using Microsoft.AspNetCore.Components.Web;
5+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
6+
7+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
8+
builder.RootComponents.Add<App>("#app");
9+
builder.RootComponents.Add<HeadOutlet>("head::after");
10+
11+
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
12+
builder.Services.AddWorkerFactory();
13+
builder.Services.AddIndexedDbDemoPersonConfig();
14+
15+
await builder.Build().RunAsync();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
<div class="sidebar">
5+
<NavMenu />
6+
</div>
7+
8+
<main>
9+
<article class="content px-4">
10+
@Body
11+
</article>
12+
</main>
13+
</div>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
.page {
2+
position: relative;
3+
display: flex;
4+
flex-direction: column;
5+
}
6+
7+
main {
8+
flex: 1;
9+
}
10+
11+
.sidebar {
12+
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
13+
}
14+
15+
.top-row {
16+
background-color: #f7f7f7;
17+
border-bottom: 1px solid #d6d5d5;
18+
justify-content: flex-end;
19+
height: 3.5rem;
20+
display: flex;
21+
align-items: center;
22+
}
23+
24+
.top-row ::deep a, .top-row ::deep .btn-link {
25+
white-space: nowrap;
26+
margin-left: 1.5rem;
27+
text-decoration: none;
28+
}
29+
30+
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
31+
text-decoration: underline;
32+
}
33+
34+
.top-row ::deep a:first-child {
35+
overflow: hidden;
36+
text-overflow: ellipsis;
37+
}
38+
39+
@media (max-width: 640.98px) {
40+
.top-row:not(.auth) {
41+
display: none;
42+
}
43+
44+
.top-row.auth {
45+
justify-content: space-between;
46+
}
47+
48+
.top-row ::deep a, .top-row ::deep .btn-link {
49+
margin-left: 0;
50+
}
51+
}
52+
53+
@media (min-width: 641px) {
54+
.page {
55+
flex-direction: row;
56+
}
57+
58+
.sidebar {
59+
width: 250px;
60+
height: 100vh;
61+
position: sticky;
62+
top: 0;
63+
}
64+
65+
.top-row {
66+
position: sticky;
67+
top: 0;
68+
z-index: 1;
69+
}
70+
71+
.top-row.auth ::deep a:first-child {
72+
flex: 1;
73+
text-align: right;
74+
width: 0;
75+
}
76+
77+
.top-row, article {
78+
padding-left: 2rem !important;
79+
padding-right: 1.5rem !important;
80+
}
81+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<div class="top-row ps-3 navbar navbar-dark">
2+
<div class="container-fluid">
3+
<a class="navbar-brand" href="">BlazorWorker Demo</a>
4+
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
5+
<span class="navbar-toggler-icon"></span>
6+
</button>
7+
</div>
8+
</div>
9+
10+
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
11+
<nav class="flex-column">
12+
@foreach(var navlink in BlazorWorker.Demo.SharedPages.Shared.NavMenuLinksModel.NavMenuLinks) {
13+
<div class="nav-item px-3">
14+
<BlazorWorker.Demo.SharedPages.Shared.NavMenuLink Model=navlink/>
15+
</div>
16+
}
17+
</nav>
18+
</div>
19+
20+
@code {
21+
private bool collapseNavMenu = true;
22+
23+
private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
24+
25+
private void ToggleNavMenu()
26+
{
27+
collapseNavMenu = !collapseNavMenu;
28+
}
29+
30+
}
31+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.navbar-toggler {
2+
background-color: rgba(255, 255, 255, 0.1);
3+
}
4+
5+
.top-row {
6+
height: 3.5rem;
7+
background-color: rgba(0,0,0,0.4);
8+
}
9+
10+
.navbar-brand {
11+
font-size: 1.1rem;
12+
}
13+
14+
.oi {
15+
width: 2rem;
16+
font-size: 1.1rem;
17+
vertical-align: text-top;
18+
top: -2px;
19+
}
20+
21+
.nav-item {
22+
font-size: 0.9rem;
23+
padding-bottom: 0.5rem;
24+
}
25+
26+
.nav-item:first-of-type {
27+
padding-top: 1rem;
28+
}
29+
30+
.nav-item:last-of-type {
31+
padding-bottom: 1rem;
32+
}
33+
34+
.nav-item ::deep a {
35+
color: #d7d7d7;
36+
border-radius: 4px;
37+
height: 3rem;
38+
display: flex;
39+
align-items: center;
40+
line-height: 3rem;
41+
}
42+
43+
.nav-item ::deep a.active {
44+
background-color: rgba(255,255,255,0.25);
45+
color: white;
46+
}
47+
48+
.nav-item ::deep a:hover {
49+
background-color: rgba(255,255,255,0.1);
50+
color: white;
51+
}
52+
53+
@media (min-width: 641px) {
54+
.navbar-toggler {
55+
display: none;
56+
}
57+
58+
.collapse {
59+
/* Never collapse the sidebar for wide screens */
60+
display: block;
61+
}
62+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<div class="alert alert-secondary mt-4">
2+
<span class="oi oi-pencil me-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 link-dark" href="https://go.microsoft.com/fwlink/?linkid=2148851">brief survey</a>
8+
</span>
9+
and tell us what you think.
10+
</div>
11+
12+
@code {
13+
// Demonstrates how a parent component can supply parameters
14+
[Parameter]
15+
public string? Title { get; set; }
16+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@using System.Net.Http
2+
@using System.Net.Http.Json
3+
@using Microsoft.AspNetCore.Components.Forms
4+
@using Microsoft.AspNetCore.Components.Routing
5+
@using Microsoft.AspNetCore.Components.Web
6+
@using Microsoft.AspNetCore.Components.Web.Virtualization
7+
@using Microsoft.AspNetCore.Components.WebAssembly.Http
8+
@using Microsoft.JSInterop
9+
@using BlazorWorker.Demo.Client
10+
@using BlazorWorker.Demo.Client.Shared
11+

src/BlazorWorker.Demo/Net6/Client/BlazorWorker.Demo.Client/wwwroot/.nojekyll

Whitespace-only changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>BlazorFileReader</title>
6+
<script type="text/javascript">
7+
// Single Page Apps for GitHub Pages
8+
// https://github.com/rafrex/spa-github-pages
9+
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License
10+
// ----------------------------------------------------------------------
11+
// This script takes the current url and converts the path and query
12+
// string into just a query string, and then redirects the browser
13+
// to the new url with only a query string and hash fragment,
14+
// e.g. http://www.foo.tld/one/two?a=b&c=d#qwe, becomes
15+
// http://www.foo.tld/?p=/one/two&q=a=b~and~c=d#qwe
16+
// Note: this 404.html file must be at least 512 bytes for it to work
17+
// with Internet Explorer (it is currently > 512 bytes)
18+
19+
// If you're creating a Project Pages site and NOT using a custom domain,
20+
// then set segmentCount to 1 (enterprise users may need to set it to > 1).
21+
// This way the code will only replace the route part of the path, and not
22+
// the real directory in which the app resides, for example:
23+
// https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes
24+
// https://username.github.io/repo-name/?p=/one/two&q=a=b~and~c=d#qwe
25+
// Otherwise, leave segmentCount as 0.
26+
var segmentCount = 1;
27+
28+
var l = window.location;
29+
l.replace(
30+
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
31+
l.pathname.split('/').slice(0, 1 + segmentCount).join('/') + '/?p=/' +
32+
l.pathname.slice(1).split('/').slice(segmentCount).join('/').replace(/&/g, '~and~') +
33+
(l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
34+
l.hash
35+
);
36+
37+
</script>
38+
</head>
39+
<body>
40+
</body>
41+
</html>

0 commit comments

Comments
 (0)