mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Load valid sheets for AddFromSheetPopup asynchronously
This commit is contained in:
parent
2625f51021
commit
dceeccb242
1 changed files with 24 additions and 13 deletions
|
|
@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Data;
|
||||
|
|
@ -146,6 +147,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
|||
private SeStringParameter[]? localParameters = [Util.GetScmVersion()];
|
||||
private ReadOnlySeString input;
|
||||
private ClientLanguage? language;
|
||||
private Task? validImportSheetNamesTask;
|
||||
private int importSelectedSheetName;
|
||||
private int importRowId;
|
||||
private string[]? validImportSheetNames;
|
||||
|
|
@ -565,7 +567,9 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
|||
|
||||
var dataManager = Service<DataManager>.Get();
|
||||
|
||||
this.validImportSheetNames ??= dataManager.Excel.SheetNames.Where(sheetName =>
|
||||
this.validImportSheetNamesTask ??= Task.Run(() =>
|
||||
{
|
||||
this.validImportSheetNames = dataManager.Excel.SheetNames.Where(sheetName =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -581,6 +585,13 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
|||
return false;
|
||||
}
|
||||
}).OrderBy(sheetName => sheetName, StringComparer.InvariantCulture).ToArray();
|
||||
});
|
||||
|
||||
if (this.validImportSheetNames == null)
|
||||
{
|
||||
ImGui.Text("Loading sheets..."u8);
|
||||
return;
|
||||
}
|
||||
|
||||
var sheetChanged = ImGui.Combo("Sheet Name", ref this.importSelectedSheetName, this.validImportSheetNames);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue