public async Task OnImageNameTapped(object sender, EventArgs args, ProductDetailModel p) { try { var masterDetail = App.Current.MainPage as MasterDetailPage; if (masterDetail == null || masterDetail.Detail == null) { return; } var navigationPage = masterDetail.Detail as NavigationPage; if (navigationPage == null) { masterDetail.Detail = new NavigationPage(new ProductDetailPage(p)); masterDetail.IsPresented = false; return; } await navigationPage.Navigation.PushAsync(new ProductDetailPage(p)); masterDetail.IsPresented = false; } catch (Exception ex) { throw ex; } }
public async Task Add() { var product = new ProductDetailModel(); product.imgName = imgName; product.Id = Id; product.productName = productName; product.productDesc = productDesc; if (Global.imgs.Where(i => i.Id.Equals(Id)).Count() > 0) { await Application.Current.MainPage.DisplayAlert("Alert", "This product is already in shopping cart!", "OK"); } else { Global.imgs.Add(product); } var items = App.Current.MainPage.ToolbarItems; items[1].Text = Global.imgs.Count.ToString(); }
public ProductDetailPage(ProductDetailModel vm) { InitializeComponent(); BindingContext = vm; }