Scenario Templates

This commit is contained in:
Norm Rasmussen
2022-07-08 09:20:13 -04:00
parent bc5e115c1a
commit 75b0a2c0de
980 changed files with 6815 additions and 118944 deletions

View File

@ -1,5 +0,0 @@
{
"version": 1,
"isRoot": true,
"tools": {}
}

View File

@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<WasmBuildNative>true</WasmBuildNative>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.4" PrivateAssets="all" />
<PackageReference Include="SqliteWasmHelper" Version="1.0.43-beta-g31b50d1f54" />
<PackageReference Include="Radzen.Blazor" Version="3.18.15" />
<PackageReference Include="sqlite-helper" Version="1.3.0" />
</ItemGroup>
</Project>

View File

@ -1,12 +0,0 @@
<Router AppAssembly="@typeof(App).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>

View File

@ -1,8 +0,0 @@
namespace Account_SQLite.Data
{
public class Account
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
}
}

View File

@ -1,14 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace Account_SQLite.Data
{
public class AccountContext : DbContext
{
public AccountContext(DbContextOptions<AccountContext> opts): base(opts)
{
}
public DbSet<Account> Accounts { get; set; } = null!;
}
}

View File

@ -1,73 +0,0 @@
@page "/"
@using SqliteWasmHelper
@using Account_SQLite.Data
@using Microsoft.EntityFrameworkCore
@inject ISqliteWasmDbContextFactory<AccountContext> Factory
<PageTitle>Account_SQLite</PageTitle>
<h1>Accounts</h1>
<p>Type some account:</p>
<input @bind="newAccount" disabled="@busy" />&nbsp;
<button @onclick="@(async () => await AddAccountAsync())" disabled="@busy">Add</button>
@if (@busy)
{
<div class="alert alert-info">đź’ľ Scanning a floppy disk...</div>
}
else
{
if (accounts.Length < 1)
{
<p>I see no-account.</p>
}
else
{
<ul>
@foreach (var account in accounts)
{
<li>@account.Name</li>
}
</ul>
}
}
Download backup:
<BackupLink @ref="bl" DbContextType="typeof(AccountContext)" />
@code {
private bool busy;
private BackupLink bl = null!;
private string newAccount = string.Empty;
private Account[] accounts = Array.Empty<Account>();
protected override async Task OnInitializedAsync()
{
await RefreshUiAsync();
await base.OnInitializedAsync();
}
private async Task RefreshUiAsync()
{
using var ctx = await Factory.CreateDbContextAsync();
busy = true;
accounts = await ctx.Accounts.ToArrayAsync();
await bl.RefreshAsync();
busy = false;
StateHasChanged();
}
private async Task AddAccountAsync()
{
if (!string.IsNullOrWhiteSpace(newAccount))
{
using var ctx = await Factory.CreateDbContextAsync();
ctx.Accounts.Add(new Account { Name = newAccount });
busy = true;
await ctx.SaveChangesAsync();
newAccount = string.Empty;
busy = false;
await RefreshUiAsync();
}
}
}

View File

@ -1,2 +0,0 @@
@page "/"
@using Account_SQLite.Pages

View File

@ -1,2 +0,0 @@
@using Microsoft.AspNetCore.Components.Web
@using Account_SQLite.Pages

View File

@ -1,18 +0,0 @@
using Account_SQLite;
using Account_SQLite.Data;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.EntityFrameworkCore;
using SqliteWasmHelper;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddSqliteWasmDbContextFactory<AccountContext>(
opts => opts.UseSqlite("Data Source=blazor_todo.sqlite3"));
await builder.Build().RunAsync();
var app = builder.Build();

View File

