71 lines
2.7 KiB
C#
71 lines
2.7 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.CodeAnalysis.VisualBasic.Syntax;
|
|
using WebDoorCreator.Data.DbModels;
|
|
using WebDoorCreator.Data.Services;
|
|
|
|
namespace WebDoorCreator.UI.Components.FilesMan
|
|
{
|
|
public partial class FilesRefresh
|
|
{
|
|
[Inject]
|
|
protected WebDoorCreatorService WDCService { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public string lang { get; set; } = "";
|
|
|
|
protected Dictionary<string, Dictionary<string, string>>? vocLemmas { get; set; } = null;
|
|
protected Dictionary<string, string> vocLemmas2Dict { get; set; } = new Dictionary<string, string>();
|
|
protected Dictionary<string, Dictionary<string, string>>? vocLemmasTEMP { get; set; } = null;
|
|
protected Dictionary<string, string> vocLemmasTEMP2Dict { get; set; } = new Dictionary<string, string>();
|
|
|
|
protected bool showList { get; set; } = false;
|
|
|
|
protected async override Task OnParametersSetAsync()
|
|
{
|
|
var rawVoc = await WDCService.VocLemmaGetAll();
|
|
if (rawVoc != null)
|
|
{
|
|
vocLemmas = rawVoc.Where(x => x.Key == lang).ToDictionary(x => x.Key, x => x.Value);
|
|
if(vocLemmas != null)
|
|
{
|
|
foreach(var kvp in vocLemmas)
|
|
{
|
|
foreach(var item in kvp.Value)
|
|
{
|
|
vocLemmas2Dict.Add(item.Key, item.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
protected async Task refreshVoc()
|
|
{
|
|
vocLemmasTEMP = null;
|
|
await Task.Delay(1);
|
|
list2Mod = await WDCService.VocLemmaInsertPrepare(@$"{defaultPath}");
|
|
if (list2Mod != null)
|
|
{
|
|
//bool ok = await WDCService.VocLemmaInsert();
|
|
var k = await WDCService.VocLemmaTEMPGetAll();
|
|
if (k != null)
|
|
{
|
|
vocLemmasTEMP = k.Where(x => x.Key == lang).ToDictionary(x => x.Key, x => x.Value);
|
|
if (vocLemmasTEMP != null)
|
|
{
|
|
foreach (var kvp in vocLemmasTEMP)
|
|
{
|
|
foreach (var item in kvp.Value)
|
|
{
|
|
vocLemmasTEMP2Dict.Add(item.Key, item.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
showList = true;
|
|
}
|
|
List<VocabularyTempModel> list2Mod = new List<VocabularyTempModel>();
|
|
|
|
protected string defaultPath { get; set; } = "";
|
|
}
|
|
} |