private void Button_Click(object sender, RoutedEventArgs e) { if (txtName.Text.Length == 0) { txtName.Focus(); } else { FoodItem item = new FoodItem(); item.country = "Turkey"; item.date = "Today"; item.dish = txtName.Text; item.distance = 3; item.flagGluten = (bool)chkGluten.IsChecked; item.flagKosher = (bool)chkKosher.IsChecked; item.flagVegetarian = (bool)chkVeg.IsChecked; item.id = -1; item.pic = "Assets/mypic.jpg"; item.place = "Gelatario"; item.user = "******"; item.location = "Hagia Sofia, Istanbul"; item.meal = "lunch"; item.likes = 0; Helpers.lstItems.Insert(0, item); Debug.WriteLine("Len:" + Helpers.lstItems.Count); NavigationService.GoBack(); } }
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { if (Helpers.lastSelection != null) { FoodItem selected = Helpers.lastSelection; imgUser.Source = new BitmapImage(new Uri(selected.upic, UriKind.Relative)); txtPlace.Text = selected.place; txtLocation.Text = selected.location; pic.Source = new BitmapImage(new Uri(selected.pic, UriKind.RelativeOrAbsolute)); string capName = char.ToUpper(selected.user[0]) + selected.user.Substring(1); btnMenu.Content = "View " + capName + "'s Secret Menu"; if (selected.flagGluten) { iconGluten.Visibility = System.Windows.Visibility.Visible; } else { iconGluten.Visibility = System.Windows.Visibility.Collapsed; } if (selected.flagKosher) { iconKosher.Visibility = System.Windows.Visibility.Visible; } else { iconKosher.Visibility = System.Windows.Visibility.Collapsed; } if (selected.flagVegetarian) { iconVeg.Visibility = System.Windows.Visibility.Visible; } else { iconVeg.Visibility = System.Windows.Visibility.Collapsed; } } }