private void updateCart() { //update totalcost string temp = TotalCost.ToString(); totalcostString.Text = temp; // update cart mLVCart = FindViewById <ListView>(Resource.Id.lvBooksCart); IBook_LV_Adpater adapterCart = new IBook_LV_Adpater(this, mIBookCart); mLVCart.Adapter = adapterCart; }
public override void OnActivityCreated(Bundle savedInstanceState) { Dialog.Window.RequestFeature(WindowFeatures.NoTitle); // sets the title bar to invisable base.OnActivityCreated(savedInstanceState); Dialog.Window.Attributes.WindowAnimations = Resource.Style.dialog_animation; List <bookstore.backend.Class.IBooksWithInterface> temList = new List <IBooksWithInterface>(); decimal totalcost = 0; foreach (var book in InCart.BooksInCart) { int status = bookstore.backend.Class.ShopingCart.check(book.InStock, book.NumberOfThisBookIncart); if (status != 0) { totalcost = bookstore.backend.Class.ShopingCart.TotalCost(totalcost, book.Price, status); IBooksWithInterface temp = new IBooksWithInterface(book.Title, book.Author, book.Price, book.InStock); temp.NumberOfThisBookIncart = status; temList.Add(temp); } } IBook_LV_Adpater adapterBooksBought = new IBook_LV_Adpater(this.Activity, temList); fragLVbooksBought.Adapter = adapterBooksBought; List <bookstore.backend.Class.IBooksWithInterface> temList2 = new List <IBooksWithInterface>(); foreach (var book in InCart.BooksInCart) { int status = bookstore.backend.Class.ShopingCart.outofstock(book.InStock, book.NumberOfThisBookIncart); if (status != -1) { IBooksWithInterface temp = new IBooksWithInterface(book.Title, book.Author, book.Price, book.InStock); temp.NumberOfThisBookIncart = status; temList2.Add(temp); } } fragtxtTotalcost.Text = "Totalcost: " + totalcost.ToString(); IBook_LV_Adpater adapterBooksNotBought = new IBook_LV_Adpater(this.Activity, temList2); fragLVbooksNonBought.Adapter = adapterBooksNotBought; }
private async void button1_clicked(object sender, EventArgs e) { EditText search = (EditText)FindViewById(Resource.Id.txtSearch); string search2 = search.Text; mLVSearch = FindViewById <ListView>(Resource.Id.lvBooksSearch); bookstore.backend.Class.IBookstoreService s = new bookstore.backend.Class.IBookstoreService(); IEnumerable <bookstore.backend.IBook> result = await s.GetBooksAsync(search2); mIBook = new List <bookstore.backend.Class.IBooksWithInterface>(); foreach (bookstore.backend.Class.IBooksWithInterface t in result) { mIBook.Add(t); } //write adapter for result IBook_LV_Adpater adapter = new IBook_LV_Adpater(this, mIBook); mLVSearch.Adapter = adapter; }