Exemplo n.º 1
0
        /// <summary>
        /// Switch from menu to customization panel for an item
        /// that already has a customization panel generated for it.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="customizationPanel"></param>
        public void CustomizeItem(IOrderItem item, ItemCustomizationPanel customizationPanel)
        {
            currentOrderItem = item;

            currentCustomizationPanel = customizationPanel;

            SwitchToScreen(Screen.Customization);
        }
Exemplo n.º 2
0
 private void HideCustomization()
 {
     if (currentCustomizationPanel != null)
     {
         grid.Children.Remove(currentCustomizationPanel);
         currentCustomizationPanel = null;
         currentOrderItem          = null;
     }
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public OrderItem(ItemCustomizationPanel panel)
 {
     CustomizationPanel = panel;
     this.DataContext   = panel.DataContext;
     InitializeComponent();
     SetExtraInfo((DataContext as IOrderItem).SpecialInstructions);
     txtName.Text = DataContext.ToString();
     if (DataContext is INotifyPropertyChanged propertyChanged)
     {
         propertyChanged.PropertyChanged += OnPropertyChanged;
     }
 }
Exemplo n.º 5
0
        private ComboBox AddComboItemPanel(IEnumerable itemsSource)
        {
            ComboBox box = new ComboBox();

            box.ItemsSource       = itemsSource;
            box.DisplayMemberPath = "Name";
            var x = new ItemCustomizationPanel();

            x.grid.RowDefinitions.RemoveAt(0);
            x.grid.RowDefinitions.RemoveAt(1);
            x.btnAddToOrder.IsEnabled  = false;
            x.btnClose.IsEnabled       = false;
            x.label.IsEnabled          = false;
            x.btnAddToOrder.Visibility = Visibility.Hidden;
            x.btnClose.Visibility      = Visibility.Hidden;
            x.label.Visibility         = Visibility.Hidden;
            box.Tag = x;
            box.SelectionChanged += OnComboItemChanged;
            stack.Children.Add(box);
            stack.Children.Add(box.Tag as UIElement);

            box.SelectedIndex = 0;
            return(box);
        }
Exemplo n.º 6
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);
        }