예제 #1
0
        /// <summary>
        /// When the customer has provided enough funds and change can be made, the order
        /// is finalized, and a new order is started.
        /// </summary>
        /// <param name="sender">The button that was clicked.</param>
        /// <param name="e">The event arguments.</param>
        private void FinalizeOrder(object sender, RoutedEventArgs e)
        {
            if (DataContext is RegisterViewModel rvm)
            {
                if (OrderComponent.DataContext is Order order)
                {
                    order.PrintReciept(false, rvm.ChangeOwed);
                }

                rvm.FinalizeOrder();
                Cleanup();
                OrderComponent.CollapseButtons(false);
                OrderComponent.ChangeScreen(new MenuSelectionScreen());
                OrderComponent.DataContext = new Order();
            }
        }
예제 #2
0
        /// <summary>
        /// Creates a new custom customizer component with the given <typeparamref name="TOrderItem"/>
        /// and <typeparamref name="TCustomizationOptions"/>, and it
        /// swaps the order screen to show this new customization component with the <paramref name="name"/>
        /// as the title.
        /// </summary>
        /// <typeparam name="TOrderItem">The type of item to create.</typeparam>
        /// <typeparam name="TCustomizationOptions">The customization page to use to create it.</typeparam>
        /// <param name="name">The name of the menu item.</param>
        private void ChangeToItem <TOrderItem, TCustomizationOptions>(string name) where TOrderItem : IOrderItem, new() where TCustomizationOptions : CustomizationScreen, new()
        {
            if (DataContext is Combo combo)
            {
                ItemModification modifier = new ItemModification();
                modifier.customizeItemLabel.Text = "Customize " + name;
                TCustomizationOptions customizationOptions = new TCustomizationOptions();
                TOrderItem            item = new TOrderItem();
                customizationOptions.DataContext      = item;
                modifier.customizationContainer.Child = customizationOptions;
                modifier.ReturnScreen = ReturnScreen;

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

                OrderComponent.ChangeScreen(modifier);
            }
            else if (OrderComponent.DataContext is Order order)
            {
                ItemCustomization customizer = new ItemCustomization();
                customizer.customizeItemLabel.Text = "Customize " + name;
                TCustomizationOptions customizationOptions = new TCustomizationOptions();
                TOrderItem            item = new TOrderItem();
                customizationOptions.DataContext        = item;
                customizer.customizationContainer.Child = customizationOptions;
                OrderComponent.ChangeScreen(customizer);

                order.Add(item);
            }
        }
예제 #3
0
 /// <summary>
 /// Cancels the sale but does not cancel the order. In effect, it just returns
 /// the POS back to the selection screen while keeping the same order.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CancelSale(object sender, RoutedEventArgs e)
 {
     OrderComponent.CollapseButtons(false);
     OrderComponent.ChangeScreen(new MenuSelectionScreen());
     Cleanup();
 }
예제 #4
0
 private void CancelClicked(object sender, RoutedEventArgs e)
 {
     OrderComponent.ChangeScreen(ReturnScreen);
 }