Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Nov 18, 2022
1 parent 0542b3a commit ec0a18f
Show file tree
Hide file tree
Showing 11 changed files with 241 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Crossui.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Blazor", "Blazor", "{F79B9C
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crossui.Blazor.Wasm", "Web\Blazor\Crossui.Blazor.Wasm\Crossui.Blazor.Wasm.csproj", "{16E198C2-B388-4E37-97DE-6F8343D5B34A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crossui.Blazor.Server", "Web\Blazor\Crossui.Blazor.Server\Crossui.Blazor.Server.csproj", "{87076E56-E6ED-41A6-A09D-C801D8290A12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -189,6 +191,26 @@ Global
{16E198C2-B388-4E37-97DE-6F8343D5B34A}.Release|x64.Build.0 = Release|Any CPU
{16E198C2-B388-4E37-97DE-6F8343D5B34A}.Release|x86.ActiveCfg = Release|Any CPU
{16E198C2-B388-4E37-97DE-6F8343D5B34A}.Release|x86.Build.0 = Release|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Debug|ARM.ActiveCfg = Debug|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Debug|ARM.Build.0 = Debug|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Debug|ARM64.Build.0 = Debug|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Debug|x64.ActiveCfg = Debug|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Debug|x64.Build.0 = Debug|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Debug|x86.ActiveCfg = Debug|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Debug|x86.Build.0 = Debug|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Release|Any CPU.Build.0 = Release|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Release|ARM.ActiveCfg = Release|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Release|ARM.Build.0 = Release|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Release|ARM64.ActiveCfg = Release|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Release|ARM64.Build.0 = Release|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Release|x64.ActiveCfg = Release|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Release|x64.Build.0 = Release|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Release|x86.ActiveCfg = Release|Any CPU
{87076E56-E6ED-41A6-A09D-C801D8290A12}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -201,6 +223,7 @@ Global
{B54B33DF-399B-4EF4-9188-01318B5384B1} = {2B541DFF-09B9-4480-8C48-8A384B6ACA0B}
{F79B9C12-1025-4745-8728-3E3B14626AAE} = {C63F7D11-0163-4093-9EC3-68AC366C20D8}
{16E198C2-B388-4E37-97DE-6F8343D5B34A} = {F79B9C12-1025-4745-8728-3E3B14626AAE}
{87076E56-E6ED-41A6-A09D-C801D8290A12} = {F79B9C12-1025-4745-8728-3E3B14626AAE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2C3CBCA8-0801-4AA0-9FF2-245902002EE1}
Expand Down
Binary file added Library/Crossui.Core/wwwroot/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions Web/Blazor/Crossui.Blazor.Server/Crossui.Blazor.Server.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<ItemGroup>
<ProjectReference Include="..\..\..\Library\Crossui.Core\Crossui.Core.csproj" />
</ItemGroup>

</Project>
42 changes: 42 additions & 0 deletions Web/Blazor/Crossui.Blazor.Server/Pages/Error.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@page
@model Crossui.Blazor.Server.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>
27 changes: 27 additions & 0 deletions Web/Blazor/Crossui.Blazor.Server/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;

namespace Crossui.Blazor.Server.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;
}
}
}
34 changes: 34 additions & 0 deletions Web/Blazor/Crossui.Blazor.Server/Pages/_Host.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@page "/"
@using Crossui.Core
@using Microsoft.AspNetCore.Components.Web
@namespace Crossui.Blazor.Server.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/app.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="favicon.png"/>
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
<component type="typeof(Main)" render-mode="ServerPrerendered" />

<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>
38 changes: 38 additions & 0 deletions Web/Blazor/Crossui.Blazor.Server/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Crossui.Core.Data;

namespace Crossui.Blazor.Server
{
public class Program
{
public static void Main(string[] args)
{
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>();

WebApplication app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();

app.UseStaticFiles();

app.UseRouting();

app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();
}
}
}
37 changes: 37 additions & 0 deletions Web/Blazor/Crossui.Blazor.Server/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:6964",
"sslPort": 44367
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5166",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7052;http://localhost:5166",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
9 changes: 9 additions & 0 deletions Web/Blazor/Crossui.Blazor.Server/_Imports.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using Crossui.Blazor.Server
9 changes: 9 additions & 0 deletions Web/Blazor/Crossui.Blazor.Server/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 9 additions & 0 deletions Web/Blazor/Crossui.Blazor.Server/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

0 comments on commit ec0a18f

Please sign in to comment.