private void populateView(object sender, GetAllStaffEventArgs args) { showBusyIndicator(); // tell the listView it is being updated listView_staff.BeginUpdate(); // clear the listView listView_staff.Items.Clear(); // populate it foreach (var staff in args.getList()) { string[] itemArr = new string[4]; itemArr[0] = staff.StaffID.ToString(); itemArr[1] = staff.FullName; itemArr[2] = staff.PasswordHash; itemArr[3] = staff.privelege.ToString(); ListViewItem staffListViewItem = new ListViewItem(itemArr); staffListViewItem.Font = new Font(staffListViewItem.Font, FontStyle.Regular); listView_staff.Items.Add(staffListViewItem); } // tell the listView it is ready listView_staff.EndUpdate(); removeBusyIndicator(); }
private void populateView(object sender, GetAllStaffEventArgs args) { // tell the listView it is being updated listView_staff.BeginUpdate(); // clear the listView foreach (ListViewItem staffListViewItem in listView_staff.Items) { listView_staff.Items.Remove(staffListViewItem); } // populate it foreach (var staff in args.getList()) { string[] itemArr = new string[4]; itemArr[0] = staff.StaffID.ToString(); itemArr[1] = staff.FullName; itemArr[2] = staff.PasswordHash; itemArr[3] = staff.privelege.ToString(); ListViewItem staffListViewItem = new ListViewItem(itemArr); listView_staff.Items.Add(staffListViewItem); } // tell the listView it is ready listView_staff.EndUpdate(); }
// event handler for model events private void loadDataEventHandler(object sender, GetAllStaffEventArgs args) { staffList = args.getList().ToList(); }