I AM BEING DRIVEN MAD BY THIS
So I'm trying to write a Metro App. Leaving aside the tiresome fact that half the framework has been ripped out, there is one thing which I just can't get right.
I want to get all the files in a folder (recursively actually but that bit doesn't matter) and I want to do it synchronously. I believe
is the class for this as it represents a folder.
Now if it had a
method I'd be happy, but instead its got
. All I want to do is call this method synchronously.
Now if I call this, it just returns immediately which I understand is the nature of async calls when they block. So I could await for it to finish:
IReadOnlyList<StorageFile> f = await requestedFolder.GetFilesAsync();
But that would mean having to mark the calling method as async and would just propagate the pain to the method above it. And so it goes on, in order to wait for a method to finish you need to 'await' but that means making the caller async etc. etc. until the whole application has become one massive asynchronous soup.
Bearing in mind async methods return
s, I've tried
ing on that but that just causes immediate deadlock (on a single thread from what I can tell - nice).
Any ideas? No smart answers about Google being my friend - it isn't. I've been pleading with it for the last 5 hours for an answer.