public void setFakeContacts() { List <Contact> contacts = new List <Contact>(); MessageInfoData messageInfoData = new MessageInfoData(); _randomizer = new Random(); for (int i = 0; i < 5; i++) { int id = ContactController.getNewContactId(); ContactInfoData data = new ContactInfoData() { _NickName = "Nickname" + id.ToString(), _ID = id, _ContactStateType = (ContactStateType)_randomizer.Next(0, 2) }; contacts.Add(new Contact(data)); addFakeMessages(_randomizer.Next(1, 10)); } _Chat._User.AddContacts(contacts); void addFakeMessages(int pNumperOfMessages) { for (int i = 0; i < pNumperOfMessages; i++) { contacts[contacts.Count - 1].AddMessage(new Message(GetNewFakeMessage(messageInfoData))); } } }
private static List <SerializableContactInfoData> GetContactInfoDataList(List <Contact> pContactList) { List <SerializableContactInfoData> ContactListData = new List <SerializableContactInfoData>(); for (int i = 0; i < pContactList.Count; i++) { ContactInfoData c = pContactList[i]._ContactInfoData; ContactListData.Add(new SerializableContactInfoData(c._ID, c._NickName, c._ContactStateType, GetMessageInfoDataList(pContactList[i].GetMessages()))); } return(ContactListData); }
private void TestContacts() { List <Contact> contacts = new List <Contact>(); for (int i = 0; i < 15; i++) { ContactInfoData data = new ContactInfoData(); data._NickName = "Ahoj" + i; data._ID = i; Contact contact = new Contact(data); contact.AddMessages(GetTestMessages()); contacts.Add(contact); } _Chat.User.AddContacts(contacts); }
private static List <Contact> GetContactList(List <SerializableContactInfoData> contactInfoDataList) { List <Contact> contacts = new List <Contact>(); for (int i = 0; i < contactInfoDataList.Count; i++) { SerializableContactInfoData c = contactInfoDataList[i]; ContactInfoData contactInfoData = new ContactInfoData() { _ContactStateType = c._ContactStateType, _ID = c._ID, //TODO implement loading images from localdisk _NickName = c._NickName }; contacts.Add(new Contact(contactInfoData, GetMessageList(c._MessageInfoDataList))); } return(contacts); }
public void UpdateContactInfo(ContactInfoData pContactInfo) { _ContactInfoData = pContactInfo; }
public Contact(ContactInfoData pContactInfo) { UpdateContactInfo(pContactInfo); }
public Contact(ContactInfoData pContactInfo, List <Message> pMessageList) { UpdateContactInfo(pContactInfo); _MessageList = pMessageList; }