Skip to content

Instantly share code, notes, and snippets.

@Vanlalhriata
Last active August 29, 2015 14:05
Show Gist options
  • Save Vanlalhriata/68a35d8c35301fd0a45d to your computer and use it in GitHub Desktop.
Save Vanlalhriata/68a35d8c35301fd0a45d to your computer and use it in GitHub Desktop.
Using async methods synchronously
var getFileOperation = Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(relativePath);
getFileOperation.AsTask().Wait();
var file = getFileOperation.GetResults();
var openReadOperation = file.OpenReadAsync();
openReadOperation.AsTask().Wait();
using (var stream = openReadOperation.GetResults().AsStreamForRead())
{
return Load(stream, segmentsX, segmentsY, width);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment