public override void Init(object initData) { base.Init(initData); var context = initData as Tuple <ProductQuotationModel, bool>; if (context != null) { ProductName = context.Item1.Product.ProductKind; ProductModel = context.Item1; SaleOrderLine = context.Item1.Product; IsControlsEnabled = context.Item2; try { if (!string.IsNullOrWhiteSpace(context.Item1.Product.ConfigurationDetail)) { ProductProperties = JsonConvert.DeserializeObject <List <ProductProperty> >(context.Item1.Product.ConfigurationDetail); } } catch (Exception) { } } }
async void Popup_Context_ItemSelectedChanged() // When an item is selected from the popup then open product customize page { if (popup_context.SelectedItem != null) { var item = new ProductQuotationModel(new SaleOrderLine() { OrderId = Quotation.SaleOrder.Id, CurrencyId = Quotation.SaleOrder.CurrencyId, ProductKind = popup_context.SelectedItem.ProductKind.ToString(), TaxId = 2, PriceUnit = popup_context.SelectedItem.UnitPrice }, CurrencyLogo) { Quantity = 1 }; item.Product.ConfigurationDetail = Newtonsoft.Json.JsonConvert.SerializeObject(popup_context.SelectedItem.Properties); item.PropertyChanged += Item_PropertyChanged; OrderItemsSource.Add(item); quotation.Products.Add(item); await CoreMethods.PushPageModel <ProductDescriptionPageModel>(new Tuple <ProductQuotationModel, bool>(item, CanEdit)); await StoreManager.SaleOrderLineStore.InsertAsync(item.Product); } popup_context.ItemSelectedChanged -= Popup_Context_ItemSelectedChanged; }