Used AI to change project to blazor webassembly.

This commit is contained in:
2026-08-10 14:49:01 +02:00
parent 218dbe36d9
commit e1053844c0
1117 changed files with 6441 additions and 749 deletions

49
Services/ScrollService.cs Normal file
View File

@@ -0,0 +1,49 @@
using Microsoft.JSInterop;
namespace DouwcoWebsite;
public class ScrollService : IDisposable
{
private readonly IJSRuntime _jsRuntime;
private DotNetObjectReference<ScrollService>? _dotNetObjectReference;
private IJSObjectReference? _module;
public event Action<string>? OnSectionChanged;
public ScrollService(IJSRuntime jsRuntime)
{
_jsRuntime = jsRuntime;
_dotNetObjectReference = DotNetObjectReference.Create(this);
}
public async Task InitializeAsync()
{
_module = await _jsRuntime.InvokeAsync<IJSObjectReference>(
"import", "./js/scrollService.js");
await _module.InvokeVoidAsync("initialize", _dotNetObjectReference);
}
[JSInvokable]
public void HandleSectionChange(string sectionId)
{
OnSectionChanged?.Invoke(sectionId);
}
public async Task ScrollToSection(string sectionId)
{
if (_module != null)
{
await _module.InvokeVoidAsync("scrollToSection", sectionId);
}
}
public void Dispose()
{
_dotNetObjectReference?.Dispose();
if (_module != null)
{
_module.InvokeVoidAsync("dispose");
}
}
}