私は、以下のコード スニペットの concurrency::task の構文を理解しようとしています。
このコード スニペットの構文を理解できません。これをどのように分析しますか:
ここで「getFileOperation」とは何ですか。タイプ StorageFile クラスのオブジェクトですか? ここで「then」キーワードとはどういう意味ですか? その後に「{」がある(....)? この構文を解析できませんか?
また、なぜこの concurrency::task().then().. ユース ケースが必要なのですか?
concurrency::task<Windows::Storage::StorageFile^> getFileOperation(installFolder->GetFileAsync("images\\test.png"));
getFileOperation.then([](Windows::Storage::StorageFile^ file)
{
if (file != nullptr)
{
MSDN concurrency::task APIから取得
void MainPage::DefaultLaunch()
{
auto installFolder = Windows::ApplicationModel::Package::Current->InstalledLocation;
concurrency::task<Windows::Storage::StorageFile^> getFileOperation(installFolder->GetFileAsync("images\\test.png"));
getFileOperation.then([](Windows::Storage::StorageFile^ file)
{
if (file != nullptr)
{
// Set the option to show the picker
auto launchOptions = ref new Windows::System::LauncherOptions();
launchOptions->DisplayApplicationPicker = true;
// Launch the retrieved file
concurrency::task<bool> launchFileOperation(Windows::System::Launcher::LaunchFileAsync(file, launchOptions));
launchFileOperation.then([](bool success)
{
if (success)
{
// File launched
}
else
{
// File launch failed
}
});
}
else
{
// Could not find file
}
});
}