committed by
GitHub
17 changed files with 0 additions and 333 deletions
@ -1,10 +0,0 @@ |
|||
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true"> |
|||
<Found Context="routeData"> |
|||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> |
|||
</Found> |
|||
<NotFound> |
|||
<LayoutView Layout="@typeof(MainLayout)"> |
|||
<p>Sorry, there's nothing at this address.</p> |
|||
</LayoutView> |
|||
</NotFound> |
|||
</Router> |
|||
@ -1,10 +0,0 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Avalonia; |
|||
using Avalonia.Browser.Blazor; |
|||
|
|||
namespace ControlCatalog.Browser.Blazor; |
|||
|
|||
public partial class App |
|||
{ |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> |
|||
<PropertyGroup> |
|||
<TargetFramework>$(AvsCurrentBrowserTargetFramework)</TargetFramework> |
|||
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier> |
|||
<Nullable>enable</Nullable> |
|||
<EmccTotalMemory>16777216</EmccTotalMemory> |
|||
<BlazorEnableTimeZoneSupport>false</BlazorEnableTimeZoneSupport> |
|||
<BlazorWebAssemblyPreserveCollationData>false</BlazorWebAssemblyPreserveCollationData> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.0" /> |
|||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.0" PrivateAssets="all" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj" /> |
|||
<ProjectReference Include="..\..\src\Browser\Avalonia.Browser.Blazor\Avalonia.Browser.Blazor.csproj" /> |
|||
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<Import Project="..\..\build\ReferenceCoreLibraries.props" /> |
|||
<Import Project="..\..\build\BuildTargets.targets" /> |
|||
|
|||
<Import Project="..\..\src\Browser\Avalonia.Browser\build\Avalonia.Browser.props" /> |
|||
<Import Project="..\..\src\Browser\Avalonia.Browser\build\Avalonia.Browser.targets" /> |
|||
|
|||
</Project> |
|||
|
|||
@ -1,5 +0,0 @@ |
|||
@page "/" |
|||
|
|||
@using Avalonia.Browser.Blazor |
|||
|
|||
<AvaloniaView /> |
|||
@ -1,39 +0,0 @@ |
|||
using System; |
|||
using System.Net.Http; |
|||
using System.Threading.Tasks; |
|||
using Avalonia; |
|||
using Avalonia.Browser.Blazor; |
|||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using ControlCatalog.Browser.Blazor; |
|||
|
|||
public class Program |
|||
{ |
|||
public static async Task Main(string[] args) |
|||
{ |
|||
var host = CreateHostBuilder(args).Build(); |
|||
await StartAvaloniaApp(); |
|||
await host.RunAsync(); |
|||
} |
|||
|
|||
public static async Task StartAvaloniaApp() |
|||
{ |
|||
await AppBuilder.Configure<ControlCatalog.App>() |
|||
.StartBlazorAppAsync(); |
|||
} |
|||
|
|||
public static WebAssemblyHostBuilder CreateHostBuilder(string[] args) |
|||
{ |
|||
var builder = WebAssemblyHostBuilder.CreateDefault(args); |
|||
|
|||
builder.RootComponents.Add<App>("#app"); |
|||
|
|||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); |
|||
|
|||
return builder; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -1,22 +0,0 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:13961", |
|||
"sslPort": 44319 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"ControlCatalog.Web": { |
|||
"commandName": "Project", |
|||
"dotnetRunMessages": "true", |
|||
"launchBrowser": true, |
|||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
|||
"applicationUrl": "https://localhost:5001;http://localhost:5000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,7 +0,0 @@ |
|||
@inherits LayoutComponentBase |
|||
|
|||
<div class="page"> |
|||
<div class="main"> |
|||
@Body |
|||
</div> |
|||
</div> |
|||
@ -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 ControlCatalog.Browser.Blazor.Shared |
|||
@using SkiaSharp |
|||
@ -1,56 +0,0 @@ |
|||
html, body { |
|||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; |
|||
margin: 0; |
|||
height: 100vh; |
|||
overflow: hidden; |
|||
touch-action: none; |
|||
} |
|||
|
|||
a, .btn-link { |
|||
color: #0366d6; |
|||
} |
|||
|
|||
.btn-primary { |
|||
color: #fff; |
|||
background-color: #1b6ec2; |
|||
border-color: #1861ac; |
|||
} |
|||
|
|||
.content { |
|||
padding-top: 1.1rem; |
|||
} |
|||
|
|||
.valid.modified:not([type=checkbox]) { |
|||
outline: 1px solid #26b050; |
|||
} |
|||
|
|||
.invalid { |
|||
outline: 1px solid red; |
|||
} |
|||
|
|||
.validation-message { |
|||
color: red; |
|||
} |
|||
|
|||
#blazor-error-ui { |
|||
background: lightyellow; |
|||
bottom: 0; |
|||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); |
|||
display: none; |
|||
left: 0; |
|||
padding: 0.6rem 1.25rem 0.7rem 1.25rem; |
|||
position: fixed; |
|||
width: 100%; |
|||
z-index: 1000; |
|||
} |
|||
|
|||
#blazor-error-ui .dismiss { |
|||
cursor: pointer; |
|||
position: absolute; |
|||
right: 0.75rem; |
|||
top: 0.5rem; |
|||
} |
|||
|
|||
#app, .page { |
|||
height: 100%; |
|||
} |
|||
|
Before Width: | Height: | Size: 172 KiB |
@ -1,22 +0,0 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
|
|||
<head> |
|||
<meta charset="utf-8" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> |
|||
<title>Avalonia Sample</title> |
|||
<base href="/" /> |
|||
<link href="css/app.css" rel="stylesheet" /> |
|||
</head> |
|||
|
|||
<body> |
|||
<div id="app">Powered by Avalonia</div> |
|||
|
|||
<div id="blazor-error-ui"> |
|||
An unhandled error has occurred. |
|||
<a href="" class="reload">Reload</a> |
|||
<a class="dismiss">🗙</a> |
|||
</div> |
|||
<script src="_framework/blazor.webassembly.js"></script> |
|||
</body> |
|||
</html> |
|||
@ -1,23 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>$(AvsCurrentBrowserTargetFramework)</TargetFramework> |
|||
<ResolveStaticWebAssetsInputsDependsOn>_IncludeGeneratedAvaloniaStaticFiles;$(ResolveStaticWebAssetsInputsDependsOn)</ResolveStaticWebAssetsInputsDependsOn> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<SupportedPlatform Remove="@(SupportedPlatform)" /> |
|||
<SupportedPlatform Include="browser" /> |
|||
</ItemGroup> |
|||
|
|||
<Import Project="../../../build/NullableEnable.props" /> |
|||
<Import Project="../../../build/TrimmingEnable.props" /> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.0" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="../Avalonia.Browser/Avalonia.Browser.csproj" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -1,52 +0,0 @@ |
|||
using System.Runtime.InteropServices.JavaScript; |
|||
using System.Runtime.Versioning; |
|||
using System.Threading.Tasks; |
|||
using System; |
|||
using Avalonia.Browser.Interop; |
|||
using Avalonia.Controls.ApplicationLifetimes; |
|||
using Microsoft.AspNetCore.Components; |
|||
using Microsoft.AspNetCore.Components.Rendering; |
|||
using BrowserView = Avalonia.Browser.AvaloniaView; |
|||
|
|||
[assembly: SupportedOSPlatform("browser")] |
|||
|
|||
namespace Avalonia.Browser.Blazor; |
|||
|
|||
public class AvaloniaView : ComponentBase |
|||
{ |
|||
private Browser.AvaloniaView? _browserView; |
|||
private readonly string _containerId; |
|||
|
|||
public AvaloniaView() |
|||
{ |
|||
_containerId = "av_container_" + Guid.NewGuid(); |
|||
} |
|||
|
|||
protected override void BuildRenderTree(RenderTreeBuilder builder) |
|||
{ |
|||
builder.OpenElement(0, "div"); |
|||
builder.AddAttribute(1, "id", _containerId); |
|||
builder.AddAttribute(2, "style", "width:100vw;height:100vh"); |
|||
builder.CloseElement(); |
|||
} |
|||
|
|||
protected override void OnAfterRender(bool firstRender) |
|||
{ |
|||
if (firstRender) |
|||
{ |
|||
_browserView = new Browser.AvaloniaView(_containerId); |
|||
if (Application.Current?.ApplicationLifetime is ISingleViewApplicationLifetime lifetime) |
|||
{ |
|||
_browserView.Content = lifetime.MainView; |
|||
} |
|||
} |
|||
} |
|||
|
|||
protected override void OnInitialized() |
|||
{ |
|||
if (!OperatingSystem.IsBrowser()) |
|||
{ |
|||
throw new NotSupportedException("Avalonia doesn't support server-side Blazor"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
using System; |
|||
using System.Runtime.Versioning; |
|||
using System.Threading.Tasks; |
|||
using Avalonia; |
|||
using Avalonia.Browser.Interop; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Controls.ApplicationLifetimes; |
|||
|
|||
namespace Avalonia.Browser.Blazor; |
|||
|
|||
public static class BlazorAppBuilder |
|||
{ |
|||
/// <summary>
|
|||
/// Configures blazor backend, loads avalonia javascript modules and creates a single view lifetime.
|
|||
/// </summary>
|
|||
/// <param name="builder">Application builder.</param>
|
|||
/// <param name="options">Browser backend specific options.</param>
|
|||
public static async Task StartBlazorAppAsync(this AppBuilder builder, BrowserPlatformOptions? options = null) |
|||
{ |
|||
builder = await BrowserAppBuilder.PreSetupBrowser(builder, options); |
|||
|
|||
builder.SetupWithLifetime(new BlazorSingleViewLifetime()); |
|||
} |
|||
|
|||
internal class BlazorSingleViewLifetime : ISingleViewApplicationLifetime |
|||
{ |
|||
public Control? MainView { get; set; } |
|||
} |
|||
} |
|||
Loading…
Reference in new issue