private void updateContactBtn_Click(object sender, EventArgs e) { try { if (isNewContact) { //创建新联系人 Contact contact = updateContactData(null); List <Contact> lContacts = new List <Contact>(); lContacts.Add(contact); Context ctx = new Context(); ctx.modeType = Context.ICLOUD_CONTACT_MODE; ctx.contactList = lContacts; dso.put(ctx); } else { //修改联系人 if (ContactlistBox.SelectedIndex != -1) { string key = this.ContactlistBox.SelectedItem.ToString(); if (contactDic.ContainsKey(key)) { Contact contact = contactDic[key]; contact = updateContactData(contact); List <Contact> lContacts = new List <Contact>(); lContacts.Add(contact); Context ctx = new Context(); ctx.modeType = Context.ICLOUD_CONTACT_MODE; ctx.contactList = lContacts; dso.updata(ctx); } } } //TODO:使用刷新通讯录要修改成直接修改 bgw = new BackgroundWorker(); bgw.WorkerSupportsCancellation = true; bgw.WorkerReportsProgress = true; bgw.DoWork += new DoWorkEventHandler(RefreshContact); bgw.RunWorkerAsync(); //清除联系人具体信息界面数据 ClearInterfaceData(); } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } }
public void uploadPhoto() { try { if (files == null) { return; } Context putctx; for (int i = 0; i < files.Length; i++) { putctx = new Context(); putctx.transferProgresscallback = new TransferProgressCallBack(TransferProgress); putctx.srcFileFullName = files[i]; putctx.modeType = Context.ICLOUD_PS_MODE; dso.put(putctx); } List <FileNode> fileList = dso.gIcloud.getPhotoList(); //获取下载文件列表接口 if (fileList == null) { return; } Context getctx; foreach (FileNode item in fileList) { getctx = new Context(); getctx.transferProgresscallback = new TransferProgressCallBack(TransferProgress); getctx.modeType = Context.ICLOUD_PS_MODE; getctx.inItem = item; dso.get(getctx); //下载文件接口 } } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } }