示例#1
0
        private void AddButtonClicked(object sender, RoutedEventArgs e)
        {
            int[] options = { -1, -1, -1, -1, -1 };
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    if ((rbs[i, j].IsChecked == true) && (rbs[i, j].IsVisible))
                    {
                        options[i] = j;
                    }
                }
            }

            try
            {
                isOrdering = null;
                OrderItem orderItem = new OrderItem(item, this.optionsCost, options, this);
                this.orderTable.Add(orderItem);
                menu.menuItemListView.SelectedItem = null;
                this.resetSelecton();
            }
            catch (Exception error)
            {
                System.Diagnostics.Debug.WriteLine(error);
            }
            editingOldOrder = false;
            menuObject.collapseOptions();
        }
示例#2
0
        public void EditOptionsMenu(MenuObject item, int[] chosenOptions, OrderItem orderItem)
        {
            MenuObject selected = (MenuObject)menu.menuItemListView.SelectedItem;

            if (selected != null)
            {
                selected.collapseOptions();
            }

            this.item = item;
            oldOrder  = chosenOptions;
            this.NewOptionsMenu();
            for (int i = 0; i < 5; i++)
            {
                if ((chosenOptions[i] >= 0) && (chosenOptions[i] < 5))
                {
                    rbs[i, chosenOptions[i]].IsChecked = true;
                }
            }
            editingOldOrder = true;

            quantityAmount.Text = orderItem.quantity.ToString();
            this.UpdateTotal(null, null);



            menu.menuItemListView.SelectedItem = menuObject;
        }
示例#3
0
        private void MenuItemListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                //toggleOptions(false);


                /*Style style = new Style();
                 * style.TargetType = typeof(ListViewItem);
                 * style.Setters.Add(new Setter(ListViewItem.BackgroundProperty, Brushes.Pink));
                 * style.
                 * menuItemListView.ItemContainerStyle = style;*/


                MenuObject menuItem = (MenuObject)this.menuItemListView.SelectedItem;

                foreach (MenuObject element in menuItemListView.Items)
                {
                    element.collapseOptions();
                }

                if (menuItem.OptionsExpander.IsExpanded)
                {
                    menuItem.collapseOptions();
                }
                else
                {
                    menuItem.expandOptions();
                }

                int verticalOffset = 0;
                var temp           = menuItemListView.SelectedIndex;

                if (menuItem.type == MenuObject.Type.Main)
                {
                    verticalOffset = menuItemListView.SelectedIndex * 222 + 90;
                }
                else if (menuItem.type == MenuObject.Type.Side)
                {
                    verticalOffset = menuItemListView.SelectedIndex * 222 + (90 * 2);
                }
                else if (menuItem.type == MenuObject.Type.Dessert)
                {
                    verticalOffset = menuItemListView.SelectedIndex * 222 + (90 * 3);
                }
                else
                {
                    verticalOffset = menuItemListView.SelectedIndex * 222 + (90 * 4);
                }


                //verticalOffset -= 615;

                /* menuItem.Transf
                 * Point relativePOint = menuItem.TransformToAncestor(menuItemScrollViewer).Transform(new Point(0, 0));*/

                //menuItem.optionsMenu.NewOptionsMenu();

                menuItem.optionsMenu.makeSureRadiosAreChecked();

                Thread.Sleep(300);
                menuItemScrollViewer.ScrollToVerticalOffset(verticalOffset);



                e.Handled = true;
                //OptionsPopUp.NewOptionsMenu(menuItem);
            }
            catch (Exception error)
            {
                System.Diagnostics.Debug.WriteLine(error);
            }
        }