private void delContactBtn_Click(object sender, EventArgs e) { try { if (ContactlistBox.SelectedIndex != -1) { //调用icloud接口删除联系人 string key = this.ContactlistBox.SelectedItem.ToString(); if (contactDic.ContainsKey(key)) { Contact contact = contactDic[key]; List <Contact> lContacts = new List <Contact>(); lContacts.Add(contact); Context ctx = new Context(); ctx.modeType = Context.ICLOUD_CONTACT_MODE; ctx.contactList = lContacts; dso.delete(ctx); } this.ContactlistBox.Items.Remove(this.ContactlistBox.SelectedItem); } //清除联系人具体信息界面数据 ClearInterfaceData(); } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } }
public void delPhoto() { try { if (files == null) { return; } FileInfo f; Context delctx; bool ret = false; for (int i = 0; i < files.Length; i++) { delctx = new Context(); delctx.modeType = Context.ICLOUD_PS_MODE; delctx.srcFileFullName = files[i]; delctx.modeType = Context.ICLOUD_PS_MODE; ret = d.delete(delctx); if (ret) { f = new FileInfo(files[i]); if (f.Exists) { f.Delete(); } } } } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } }