public Summary1Product() { InitializeComponent(); _product = (Product)PhoneApplicationService.Current.State["Product"]; PhoneApplicationService.Current.State.Remove("Product"); Name.Text = _product.Name; Weight.Text = (String)PhoneApplicationService.Current.State["Weight"]; CC.Text = CalculationClass.CalculateCC((String)PhoneApplicationService.Current.State["Weight"], _product).ToString("0.00"); Calories.Text = CalculationClass.CalculateCalories((String)PhoneApplicationService.Current.State["Weight"], _product).ToString("0.00"); PhoneApplicationService.Current.State.Remove("Weight"); }
private void MealProductList_Loaded(object sender, RoutedEventArgs e) { _productList.Sort(SortByName); List <MyCC> myCcs = new List <MyCC>(); foreach (Product product in _productList) { MyCC myCc = new MyCC { Product = product, CC = CalculationClass.CalculateCC(product.Weight.ToString(), product).ToString("0.00") }; myCcs.Add(myCc); } MealProductList.DataContext = null; MealProductList.DataContext = myCcs; }