2011-12-15 24 views
-1

我不確定哪個程序集是用於Windows Phone的正確程序集。以下Url展示了一個使用LiveSDK的例子。用於Windows Phone的LiveSDK(LiveConnect Api)或SkyDrive API

http://nikovrdoljak.wordpress.com/2011/09/15/backup-your-windows-phone-isolated-storage-data-to-skydrive-using-live-connect-api/

我已經加入Microsoft.LiveMicrosoft.Live.Control爲參考

代碼:

client.Session.Status != LiveConnectSessionStatus.Connected 

錯誤:

'Microsoft.Live.LiveConnectSession' does not contain a definition for 'Status' 
and no extension method 'Status' accepting a first argument of type 'Microsoft.Live.LiveConnectSession' 
could be found (are you missing a using directive or an assembly reference?) 

代碼:

private LiveConnectClient client; 
private void UploadPhoto_Click(object sender, EventArgs e) 
{ 
    if (client == null || client.Session == null || client.Session.Status != LiveConnectSessionStatus.Connected) 
    { 
     MessageBox.Show("You must sign in first."); 
    } 
    else 
    { 
     client.GetCompleted += new EventHandler<LiveOperationCompletedEventArgs>(GetFolderProperties_Completed); 
     // If you put photo to folder it becomes album. 
     client.GetAsync("me/skydrive/files?filter=folders,albums"); 
    } 
} 
+0

謝謝指出差異。所以,在上傳功能中,我是否需要檢查:client.Session.Status!= LiveConnectSessionStatus.Connected?登錄檢查現在可以:e.Status == LiveConnectSessionStatus.Connected – MilkBottle 2011-12-15 09:45:30

回答

1

所以很明顯LiveConnectSession沒有Status屬性。爲什麼你一直在想它有它呢?

在示例代碼中,他使用LiveConnectSessionChangedEventArgs類的Status屬性,而不是LiveConnectSession

重新閱讀基礎知識的建議似乎是爲了這裏。

+0

謝謝指出差異。所以,在上傳功能中,我是否需要檢查:client.Session.Status!= LiveConnectSessionStatus.Connected?登錄檢查現在可以:e.Status == LiveConnectSessionStatus.Connected – MilkBottle 2011-12-15 09:47:48

0

Live SDk包含SignIn按鈕和LiveConnet DLL。要連接到SKyDrive,需要使用登錄按鈕登錄。連接後,您可以使用返回會話來創建LiveConnectClient。最好是在執行任何任務之前檢查會話是否還活着SkyDrive的。