@ -1,30 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:16190",
"sslPort": 44329
}
},
"profiles": {
"Account_SQLite": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7055;http://localhost:5280",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -1,17 +0,0 @@
@inherits LayoutComponentBase
<div class="page">
<div class="sidebar">
<NavMenu />
</div>
<main>
<div class="top-row px-4">
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
</div>
<article class="content px-4">
@Body
</article>
</main>
</div>

View File

@ -1,81 +0,0 @@
.page {
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
}
.sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
}
.top-row ::deep a, .top-row ::deep .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
}
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
text-decoration: underline;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 640.98px) {
.top-row:not(.auth) {
display: none;
}
.top-row.auth {
justify-content: space-between;
}
.top-row ::deep a, .top-row ::deep .btn-link {
margin-left: 0;
}
}
@media (min-width: 641px) {
.page {
flex-direction: row;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row, article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}

View File

@ -1,39 +0,0 @@
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">BlazorWasmExample</a>
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</div>
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Home
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="counter">
<span class="oi oi-plus" aria-hidden="true"></span> Counter
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="fetchdata">
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
</NavLink>
</div>
</nav>
</div>
@code {
private bool collapseNavMenu = true;
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
private void ToggleNavMenu()
{
collapseNavMenu = !collapseNavMenu;
}
}

View File

@ -1,62 +0,0 @@
.navbar-toggler {
background-color: rgba(255, 255, 255, 0.1);
}
.top-row {
height: 3.5rem;
background-color: rgba(0,0,0,0.4);
}
.navbar-brand {
font-size: 1.1rem;
}
.oi {
width: 2rem;
font-size: 1.1rem;
vertical-align: text-top;
top: -2px;
}
.nav-item {
font-size: 0.9rem;
padding-bottom: 0.5rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
.nav-item ::deep a {
color: #d7d7d7;
border-radius: 4px;
height: 3rem;
display: flex;
align-items: center;
line-height: 3rem;
}
.nav-item ::deep a.active {
background-color: rgba(255,255,255,0.25);
color: white;
}
.nav-item ::deep a:hover {
background-color: rgba(255,255,255,0.1);
color: white;
}
@media (min-width: 641px) {
.navbar-toggler {
display: none;
}
.collapse {
/* Never collapse the sidebar for wide screens */
display: block;
}
}

View File

@ -1,10 +0,0 @@
@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 Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
@using Account_SQLite
@using Account_SQLite.Shared

View File

@ -1,9 +0,0 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@ -1 +0,0 @@
{"ContentRoots":["/Users/normrasmussen/Documents/Northpass/Account_SQLite/wwwroot/","/Users/normrasmussen/.nuget/packages/sqlitewasmhelper/1.0.43-beta-g31b50d1f54/staticwebassets/","/Users/normrasmussen/Documents/Northpass/Account_SQLite/obj/Debug/net6.0/scopedcss/bundle/"],"Root":{"Children":{"browserCache.js":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"browserCache.js"},"Patterns":null},"css":{"Children":{"app.css":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/app.css"},"Patterns":null},"bootstrap":{"Children":{"bootstrap.min.css":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/bootstrap/bootstrap.min.css"},"Patterns":null},"bootstrap.min.css.map":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/bootstrap/bootstrap.min.css.map"},"Patterns":null}},"Asset":null,"Patterns":null},"open-iconic":{"Children":{"FONT-LICENSE":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/open-iconic/FONT-LICENSE"},"Patterns":null},"font":{"Children":{"css":{"Children":{"open-iconic-bootstrap.min.css":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/open-iconic/font/css/open-iconic-bootstrap.min.css"},"Patterns":null}},"Asset":null,"Patterns":null},"fonts":{"Children":{"open-iconic.eot":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/open-iconic/font/fonts/open-iconic.eot"},"Patterns":null},"open-iconic.otf":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/open-iconic/font/fonts/open-iconic.otf"},"Patterns":null},"open-iconic.svg":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/open-iconic/font/fonts/open-iconic.svg"},"Patterns":null},"open-iconic.ttf":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/open-iconic/font/fonts/open-iconic.ttf"},"Patterns":null},"open-iconic.woff":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/open-iconic/font/fonts/open-iconic.woff"},"Patterns":null}},"Asset":null,"Patterns":null}},"Asset":null,"Patterns":null},"ICON-LICENSE":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/open-iconic/ICON-LICENSE"},"Patterns":null},"README.md":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"css/open-iconic/README.md"},"Patterns":null}},"Asset":null,"Patterns":null}},"Asset":null,"Patterns":null},"favicon.ico":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"favicon.ico"},"Patterns":null},"index.html":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"index.html"},"Patterns":null},"_content":{"Children":{"SqliteWasmHelper":{"Children":{"browserCache.js":{"Children":null,"Asset":{"ContentRootIndex":1,"SubPath":"browserCache.js"},"Patterns":null}},"Asset":null,"Patterns":null}},"Asset":null,"Patterns":null},"Account_SQLite.styles.css":{"Children":null,"Asset":{"ContentRootIndex":2,"SubPath":"Account_SQLite.styles.css"},"Patterns":null}},"Asset":null,"Patterns":[{"ContentRootIndex":0,"Pattern":"**","Depth":0}]}}

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More