@using Blog3000.Client.Shared
@inherits LayoutComponentBase
@implements IDisposable
@inject Config CurrConfig
@inject IJSRuntime JSRuntime
@Body
@if (defaultMailAddress != null)
{
}
Powered by blog3000 (C) M. Höß, Version 0.1 PreAlpha Build @build, powered by C#, ASP.NetCore, Blazor and Gentoo-Linux :)
@code {
private string build;
private string defaultMailAddress;
private string defaultMailAddressTxt;
public void Dispose()
{
CurrConfig.ConfigChanged -= ConfigChanged;
}
protected override void OnInitialized()
{
build = Blog3000.Client.BuildVersion.BUILD_DATE;
CurrConfig.ConfigChanged += ConfigChanged;
_ = CurrConfig.FetchAsync();
Refresh();
}
private void ConfigChanged(object sender, EventArgs e)
{
Refresh();
}
private void Refresh()
{
defaultMailAddress = CurrConfig?.Main?.DefaultMailAddress != null ? $"mailto:{CurrConfig.Main.DefaultMailAddress}" : null;
defaultMailAddressTxt = CurrConfig?.Main?.DefaultMailAddress != null ? $"Send a comment to {CurrConfig.Main.DefaultMailAddress}" : null;
if (CurrConfig?.Main?.Title != null)
{
JSRuntime.InvokeVoidAsync("window.setTitle", CurrConfig.Main.Title);
}
StateHasChanged();
}
}