Ejemplo n.º 1
0
        private void populateView(object sender, GetAllProductsEventArgs args)
        {
            showBusyIndicator();

            // get the list of products
            List <IProduct> products = args.getList().ToList();

            // tell the listView it is being updated
            listView_products.BeginUpdate();

            // clean the list view
            foreach (ListViewItem item in listView_products.Items)
            {
                listView_products.Items.Remove(item);
            }

            // populate it
            foreach (Product product in products)
            {
                string[] itemArr = new string[4];
                itemArr[0] = product.ProductIDNumber;
                itemArr[1] = product.Description;
                itemArr[2] = product.Quantity.ToString();
                itemArr[3] = product.price.ToString();

                ListViewItem item = new ListViewItem(itemArr);
                item.Font = new Font(item.Font, FontStyle.Regular);
                listView_products.Items.Add(item);
            }

            // tell the listView it is ready
            listView_products.EndUpdate();

            removeBusyIndicator();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Event handler for the service layer retrieving all product records.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void Service_GetAllProducts(object sender, GetAllProductsEventArgs args)
 {
     // update the views
     foreach (var view in views)
     {
         view.populateProducts(args.getList());
     }
 }
Ejemplo n.º 3
0
 // event handler for model events
 private void loadDataEventHandler(object sender, GetAllProductsEventArgs args)
 {
     productList = args.getList().ToList();
 }