public void showWishlist(ref WishListDialog wd) { foreach (Book b in wishlist) { wd.AddDisplayItems(b.WishlistString()); } }
public void updateWishListDialog(WishListDialog wld) { foreach (Book displayBook in LoggedinCustomer.wishList) { wld.AddDisplayItems("\"" + displayBook.name + "\" BY " + displayBook.author); } }
private void bnShowWishlist_Click(object sender, EventArgs e) { // XXX Show WishList Button event handler if (!_attachedControl.IsLoggedIn()) { MessageBox.Show("Customer not logged in."); return; } while (true) { try { // to capture an excepton by SelectedItem/SelectedIndex of wishListDialog wishListDialog.ClearDisplayItems(); wishListDialog.AddDisplayItems(_attachedControl.CurrentCustomer.WishList.ToArray()); // XXX null is a dummy argument if (wishListDialog.Display() == DialogReturn.Done) { return; } //// select is pressed WishListItem selectedWishListItem = (WishListItem)wishListDialog.SelectedItem; _attachedControl.PopulateBookDialog(selectedWishListItem.AttachedBook, bookInWishListDialog); //XXX switch (bookInWishListDialog.Display()) { case DialogReturn.AddToCart: // XXX _attachedControl.CurrentCustomer.AddToCartFromWishList(selectedWishListItem); continue; case DialogReturn.Remove: // XXX _attachedControl.CurrentCustomer.RemoveFromWishList(selectedWishListItem); continue; case DialogReturn.Done: // Done continue; } } catch (BookShopException bsex) { MessageBox.Show(this, bsex.ErrorMessage); continue; } } }