Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
 private void staffEventHandler(object sender, GetAllStaffEventArgs args)
 {
     if (listView_staff.InvokeRequired)
     {
         listView_staff.Invoke(new populateStaffViewDelegate(populateView), new object[] { sender, args });
     }
     else
     {
         populateView(sender, args);
     }
 }
Ejemplo n.º 4
0
 // event handler for model events
 private void loadDataEventHandler(object sender, GetAllStaffEventArgs args)
 {
     staffList = args.getList().ToList();
 }