Mark several long-running tasks as long-running

This commit is contained in:
Dean Herbert 2017-10-25 11:42:55 +09:00
parent 89cc7b7945
commit c765785d00
3 changed files with 4 additions and 3 deletions

View File

@ -106,7 +106,7 @@ private void fileDrop(object sender, FileDropEventArgs e)
var filePaths = new [] { e.FileName };
if (filePaths.All(f => Path.GetExtension(f) == @".osz"))
Task.Run(() => BeatmapManager.Import(filePaths));
Task.Factory.StartNew(() => BeatmapManager.Import(filePaths), TaskCreationOptions.LongRunning);
else if (filePaths.All(f => Path.GetExtension(f) == @".osr"))
Task.Run(() =>
{

View File

@ -272,7 +272,7 @@ public DownloadBeatmapSetRequest Download(BeatmapSetInfo beatmapSetInfo)
PostNotification?.Invoke(downloadNotification);
// don't run in the main api queue as this is a long-running task.
Task.Run(() => request.Perform(api));
Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning);
return request;
}

View File

@ -29,7 +29,8 @@ private void load(BeatmapManager beatmaps)
Action = () =>
{
importButton.Enabled.Value = false;
Task.Run(() => beatmaps.ImportFromStable()).ContinueWith(t => Schedule(() => importButton.Enabled.Value = true));
Task.Factory.StartNew(beatmaps.ImportFromStable)
.ContinueWith(t => Schedule(() => importButton.Enabled.Value = true), TaskContinuationOptions.LongRunning);
}
},
deleteButton = new SettingsButton