async private void uploadtosky_Click(object sender, RoutedEventArgs e)
{
try
{
LiveAuthClient auth = new LiveAuthClient();
LiveLoginResult log = await auth.LoginAsync(new List<string> { "wl-basic", "wl.skydrive", "wl.signin" });
if (log.Status == LiveConnectSessionStatus.Connected)
{
LiveConnectClient uploadcl = new LiveConnectClient(auth.Session);
LiveOperationResult up = await uploadcl.BackgroundUploadAsync("me/skydrive", heading.Text, samplefile, OverwriteOption.Overwrite);
}
}
catch
{
MessageDialog msg = new MessageDialog("Oops ! something went wrong while trying to connect");
msg.ShowAsync();
}
}
当我执行代码片段时,messagebox
显示Oops ! something went wrong while trying to connect
. 我的计算机已连接到 Internet,单击上传按钮后,我会在 Windows 8 应用程序中获得一个真实帐户的登录页面。但是我猜它无法登录该帐户,因此会发生异常。有什么想法可以克服这个问题吗?