66 lines
2.0 KiB
C#
66 lines
2.0 KiB
C#
using AyCode.Services.Loggers;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.Extensions.Localization;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using AyCode.Core.Loggers;
|
|
using TIAM.Resources;
|
|
using TIAMSharedUI.Pages.User;
|
|
using TIAMSharedUI.Resources;
|
|
using TIAMWebApp.Shared.Application.Interfaces;
|
|
using TIAMWebApp.Shared.Application.Utility;
|
|
|
|
namespace TIAMSharedUI.Shared.Components.BaseComponents
|
|
{
|
|
public class BasePageComponent : ComponentBase
|
|
{
|
|
[Inject]
|
|
protected NavigationManager _navManager { get; set; }
|
|
[Inject]
|
|
protected PageHistoryState _pageState { get; set; }
|
|
|
|
[Inject]
|
|
protected IEnumerable<IAcLogWriterClientBase> _logWriters { get; set; }
|
|
|
|
[Inject]
|
|
protected IStringLocalizer<TIAMResources> _localizer { get; set; }
|
|
|
|
[Inject]
|
|
protected ISessionServiceClient _sessionService { get; set; }
|
|
|
|
private LoggerClient<BasePageComponent> _logger = null!;
|
|
public BasePageComponent(NavigationManager navManager, PageHistoryState pageState, IEnumerable<IAcLogWriterClientBase> logWriters, IStringLocalizer<TIAMResources> localizer,ISessionServiceClient sessionService)
|
|
{
|
|
_navManager = navManager;
|
|
_pageState = pageState;
|
|
_logWriters = logWriters;
|
|
_localizer = localizer;
|
|
_sessionService = sessionService;
|
|
}
|
|
|
|
public BasePageComponent()
|
|
{
|
|
}
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
Initialize();
|
|
base.OnInitialized();
|
|
}
|
|
|
|
private void Initialize()
|
|
{
|
|
_logger = new LoggerClient<BasePageComponent>(_logWriters.ToArray());
|
|
|
|
var currentUrl = _navManager.ToBaseRelativePath(_navManager.Uri);
|
|
|
|
_pageState.AddPageToHistory(currentUrl);
|
|
//_logger.Debug(_pageState.GetGoBackPage());
|
|
}
|
|
}
|
|
}
|