public static void SetMyBooks(List <Book> bookList) { try { BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += delegate { SaveMyStuff_2 webService = new SaveMyStuff_2(Server.GenerateContentSyncURL(Settings.ServerURL)); if (Settings.UseFormsAuth) { webService.CookieContainer = Authenticate.GetCookieContainer(); } else { webService.Credentials = KeychainAccessor.NetworkCredential; } MyBookObj[] myBooks = new MyBookObj[bookList.Count]; for (Int32 i = 0; i < bookList.Count; i++) { MyBookObj mb = GenerateBookObj(bookList[i]); myBooks[i] = mb; } webService.SetMyBooks(myBooks); }; worker.RunWorkerCompleted += delegate { if (SetMyBooksEvent != null) { SetMyBooksEvent(); } }; worker.RunWorkerAsync(); } catch (Exception ex) { Logger.WriteLineDebugging("SaveMyStuff - SetMyBooks: {0}", ex.ToString()); } }
public static void SetMyBooksToCloud(MyBookObj[] myBooks) { SaveMyStuff_2 client = GenerateSaveMyStuffClient(); client.SetMyBooks(myBooks); }