private void OnRestoreClicked(オブジェクト送信者, RoutedEventArgs e) {
string id = string.Empty;
client.GetCompleted += (obj, args) =>
{
List<object> items = args.Result["data"] as List<object>;
foreach (object item in items)
{
Dictionary<string, object> file = item as Dictionary<string, object>;
if (file["name"].ToString() == "Expensemanager.bak")
{
id = file["id"].ToString();
}
}
client.DownloadCompleted += (o, a) =>
{
Stream stream = a.Result;
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
var fileToSave = new IsolatedStorageFileStream("expanseManager.sdf", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, storage);
stream.CopyTo(fileToSave);
stream.Flush();
stream.Close();
}
};
client.DownloadAsync(string.Format("{0}/content", id));
};
client.GetAsync("me/skydrive/files");
}
この下の行にエラーがあります...隔離されたストレージでは操作が許可されていません..
var fileToSave = new IsolatedStorageFileStream("expanseManager.sdf", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, storage);