I have method with signature I cannot change. It should be
protected override void OnInitialize()
Using Windows 8 Metro API I need to check if file exists and read it, inside this NoSignatureChange method. Using PlainOldCSharp, I would write something like
protected override void OnInitialize()
{
...
try
{
var file = folder.OpenFile(fileName);
fileExists=true;
}
catch(FileNotFoundException)
{
fileExists=false
}
}
Remember, in Windows 8 API only way to check if file exists is handling FileNotFoundException Also, in Windows 8 API all FileIO API is async, so I have only file.OpenFileAsync method.
So, the question is: How should I write this code using folder.OpenFileAsync method in Windows 8 API without changing signature of containing method