Exemplo n.º 1
0
        private async void listView_RefreshActivated(object sender, EventArgs e)
        {
            if (!refreshing)
            {
                refreshing = true;
                progress.Visibility = Visibility.Visible;

                await Task.Delay(1000);

                for (int i = 0; i < 3; i++)
                {


                    Email mail = new Email();
                    mail.From = Faker.Name.FullName();
                    mail.Subject = Faker.Lorem.Sentence();
                    mail.Content = Faker.Lorem.Paragraph(3);
                    mail.Time = DateTime.Now;
                    mail.Read = false;

                    Emails.Insert(0, mail);

                    await Task.Delay(100 * (i + 1));
                }

                fakeNow = DateTime.Now;

                progress.Visibility = Visibility.Collapsed;

                refreshing = false;
            }

            

        }
Exemplo n.º 2
0
        public MainPage()
        {
            this.InitializeComponent();
            fakeNow = DateTime.Now;
            Random gen = new Random();

            Emails = new ObservableCollection<Email>();
            for (int i = 0; i < 40; i++)
            {
                Email mail = new Email();
                mail.From = Faker.Name.FullName();
                mail.Subject = Faker.Lorem.Sentence();
                mail.Content = Faker.Lorem.Paragraph(3);
                mail.Time = DateTime.Now;
                mail.Read = gen.Next(100) < 80 ? true : false;
                Emails.Add(mail);
            }
        }