Normalize
This commit is contained in:
35
Normalize/ClientHub/Shared/MainLayout.razor.cs
Normal file
35
Normalize/ClientHub/Shared/MainLayout.razor.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Normalize.ClientHub.Shared;
|
||||
|
||||
public partial class MainLayout
|
||||
{
|
||||
|
||||
bool _DrawerOpen = true;
|
||||
private bool _IsDarkMode;
|
||||
private string? _RequestId;
|
||||
private MudThemeProvider? _MudThemeProvider;
|
||||
|
||||
[Inject] protected Models.AppSettings? AppSettings { get; set; }
|
||||
[Inject] protected IHttpContextAccessor? HttpContextAccessor { get; set; }
|
||||
|
||||
void DrawerToggle() => _DrawerOpen = !_DrawerOpen;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
base.OnParametersSet();
|
||||
_RequestId = Activity.Current?.Id ?? HttpContextAccessor?.HttpContext?.TraceIdentifier;
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender && _MudThemeProvider is not null)
|
||||
{
|
||||
_IsDarkMode = await _MudThemeProvider.GetSystemPreference();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user