当前位置: 首页>>代码示例>>C#>>正文


C# Contact.ToString方法代码示例

本文整理汇总了C#中Contact.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Contact.ToString方法的具体用法?C# Contact.ToString怎么用?C# Contact.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contact的用法示例。


在下文中一共展示了Contact.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateCircleMembersFromAddressBookContactPage

        private bool UpdateCircleMembersFromAddressBookContactPage(Contact circle, Scenario scene)
        {
            string lowerId = circle.AddressBookId.ToString("D").ToLowerInvariant();
            if (!HasAddressBookContactPage(lowerId))
                return false;

            Dictionary<long, ContactType> newContactList = null;
            Dictionary<long, Contact> oldContactInverseList = null;
            Contact[] oldContactList = null;

            bool isRestore = ((scene & Scenario.Restore) != Scenario.None);

            if (!isRestore)
            {
                newContactList = new Dictionary<long, ContactType>();
                oldContactInverseList = new Dictionary<long, Contact>();
                oldContactList = circle.ContactList.ToArray(IMAddressInfoType.Circle);
                foreach (Contact contact in oldContactList)
                {
                    oldContactInverseList[contact.CID] = contact;
                }
            }

            lock (AddressbookContacts)
            {
                SerializableDictionary<Guid, ContactType> page = AddressbookContacts[lowerId];

                foreach (ContactType contactType in page.Values)
                {
                    if (!isRestore)
                        newContactList[contactType.contactInfo.CID] = contactType;

                    Contact tmpContact;
                    if ((UpdateContact(contactType, lowerId, circle, out tmpContact) & ReturnState.ProcessNextContact) == ReturnState.None)
                    {
                        Trace.WriteLineIf(Settings.TraceSwitch.TraceInfo, "[UpdateCircleMembersFromAddressBookContactPage] Create circle member failed: " +
                            contactType.contactInfo.passportName + ", UpdateContact returns false.");
                    }
                }
            }

            if (isRestore)
                return true;

            foreach (ContactType contactType in newContactList.Values)
            {
                if (contactType.contactInfo == null)
                    continue;

                string passportName = contactType.contactInfo.passportName;

                if (String.IsNullOrEmpty(passportName) && contactType.contactInfo.emails != null)
                {
                    foreach (contactEmailType emailType in contactType.contactInfo.emails)
                    {
                        if (emailType.contactEmailType1 == ContactEmailTypeType.ContactEmailMessenger &&
                            !String.IsNullOrEmpty(emailType.email))
                        {
                            passportName = emailType.email;
                            break;
                        }
                    }
                }

                if (!oldContactInverseList.ContainsKey(contactType.contactInfo.CID) &&
                    circle.ContactList.HasContact(passportName, IMAddressInfoType.WindowsLive))
                {
                    circle.NSMessageHandler.ContactService.OnCircleMemberJoined(new CircleMemberEventArgs(circle,
                        circle.ContactList.GetContactWithCreate(passportName, IMAddressInfoType.WindowsLive)));
                }
            }

            foreach (Contact contact in oldContactList)
            {
                if (!newContactList.ContainsKey(contact.CID))
                {
                    Trace.WriteLineIf(Settings.TraceSwitch.TraceVerbose, "Member " + contact.ToString() + " has left circle " + circle.ToString());
                    circle.ContactList.Remove(contact.Account, contact.ClientType);
                    circle.NSMessageHandler.ContactService.OnCircleMemberLeft(new CircleMemberEventArgs(circle, contact));
                }
            }

            return true;
        }
开发者ID:quynh68,项目名称:msnp-sharp,代码行数:84,代码来源:XMLContactList.cs

示例2: ContactActionDelete

 public ContactActionDelete(ContactsRequest request, Contact googleContact)
     : base(request, googleContact, googleContact.ToString() + " will be deleted.")
 {
 }
开发者ID:stuartleyland,项目名称:MaintainWorkContacts,代码行数:4,代码来源:ContactActionDelete.cs

示例3: CreateNewContact

        private static Item CreateNewContact(Contact selectedPerson, Item list = null)
        {
            Guid id = Guid.NewGuid();
            // get the default list for contacts
            Guid folderID;
            Guid? parentID = null;

            ClientEntity defaultList = list ??  App.ViewModel.GetDefaultList(SystemItemTypes.Contact);
            if (defaultList == null)
            {
                TraceHelper.AddMessage("CreateNewContact: error - could not find default contact list");
                return null;
            }
            if (defaultList is Item)
            {
                folderID = ((Item)defaultList).FolderID;
                if (defaultList.ID != Guid.Empty)
                    parentID = defaultList.ID;
            }
            else
            {
                folderID = defaultList.ID;
                parentID = null;
            }

            Item newContact = new Item()
            {
                ID = id,
                Name = selectedPerson.ToString(),
                FolderID = folderID,
                ParentID = parentID,
                ItemTypeID = SystemItemTypes.Contact,
                FieldValues = new ObservableCollection<FieldValue>()
            };

            // add the new contact locally
            Folder folder = App.ViewModel.Folders.FirstOrDefault(f => f.ID == folderID);
            if (folder == null)
            {
                TraceHelper.AddMessage("CreateNewContact: error - could not find the folder for this item");
                return null;
            }
            folder.Items.Add(newContact);

            // save the current state of the folder
            StorageHelper.WriteFolder(folder);

            // enqueue the Web Request Record
            RequestQueue.EnqueueRequestRecord(RequestQueue.UserQueue,
                new RequestQueue.RequestRecord()
                {
                    ReqType = RequestQueue.RequestRecord.RequestType.Insert,
                    Body = newContact,
                });

            return newContact;
        }
开发者ID:ogazitt,项目名称:zaplify,代码行数:57,代码来源:ContactPickerHelper.cs


注:本文中的Contact.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。