I have difficulties to implement loading a savegame file in my Windows Phone project. I use EasyStorage to load and save files. I get the following exception when I try to load after saving a file.

An exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll but was not handled in user code

I'm sure that I get this exception because saving is not finished when I try to load the file. But how can I solve the problem? I want to load the file after it was created. The file needs to be created when you start the game the first time.

What is the best way to solve the problem?

public void LoadingData()
{
{
if ((saveDevice.FileExists("TestContainer", "Data" + ".txt")) == false)
{
// save a file asynchronously. this will trigger IsBusy to return true
// for the duration of the save process.
saveDevice.SaveAsync(
"TestContainer",
"Data" + ".txt",
stream =>
{
using (StreamWriter writer = new StreamWriter(stream))
{
writer.WriteLine(10 + ";" + 2 + ";" + 2);
int Start = -50;
int Offset = 150;
int Row = 150;
for (int i = 0; i <= 5 - 1; i++)
{
Start += Offset;
writer.WriteLine("Image" + (i + 1).ToString() + ";" + Start + ";" + Row + ";" + false);
}
}
});

"TestContainer",
"Data" + ".txt",
stream =>
{
{
game1.Levels = int.Parse(strs[0]);
game1.LevelProgress = int.Parse(strs[1]);
game1.CurrentLevel = int.Parse(strs[2]);
}
});
}
else
{
"TestContainer",
"Data" + ".txt",
stream =>
{
{
game1.Levels = int.Parse(strs[0]);
game1.LevelProgress = int.Parse(strs[1]);
game1.CurrentLevel = int.Parse(strs[2]);
}
});
}
}
}