blazor project for cs

This commit is contained in:
Norm Rasmussen
2022-06-13 08:50:32 -04:00
parent 6b46bc3f67
commit 2287bf6dac
949 changed files with 3335 additions and 24761 deletions

View File

@ -0,0 +1,92 @@
@page "/"
@using Blazorise.TreeView
<PageTitle>Accounts</PageTitle>
<body>
<div class="box-wrapper">
<div id="left-column">
<h3>Accounts</h3>
<TreeView
Nodes="Accounts"
GetChildNodes="@(accounts => accounts.Tasks)"
HasChildNodes="@(accounts => accounts.Children?.Any() == true)"
@bind-SelectedNode="selectedNode"
@bind-ExpandedNodes="ExpandedNodes" >
<NodeContent>@context.Text</NodeContent>
</TreeView>
<input placeholder = "Add Account" @bind="newAccount" />
<button>New Account</button>
<ul>
@foreach ( var account in accounts)
{
<li>@account.AccountName</li>
}
</ul>
</div>
<div class="middle-column">
<h3>Tasks</h3>
<h1> Complete: (@task.Count(task => !task.IsComplete)) </h1>
<input placeholder = "Add Task" @bind="newTask" />
<button>New Task</button>
<ul>
@foreach (var item in task)
{
<li>
<input type="checkbox" @bing="task.IsComplete" />
<input @bind="task.TaskName" />
</li>
}
</ul>
</div>
<div id="right-column">
Task Notes
</div>
</div>
</body>
@code {
public partial class Accounts {
private List<Accounts> account = new List<Accounts>();
account.Add(new Accounts {AccountName = "Hubspot"});
private string? newAccount;
private string? AccountName { get; set;};
}
private List<Tasks> task = new List<Tasks>();
account.Add(new Tasks {TaskName = "Call By Today"});
private string? newTask { get; set;};
private void AddAccount()
{
if (!string.IsNullOrWhiteSpace(newAccount))
{
account.Add(new Accounts { AccountName = newAccount });
newAccount = string.Empty;
}
}
private void AddTask()
{
if (!string.IsNullOrWhiteSpace(newTask))
{
task.Add(new Tasks { TaskName = newTask });
newTask = string.Empty;
}
}
IEnumerable<Accounts> Tasks = new[]
{
new Accounts {
AccountName = "Hubspot"
Tasks = new[]
{
new Tasks {
TaskName = "Call Today"
},
}
},
};
//IList<Accounts> ExpandedNodes = new List<Tasks>();
//Accounts selectedNode;
}

View File

@ -0,0 +1,18 @@
@page "/counter"
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
private void IncrementCount()
{
currentCount++;
}
}

View File

@ -0,0 +1,42 @@
@page
@model TaskTree.Pages.ErrorModel
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>
<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,26 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace TaskTree.Pages;
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}

View File

@ -0,0 +1,48 @@
@page "/fetchdata"
<PageTitle>Weather forecast</PageTitle>
@using TaskTree.Data
@inject WeatherForecastService ForecastService
<h1>Weather forecast</h1>
<p>This component demonstrates fetching data from a service.</p>
@if (forecasts == null)
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}
@code {
private WeatherForecast[]? forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
}
}

View File

@ -0,0 +1,9 @@
@page "/"
@namespace TaskTree.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_Layout";
}
<component type="typeof(App)" render-mode="ServerPrerendered" />
<link href="_content/Blazorise.TreeView/blazorise.treeview.css" rel="stylesheet" />

View File

@ -0,0 +1,32 @@
@using Microsoft.AspNetCore.Components.Web
@namespace TaskTree.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="TaskTree.styles.css" rel="stylesheet" />
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
@RenderBody()
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.server.js"></script>
</body>
</html>