/// <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); }
private void HideCustomization() { if (currentCustomizationPanel != null) { grid.Children.Remove(currentCustomizationPanel); currentCustomizationPanel = null; currentOrderItem = null; } }
/// <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); }
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; } }
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); }
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); }