/// <summary> /// Requires the type of the contactList to be generated /// Once generetaed add the retails of the contacts to the contact list and returns ContactListView to be added to the controls /// </summary> /// <param name="type">The type wether its "load" or "search" and depending on the type the releavant panel is been loaded</param> /// <returns>The List of Contacts that should be added to the panels</returns> private List <ContactListView> GenerateContactList(String type) { this.AddSeachHeaderAndClose(); List <Contact> contactList = new List <Contact>(); if (type.Equals("load")) { contactList = contactHelper.GetUserContacts(); } else if (type.Equals("search")) { contactList = contactHelper.GetUserContactsByName(txt_search.Text.Trim()); } List <ContactListView> contactLists = new List <ContactListView>(); foreach (Contact contactDetails in contactList) { ContactListView contact = new ContactListView(); contact.Tag = contactDetails.ContactId; contact.ContactName = contactDetails.Name; contact.ContactEmail = contactDetails.Email; contact.ContactId = contactDetails.ContactId; contact.ContactImage = commonUtil.Base64ToBitmap(contactDetails.Image); contact.Name = $"ctx_"; contact.Click += new EventHandler(this.ContactControlClick); contactLists.Add(contact); } return(contactLists); }