Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchalmers committed Mar 24, 2024
1 parent cbd78ff commit 9a0cff1
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 117 deletions.
3 changes: 1 addition & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

<PropertyGroup>
<TargetFrameworks>$(TargetFrameworks);net8.0</TargetFrameworks>
<!-- <LangVersion>latest</LangVersion> -->
<!-- <Deterministic>true</Deterministic> -->
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

</Project>
3 changes: 3 additions & 0 deletions src/Try.Core/CompilationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
Expand Down Expand Up @@ -135,6 +136,8 @@ await Task.WhenAll(
{
var result = await httpClient.GetAsync($"/_framework/{assemblyName}.dll");

Console.WriteLine( result.RequestMessage );
Console.WriteLine( result.StatusCode );
result.EnsureSuccessStatusCode();

streams.TryAdd(assemblyName, await result.Content.ReadAsStreamAsync());
Expand Down
6 changes: 6 additions & 0 deletions src/TryMudBlazor.Client/Routes.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Router AppAssembly="typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="routeData" DefaultLayout="typeof(MainLayout)" />
<FocusOnNavigate RouteData="routeData" Selector="h1" />
</Found>
</Router>
9 changes: 7 additions & 2 deletions src/TryMudBlazor.Client/_Imports.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
@using Microsoft.AspNetCore.Components.Forms
@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 static Microsoft.AspNetCore.Components.Web.RenderMode
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using TryMudBlazor.Client.Components
@using TryMudBlazor.Client.Shared

@using MudBlazor
@using MudBlazor
78 changes: 55 additions & 23 deletions src/TryMudBlazor.Server/Program.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace TryMudBlazor.Server
using MudBlazor.Examples.Data;
using TryMudBlazor.Client;
using TryMudBlazor.Client.Shared;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();

builder.Services.AddScoped<IPeriodicTableService, PeriodicTableService>();
builder.Services.AddCors(options =>
{
public class Program
{
public static void Main(string[] args)
options.AddDefaultPolicy(
builder =>
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
builder.WithOrigins("https://www.mudblazor.com", "https://mudblazor.com");
});
});

builder.Services.AddControllers();

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebAssemblyDebugging();
}
else
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
// 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.UseRouting();

app.UseCors();

// Needed for wasm project
app.UseBlazorFrameworkFiles();
app.UseStaticFiles();

app.MapControllers();
// Serve the wasm project if no other matches
app.MapFallbackToFile("index.html");

app.UseStaticFiles();
app.UseAntiforgery();

app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
//.AddAdditionalAssemblies([typeof(MainLayout).Assembly]);

app.Run();
22 changes: 11 additions & 11 deletions src/TryMudBlazor.Server/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"launchUrl": "snippet",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Server": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
"Server": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "snippet",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
79 changes: 0 additions & 79 deletions src/TryMudBlazor.Server/Startup.cs

This file was deleted.

0 comments on commit 9a0cff1

Please sign in to comment.