Beispiel #1
0
        /// <summary>
        /// Switch from menu to customization panel for an item
        /// </summary>
        public void CustomizeItem(IOrderItem item)
        {
            ItemCustomizationPanel customizationPanel = new ItemCustomizationPanel();

            customizationPanel.BtnAddToOrder.Click += OnBtnAddToOrderClicked;
            customizationPanel.BtnClose.Click      += OnBtnCloseClicked;
            customizationPanel.LoadOptionsForItem(item);

            CustomizeItem(item, customizationPanel);
        }
Beispiel #2
0
        private void OnComboItemChanged(object sender, RoutedEventArgs e)
        {
            ComboBox box = sender as ComboBox;
            ItemCustomizationPanel panel = box.Tag as ItemCustomizationPanel;

            panel.stack.Children.Clear();

            IOrderItem newItem = (IOrderItem)Activator.CreateInstance(box.SelectedItem as Type);
            Combo      combo   = DataContext as Combo;

            if (newItem is Entree entree)
            {
                combo.Entree = entree;
            }
            else if (newItem is Side side)
            {
                combo.Side = side;
            }
            else if (newItem is Drink drink)
            {
                combo.Drink = drink;
            }
            panel.LoadOptionsForItem(newItem);
        }