c# - WP7 Skydrive API - creating folder doesnt work -


i try this tutorial create new folder on skydrive wp7 app.

here code:

    private void msaccountlogintoggleswitch_checked_1(object sender, routedeventargs e)     {         try         {             liveauthclient auth = new liveauthclient("** id **");             auth.loginasync(new string[] { "wl.skydrive_update", "wl.calendars_update" });             auth.logincompleted += auth_logincompleted;         }         catch (liveauthexception exception)         {             messagebox.show("error signing in: " + exception.message);         }     }      private void auth_logincompleted(object sender, logincompletedeventargs e)     {         if (e.status == liveconnectsessionstatus.connected)         {             mysession = e.session;         }         else         {             msaccountlogintoggleswitch.ischecked = false;         }     }      private void button_click_1(object sender, routedeventargs e)     {         try         {             var folderdata = new dictionary<string, object>();             folderdata.add("some test", "a brand new folder created");              liveconnectclient liveclient = new liveconnectclient(mysession);             liveclient.postasync("me/skydrive", folderdata);         }         catch (liveconnectexception exception)         {             messagebox.show("error creating folder: " + exception.message);         }                 {             messagebox.show("uploded");         }     } 

it show me messagebox "uploaded", when on skydrive file not created.

it doesnt show error message, im doing worng?

this line liveclient.postasync("me/skydrive", folderdata); gives task not wait, show messagebox.show("uploded"); @ end. don't think async / await supported in wp7, need handle task continuewith method:

private void button_click_1(object sender, routedeventargs e) {         var folderdata = new dictionary<string, object>();         folderdata.add("some test", "a brand new folder created");          liveconnectclient liveclient = new liveconnectclient(mysession);         liveclient.postasync("me/skydrive", folderdata)                   .continuewith((t) =>                                   {                                      if (t.isfauled)                                     {                                        messagebox.show("error creating folder: " + t.exception.message);                                     }                                     else                                     {                                         messagebox.show("uploded");                                       }                                  }                                 , taskscheduler.fromcurrentsynchronizationcontext());  } 

updated: code above work on wp8, on wp7 postasync not method task, postasync result need subscribe postcompleted event.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -