async/background TryDeleteIfExistsAsync & DeleteContentsOfDir

This commit is contained in:
N00MKRAD
2021-05-09 18:31:39 +02:00
parent b3a32ff557
commit f9a631340d
7 changed files with 72 additions and 84 deletions

View File

@@ -242,11 +242,11 @@ namespace Flowframes
{
DialogResult dialogResult = MessageBox.Show($"Delete the temp folder (Yes) or keep it for resuming later (No)?", "Delete temporary files?", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
IOUtils.TryDeleteIfExists(current.tempFolder);
Task.Run(async () => { await IOUtils.TryDeleteIfExistsAsync(current.tempFolder); });
}
else
{
IOUtils.TryDeleteIfExists(current.tempFolder);
Task.Run(async () => { await IOUtils.TryDeleteIfExistsAsync(current.tempFolder); });
}
}
@@ -266,7 +266,7 @@ namespace Flowframes
Logger.Log("Deleting temporary files...");
try
{
Directory.Delete(current.tempFolder, true);
await Task.Run(async () => { Directory.Delete(current.tempFolder, true); });
}
catch (Exception e)
{