private void populateView(object sender, GetAllCustomersEventArgs args) { showBusyIndicator(); List <ICustomer> customers = args.getList().ToList(); // tell the listView it is being updated listView_customers.BeginUpdate(); // clean the listView listView_customers.Items.Clear(); // now fill it foreach (Customer customer in customers) { string[] itemArr = new string[8]; itemArr[0] = customer.CustomerID.ToString(); itemArr[1] = customer.FullName; itemArr[2] = customer.Address; itemArr[3] = customer.PhoneNumber; itemArr[4] = customer.Email; itemArr[5] = customer.City; itemArr[6] = customer.state.ToString(); itemArr[7] = customer.Postcode.ToString(); ListViewItem item = new ListViewItem(itemArr); item.Font = new Font(item.Font, FontStyle.Regular); listView_customers.Items.Add(item); } // tell the listView it is ready listView_customers.EndUpdate(); removeBusyIndicator(); }
// event handler for model events private void loadDataEventHandler(object sender, GetAllCustomersEventArgs args) { this.customerList = args.getList().ToList(); }