From db4f2d5ffbbcf3ba90a4aa5c563314c40d5bacb1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 15 Dec 2020 12:52:45 +0900 Subject: [PATCH] Refresh view after import succeeds --- osu.Game/Screens/Import/FileImportScreen.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Import/FileImportScreen.cs b/osu.Game/Screens/Import/FileImportScreen.cs index 72032c82b8..3646dc819c 100644 --- a/osu.Game/Screens/Import/FileImportScreen.cs +++ b/osu.Game/Screens/Import/FileImportScreen.cs @@ -154,16 +154,17 @@ namespace osu.Game.Screens.Import if (string.IsNullOrEmpty(path)) return; - if (!File.Exists(path)) - { - currentFileText.Text = "No such file"; - currentFileText.FlashColour(colours.Red, duration); - return; - } + Task.Factory.StartNew(async () => await game.Import(path), TaskCreationOptions.LongRunning) + .ContinueWith(_ => + { + // some files will be deleted after successful import, so we want to refresh the view. - string[] paths = { path }; - - Task.Factory.StartNew(() => game.Import(paths), TaskCreationOptions.LongRunning); + Schedule(() => + { + // should probably be exposed as a refresh method. + fileSelector.CurrentPath.TriggerChange(); + }); + }); } } }