diff --git a/WebDoorCreator.UI/Components/FilesMan/FilesRefresh.razor b/WebDoorCreator.UI/Components/FilesMan/FilesRefresh.razor new file mode 100644 index 0000000..2d6baf1 --- /dev/null +++ b/WebDoorCreator.UI/Components/FilesMan/FilesRefresh.razor @@ -0,0 +1,45 @@ + + + + + +@*@if (vocLemmas != null) +{ + @foreach (var item in vocLemmas) + { + @foreach (var k in item.Value) + { + @*
@($"{k.Key} --> {k.Value}")
+ @if(vocLemmasTEMP != null) + { + + } + } + } +}*@ + +@if (showList) +{ + + + @if (vocLemmas2Dict != null && vocLemmasTEMP2Dict != null) + { + @foreach (var item in vocLemmasTEMP2Dict) + { + @if (!vocLemmas2Dict.ContainsKey(item.Key)) + { +
+
@($"{item.Key} --> {vocLemmasTEMP2Dict[item.Key]}")
+
+ } + else if (item.Value != vocLemmas2Dict[item.Key]) + { +
+
@($"{item.Key} --> {vocLemmas2Dict[item.Key]}")
+
@($"{item.Key} --> {item.Value}")
+
+ } + } + } +} + diff --git a/WebDoorCreator.UI/Components/FilesMan/FilesRefresh.razor.cs b/WebDoorCreator.UI/Components/FilesMan/FilesRefresh.razor.cs new file mode 100644 index 0000000..98eee93 --- /dev/null +++ b/WebDoorCreator.UI/Components/FilesMan/FilesRefresh.razor.cs @@ -0,0 +1,71 @@ +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>? vocLemmas { get; set; } = null; + protected Dictionary vocLemmas2Dict { get; set; } = new Dictionary(); + protected Dictionary>? vocLemmasTEMP { get; set; } = null; + protected Dictionary vocLemmasTEMP2Dict { get; set; } = new Dictionary(); + + 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 list2Mod = new List(); + + protected string defaultPath { get; set; } = ""; + } +} \ No newline at end of file