Example #1
0
        private void ListBoxRestaurants_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            var item = ItemsControl.ContainerFromElement(ListBoxRestaurants, e.OriginalSource as DependencyObject) as ListBoxItem;

            if (item != null)
            {
                try
                {
                    foreach (Restaurant restaurant in ListOfRestaurantsForSelectedCity)
                    {
                        if (restaurant.Name == item.Content.ToString())
                        {
                            SelectedRestaurant = restaurant;
                        }
                    }
                    UserDataPage userDataPage = new UserDataPage(SelectedRestaurant);
                    NavigationService.Navigate(userDataPage);
                    FrameForPages2.NavigationService.Navigate(new ComponentChooser(SelectedRestaurant, userDataPage, FrameForPages, FrameForPages2));
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Restaurant chooser " + ex.Message);
                }
            }
        }
Example #2
0
        public ComponentChooser(Restaurant selectedRestaurant, UserDataPage userDataPage, Frame frameForPages, Frame frameForPages2)
        {
            InitializeComponent();

            SelectedRestaurant = selectedRestaurant;
            FrameForPages      = frameForPages;
            FrameForPages2     = frameForPages2;
            NewMeal            = new Meal(Meat, Vegetables, Other, SelectedRestaurant.Type, Size);
            UserDataPage       = userDataPage;
            ListOut();

            ListBoxSize.Items.Add("XL");
            ListBoxSize.Items.Add("L");
            ListBoxSize.Items.Add("S");
        }