static async public Task RestoreAsync()
{
// Get the input stream for the SessionState file.
try
{
StorageFile file = await ApplicationData.Current.LocalFolder.GetFileAsync(filename);
if (file == null) return;
using (IInputStream inStream = await file.OpenSequentialReadAsync())
{
// Deserialize the Session State.
DataContractSerializer serializer = new DataContractSerializer(typeof(Dictionary<string, object>), knownTypes_);
sessionState_ = (Dictionary<string, object>)serializer.ReadObject(inStream.AsStreamForRead());
}
}
catch (Exception)
{
// Restoring state is best-effort. If it fails, the app will just come up with a new session.
}
}
}