private void syncCategories() { CategoryList catList = new CategoryList(); IEnumerable<Category> cats = catList.getNotSynchronized(); foreach (Category cat in cats) { cat.uploadFolder(); } //HomeWindow.refreshCurrentTab(); }
private void getFilesFromServiceCallback(RequestResult result) { CategoryList catList = new CategoryList(); if (result.StatusCode == 200) { foreach (UniValue value in result["contents"]) { String path = value["path"].ToString(); if ((Boolean)value["is_dir"] == false) { var split = path.Split(new char[] {'/'}); if (split.Count() == 3) { string categoryName = split[1].ToString(); string fileName = split[2].ToString(); Category catObject = catList.searchByName(categoryName); Easyshare.Classes.File file = new Easyshare.Classes.File(); file.name = System.IO.Path.ChangeExtension(fileName, null); file.categoryId = catObject.id; file.path = "Downloaded/" + fileName; file.sync = true; file.insertFile(); } } } } }
private void getCategoriesFromServiceCallback(RequestResult result) { CategoryList catList = new CategoryList(); if (result.StatusCode == 200) { foreach (UniValue value in result["contents"]) { String folderName = value["path"].ToString().Replace("/", ""); if ((Boolean)value["is_dir"] == true && !catList.isInserted(folderName)) { Category c = new Category(); c.name = folderName; c.owner_id = Easyshare.Classes.Owner.SessionOwnerId; c.sync = true; c.insert(); this.getFilesFromService(c); } } /* String userName = result["display_name"].ToString(); String userEmail = result["email"].ToString(); this.Dispatcher.Invoke((Action)(() => { this.user_email_text.Text = userEmail; RegisterEventHandler(this.registerButton, null); })); */ // show a list of files } }