private void AddProducts(int index, int count)
        {
            Random   r        = new Random();
            Assembly assembly = typeof(MainPage).GetTypeInfo().Assembly;

            for (int i = index; i < index + count; i++)
            {
                if (i % 2 == 0)
                {
                    var contact = new Contacts(CustomerNames[r.Next(1, 120)], r.Next(720, 799).ToString() + " - " + r.Next(3010, 3999).ToString());
                    contact.ContactImage = ImageSource.FromResource("ListViewPrism.Images.Image" + r.Next(0, 28) + ".png", assembly);
                    contact.ContactColor = Color.FromRgb(r.Next(40, 255), r.Next(40, 255), r.Next(40, 255));
                    contact.TemplateType = TemplateType.TemplateOne;
                    ContactsInfo.Add(contact);
                }
                else
                {
                    var contact = new Contacts(CustomerNames[r.Next(1, 120)], r.Next(720, 799).ToString() + " - " + r.Next(3010, 3999).ToString());
                    contact.ContactImage = ImageSource.FromResource("ListViewPrism.Images.Image" + r.Next(0, 28) + ".png", assembly);
                    contact.ContactColor = Color.FromRgb(r.Next(40, 255), r.Next(40, 255), r.Next(40, 255));
                    contact.TemplateType = TemplateType.TemplateTwo;
                    ContactsInfo.Add(contact);
                }
            }
        }
        public void GenerateInfo()
        {
            Random r = new Random();

            for (int i = 0; i < 30; i++)
            {
                var contact = new Contacts(CustomerNames[i], r.Next(720, 799).ToString() + " - " + r.Next(3010, 3999).ToString());
                contact.ContactImage = ImageSource.FromResource("ListViewXamarin.Images.Image" + r.Next(0, 28) + ".png");
                ContactsInfo.Add(contact);
            }
        }
예제 #3
0
        private void GeneratePersonalContacts()
        {
            contactsInfo = new ObservableCollection <Contacts>();
            Random r = new Random();

            for (int i = 0; i < CustomerNames.Count(); i++)
            {
                var contact1 = new Contacts(CustomerNames[i], i.ToString());
                contact1.ContactImage = ImageSource.FromResource("Scrolling.Images.Image" + r.Next(0, 28) + ".png");
                contact1.ContactType  = "Personal";
                ContactsInfo.Add(contact1);
            }
        }
        public void GenerateSource()
        {
            Random   random   = new Random();
            Assembly assembly = typeof(MainPage).GetTypeInfo().Assembly;

            for (int i = 0; i < CustomerNames.Count(); i++)
            {
                var details = new ListViewContactsInfo()
                {
                    ContactType   = contactType[random.Next(0, 5)],
                    ContactNumber = random.Next(100, 400).ToString() + "-" + random.Next(500, 800).ToString() + "-" + random.Next(1000, 2000).ToString(),
                    ContactName   = CustomerNames[i],
                    ContactImage  = ImageSource.FromResource("SfListViewSample.Images.Image" + random.Next(0, 28) + ".png", assembly),
                };
                ContactsInfo.Add(details);
            }
        }