Skip to content

Instantly share code, notes, and snippets.

@mtnlife999
Created January 3, 2014 21:39
Show Gist options
  • Save mtnlife999/8247140 to your computer and use it in GitHub Desktop.
Save mtnlife999/8247140 to your computer and use it in GitHub Desktop.
Async
auto _Folder = Windows::Storage::ApplicationData::Current->LocalFolder;
auto _Option = Windows::Storage::CreationCollisionOption::ReplaceExisting;
// create file async
_Folder->CreateFileAsync("MyFileName", _Option);
// create file sync by wrapping in task - then pattern
IAsyncOperation<StorageFile^>^ fileOp = _Folder->CreateFileAsync("MyFileName2", _Option);
auto deviceEnumTask = create_task(fileOp);
deviceEnumTask.then([](StorageFile^ myFile)
{
// file is created
OutputDebugStringA("Testing Sync Ops");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment