From b35f2b74b26a011cf5d56202d5e859c7330e331c Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Tue, 10 Dec 2019 10:20:38 +0100 Subject: [PATCH] fixed FCurrentAsset not always up to date --- FModel/Methods/Assets/AssetsLoader.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/FModel/Methods/Assets/AssetsLoader.cs b/FModel/Methods/Assets/AssetsLoader.cs index 45dc3a3f..e996e25f 100644 --- a/FModel/Methods/Assets/AssetsLoader.cs +++ b/FModel/Methods/Assets/AssetsLoader.cs @@ -39,10 +39,10 @@ namespace FModel.Methods.Assets DebugHelper.WriteLine("Assets: User selected " + item); cToken.ThrowIfCancellationRequested(); //if clicked on 'Stop' it breaks at the following item - FWindow.FMain.Dispatcher.InvokeAsync(() => //ui thread because if not, FCurrentAsset isn't updated in time to Auto Save a JSON Data for example + while (!string.Equals(FWindow.FCurrentAsset, item)) { FWindow.FCurrentAsset = item; - }); + } LoadAsset(treePath + "/" + item); } @@ -110,10 +110,10 @@ namespace FModel.Methods.Assets target = asset.Substring(0, asset.LastIndexOf(".")); //uassets } - FWindow.FMain.Dispatcher.InvokeAsync(() => //ui thread because if not, FCurrentAsset isn't updated in time to Auto Save a JSON Data for example + while (!string.Equals(FWindow.FCurrentAsset, Path.GetFileName(target))) { FWindow.FCurrentAsset = Path.GetFileName(target); - }); + } LoadAsset(target); } } @@ -171,10 +171,10 @@ namespace FModel.Methods.Assets target = asset.Substring(0, asset.LastIndexOf(".")); //uassets } - FWindow.FMain.Dispatcher.InvokeAsync(() => //ui thread because if not, FCurrentAsset isn't updated in time to Auto Save a JSON Data for example + while (!string.Equals(FWindow.FCurrentAsset, Path.GetFileName(target))) { FWindow.FCurrentAsset = Path.GetFileName(target); - }); + } LoadAsset(target); } }