Compare commits
	
		
			1 Commits
		
	
	
		
			662863a11e
			...
			sdk
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| db044d69c3 | 
							
								
								
									
										30
									
								
								Client/.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										30
									
								
								Client/.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							@ -1,6 +1,31 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    "version": "0.2.0",
 | 
					    "version": "0.2.0",
 | 
				
			||||||
    "configurations": [
 | 
					    "configurations": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            // Use IntelliSense to find out which attributes exist for C# debugging
 | 
				
			||||||
 | 
					            // Use hover for the description of the existing attributes
 | 
				
			||||||
 | 
					            // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
 | 
				
			||||||
 | 
					            "name": ".NET Core Launch (web)",
 | 
				
			||||||
 | 
					            "type": "coreclr",
 | 
				
			||||||
 | 
					            "request": "launch",
 | 
				
			||||||
 | 
					            "preLaunchTask": "build",
 | 
				
			||||||
 | 
					            // If you have changed target frameworks, make sure to update the program path.
 | 
				
			||||||
 | 
					            "program": "${workspaceFolder}/bin/Debug/net7.0/OI.Metrology.Client.dll",
 | 
				
			||||||
 | 
					            "args": [],
 | 
				
			||||||
 | 
					            "cwd": "${workspaceFolder}",
 | 
				
			||||||
 | 
					            "stopAtEntry": false,
 | 
				
			||||||
 | 
					            // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
 | 
				
			||||||
 | 
					            "serverReadyAction": {
 | 
				
			||||||
 | 
					                "action": "openExternally",
 | 
				
			||||||
 | 
					                "pattern": "\\bNow listening on:\\s+(https?://\\S+)"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            "env": {
 | 
				
			||||||
 | 
					                "ASPNETCORE_ENVIRONMENT": "Development"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            "sourceFileMap": {
 | 
				
			||||||
 | 
					                "/Views": "${workspaceFolder}/Views"
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "Launch", // opens a edge window, navigates and click debugs on mine
 | 
					            "name": "Launch", // opens a edge window, navigates and click debugs on mine
 | 
				
			||||||
            "type": "blazorwasm",
 | 
					            "type": "blazorwasm",
 | 
				
			||||||
@ -30,7 +55,10 @@
 | 
				
			|||||||
    "compounds": [
 | 
					    "compounds": [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "* Hot Reload with Debug - Launch",
 | 
					            "name": "* Hot Reload with Debug - Launch",
 | 
				
			||||||
            "configurations": [ "Watch", "Launch" ]
 | 
					            "configurations": [
 | 
				
			||||||
 | 
					                "Watch",
 | 
				
			||||||
 | 
					                "Launch"
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1,12 +1,9 @@
 | 
				
			|||||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
 | 
					<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
				
			||||||
  <PropertyGroup>
 | 
					  <PropertyGroup>
 | 
				
			||||||
    <AssemblyName>$(AssemblyName.Replace(' ', '_'))</AssemblyName>
 | 
					    <AssemblyName>$(AssemblyName.Replace(' ', '_'))</AssemblyName>
 | 
				
			||||||
    <ImplicitUsings>enable</ImplicitUsings>
 | 
					    <ImplicitUsings>enable</ImplicitUsings>
 | 
				
			||||||
    <Nullable>enable</Nullable>
 | 
					    <Nullable>enable</Nullable>
 | 
				
			||||||
    <TargetFramework>net7.0</TargetFramework>
 | 
					    <TargetFramework>net7.0</TargetFramework>
 | 
				
			||||||
    <BlazorEnableCompression>false</BlazorEnableCompression>
 | 
					 | 
				
			||||||
    <BlazorWebassemblyEnableLinking>false</BlazorWebassemblyEnableLinking>
 | 
					 | 
				
			||||||
    <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
 | 
					 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.2" PrivateAssets="all" />
 | 
					    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.2" PrivateAssets="all" />
 | 
				
			||||||
@ -23,7 +20,4 @@
 | 
				
			|||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />
 | 
					    <ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					 | 
				
			||||||
    <ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
 | 
					 | 
				
			||||||
  </ItemGroup>
 | 
					 | 
				
			||||||
</Project>
 | 
					</Project>
 | 
				
			||||||
							
								
								
									
										36
									
								
								Client/Pages/_Host.cshtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Client/Pages/_Host.cshtml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					@page "/"
 | 
				
			||||||
 | 
					@using Microsoft.AspNetCore.Components.Web
 | 
				
			||||||
 | 
					@namespace OI.Metrology.Client.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 href="blazorserver.styles.css" rel="stylesheet" />
 | 
				
			||||||
 | 
					    <link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
 | 
				
			||||||
 | 
					    <link rel="icon" type="image/png" href="favicon.png"/>
 | 
				
			||||||
 | 
					    <component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
 | 
				
			||||||
 | 
					</head>
 | 
				
			||||||
 | 
					<body>
 | 
				
			||||||
 | 
					    <component type="typeof(App)" 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="_content/MudBlazor/MudBlazor.min.js"></script>
 | 
				
			||||||
 | 
					    <script src="_framework/blazor.server.js"></script>
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
@ -1,44 +1,39 @@
 | 
				
			|||||||
using Microsoft.AspNetCore.Components.Web;
 | 
					 | 
				
			||||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
 | 
					using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
 | 
				
			||||||
using MudBlazor.Services;
 | 
					using MudBlazor.Services;
 | 
				
			||||||
using Serilog;
 | 
					 | 
				
			||||||
using Serilog.Core;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace OI.Metrology.Client;
 | 
					namespace OI.Metrology.Client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
internal class Program
 | 
					internal class Program
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private static async Task Main(string[] args)
 | 
					    private static void Main(string[] args)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault(args);
 | 
					        WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
 | 
				
			||||||
        LoggingLevelSwitch levelSwitch = new();
 | 
					 | 
				
			||||||
        LoggerConfiguration loggerConfiguration = new();
 | 
					 | 
				
			||||||
        string? apiUrl = builder.Configuration["ApiUrl"];
 | 
					 | 
				
			||||||
        // _ = loggerConfiguration.WriteTo.BrowserConsole();
 | 
					 | 
				
			||||||
        // _ = loggerConfiguration.MinimumLevel.ControlledBy(levelSwitch);
 | 
					 | 
				
			||||||
        // _ = loggerConfiguration.Enrich.WithProperty("InstanceId", Guid.NewGuid().ToString("n"));
 | 
					 | 
				
			||||||
        // _ = loggerConfiguration.WriteTo.BrowserHttp($"{apiUrl}ingest", controlLevelSwitch: levelSwitch);
 | 
					 | 
				
			||||||
        Log.Logger = loggerConfiguration.CreateLogger();
 | 
					 | 
				
			||||||
        Serilog.ILogger log = Log.ForContext<Program>();
 | 
					 | 
				
			||||||
        try
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if (apiUrl is null)
 | 
					 | 
				
			||||||
                throw new NullReferenceException(nameof(apiUrl));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            builder.RootComponents.Add<App>("#app");
 | 
					        // Add services to the container.
 | 
				
			||||||
            builder.RootComponents.Add<HeadOutlet>("head::after");
 | 
					        _ = builder.Services.AddRazorPages();
 | 
				
			||||||
 | 
					        _ = builder.Services.AddServerSideBlazor();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            _ = builder.Services.AddScoped(serviceProvider => new HttpClient { BaseAddress = new Uri(apiUrl) });
 | 
					 | 
				
			||||||
        _ = builder.Services.AddMudServices();
 | 
					        _ = builder.Services.AddMudServices();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            log.Information("Building Web Host");
 | 
					        WebApplication app = builder.Build();
 | 
				
			||||||
            WebAssemblyHost app = builder.Build();
 | 
					
 | 
				
			||||||
            await app.RunAsync();
 | 
					        // Configure the HTTP request pipeline.
 | 
				
			||||||
        }
 | 
					        if (!app.Environment.IsDevelopment())
 | 
				
			||||||
        catch (Exception ex)
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            log.Fatal(ex, "An exception occurred while creating the WASM host");
 | 
					            _ = app.UseExceptionHandler("/Error");
 | 
				
			||||||
            throw;
 | 
					            // 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();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user