Skip to content

Instantly share code, notes, and snippets.

@jhaynie
Forked from mtnlife999/gist:8247140
Last active January 2, 2016 03:59
Show Gist options
  • Save jhaynie/8247195 to your computer and use it in GitHub Desktop.
Save jhaynie/8247195 to your computer and use it in GitHub Desktop.
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");
});
// this will only happen after Testing Sync Ops output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment