コード例 #1
0
 public Call(CallContact contact, int contactPhone, DateTime time, Direction direction)
 {
     Contact      = contact;
     ContactPhone = contactPhone;
     Time         = time;
     Direction    = direction;
 }
コード例 #2
0
        private async Task <List <Call> > GetCall()
        {
            List <Call> newCalls   = new List <Call>();
            CallContact contact    = Contacts.ElementAt(new Random().Next(Contacts.Count));
            int         numbersMax = Contacts.Select(c => c.PhoneNumbers.Count).Max();

            for (int i = 0; i < numbersMax; i++)
            {
                await Task.Delay(700);

                int phoneNumber = contact.PhoneNumbers.ElementAt(
                    new Random().Next(contact.PhoneNumbers.Count));
                Direction direction = (Direction)Enum.ToObject(typeof(Direction),
                                                               new Random().Next(Enum.GetValues(typeof(Direction)).Length));
                newCalls.Add(new Call(contact, phoneNumber, DateTime.Now, direction));
            }

            return(newCalls);
        }