﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Ex_HandlingRepetition
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            List<Person> people = Data.GetPeople();

            for (int i = 0; i < people.Count; i++)
            {
                ListViewItem lviPerson = new ListViewItem(people[i].FirstName);
                lviPerson.SubItems.Add(people[i].LastName);
                lviPerson.SubItems.Add(people[i].Position);
                lviPerson.SubItems.Add(people[i].HomeWorld);

                lvPeople.Items.Add(lviPerson);
            }
        }
    }
}
