76 lines
2.2 KiB
C#
76 lines
2.2 KiB
C#
#if false
|
|
using Blazored.LocalStorage;
|
|
#endif
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
using MP.Data.DTO;
|
|
using MP.Data.Services;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace MP_TAB3.Pages
|
|
{
|
|
public partial class Logout : IDisposable
|
|
{
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
//GC.Collect();
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected ILocalStorageService localStorage { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected MessageService MsgServ { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected NavigationManager NavMan { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected TabDataService TDService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
MsgServ.RigaOper = null;
|
|
return base.OnAfterRenderAsync(firstRender);
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await Task.Delay(1);
|
|
await MsgServ.SetCurrOperDtoLSAsync("");
|
|
await MsgServ.IdxMaccSet("");
|
|
await MsgServ.LastOpenedPageSet("");
|
|
var CurrOprTknLS = await MsgServ.GetCurrOperDtoLSAsync();
|
|
var CurrDevGuid = await MsgServ.GetCurrDevGuidLSAsync();
|
|
await MsgServ.ClearAllAsync();
|
|
await MsgServ.SetCurrDevGuidLSAsync(CurrDevGuid);
|
|
if (!string.IsNullOrEmpty(CurrOprTknLS))
|
|
{
|
|
var decryptedData = MsgServ.DecryptData(CurrOprTknLS);
|
|
if (!string.IsNullOrEmpty(decryptedData))
|
|
{
|
|
var oprObj = JsonConvert.DeserializeObject<userTknDTO>(decryptedData);
|
|
if (oprObj != null)
|
|
{
|
|
MsgServ.RigaOper = oprObj.currOpr;
|
|
}
|
|
}
|
|
}
|
|
await TDService.OperatoreDeleteRedis(MsgServ.MatrOpr, CurrDevGuid);
|
|
MsgServ.RigaOper = null;
|
|
NavMan.NavigateTo("reg-new-device", true);
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |