我正在尝试在我的应用程序中实现此代码以将数据备份到 skydrive http://netitude.bc3tech.net/2012/07/11/skydrive-backup-of-your-mobile-applets-get-some-common-ground /
但是我如何无法安装 Async CTP(我在 2-3 天内进行了测试,但 async ctp 没有安装好……我已经尝试过解决方案,但问题仍然存在)。可以做同样的事情但不使用异步吗?如何等待完成任务才能继续?
使用这些工具“Windows Phone SDK 7.1 和 7.1.1 更新”:https ://dev.windowsphone.com/en-us/downloadsdk
(...)
var rootFolders = JObject.Parse((await client.GetAsyncTask("/me/skydrive/files?filter=folders,albums")).RawResult);
var progDataFolder = rootFolders["data"].FirstOrDefault(f => f.Value<string>("name").Equals("programdata", StringComparison.OrdinalIgnoreCase));
string progDataFolderId;
if (progDataFolder == null)
{
var result = await client.PostAsyncTask("me/skydrive/",
new Dictionary<string, object>() { { "name", "ProgramData" } });**
progDataFolderId = JObject.Parse(result.RawResult).Value<string>("folder_id");
}
else
{
progDataFolderId = progDataFolder.Value<string>("id");
}
var windowsPhoneFolder = JObject.Parse((await client.GetAsyncTask(string.Concat("/", progDataFolderId, "/files?filter=folders,albums"))).RawResult)["data"]
.FirstOrDefault(f => f.Value<string>("name").Equals("windows phone", StringComparison.OrdinalIgnoreCase));
string windowsPhoneFolderId;
if (windowsPhoneFolder == null)
{
var result = await client.PostAsyncTask(string.Concat("/", progDataFolderId),
new Dictionary<string, object>() { { "name", "Windows Phone" } });**
windowsPhoneFolderId = JObject.Parse(result.RawResult).Value<string>("id");
}
else
{
windowsPhoneFolderId = windowsPhoneFolder.Value<string>("id");
}
(...)
替代执行此操作。例子:
var result = await client.PostAsyncTask("me/skydrive/",
new Dictionary<string, object>() { { "name", "ProgramData" } });