Windows中的System.Threading.Thread替换存储应用程序

jal*_*mes 0 c# xaml multithreading windows-store-apps

Windows Store应用程序中不存在'System.Threading.Thread'是正确的吗?如果是,那么替换是什么(我想在后台运行一个函数,所以UI在计算某些东西时不会自由).用户界面的语言是C#和XAML.

Dus*_*gen 7

使用Task.RunTask.Factory.StartNew

private void BackgroundWork() { ... }

public async Task DoUsefulWorkAsync()
{
    // Do useful work
    // Start Background Job
    Task backgroundWorkTask = Task.Run(() => BackgroundWork());

    // Do more useful work

    // Wait async for BackgroundWork to complete
    // It won't block the UI thread that we're running on
    await backgroundWorkTask;
}
Run Code Online (Sandbox Code Playgroud)