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)));
                }
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
 public void UpdateContactInfo(ContactInfoData pContactInfo)
 {
     _ContactInfoData = pContactInfo;
 }
示例#6
0
 public Contact(ContactInfoData pContactInfo)
 {
     UpdateContactInfo(pContactInfo);
 }
示例#7
0
 public Contact(ContactInfoData pContactInfo, List <Message> pMessageList)
 {
     UpdateContactInfo(pContactInfo);
     _MessageList = pMessageList;
 }