/// <summary>
 /// Handles when the user clicks on an item in the selection window.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The SelectionChangedEventArgs of the event.</param>
 private void OrderItemSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (OrderListView.SelectedItem != null)
     {
         ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(OrderListView.SelectedItem as IOrderItem, null)));
         OrderListView.SelectedItem = null;
     }
 }
Example #2
0
 public void Handle(ScreenChangeEvent message)
 {
     if (_currentView.GetType().GetInterfaces().Contains(typeof(IDisposable)))
     {
         (_currentView as IDisposable).Dispose();
     }
     (_currentView as ReactiveScreen).TryClose();
     ActivateItem(message.ViewModel);
     _currentView = message.ViewModel;
 }
 /// <summary>
 /// Handles when you cancel an item's order.
 /// </summary>
 /// <param name="sender">The object that send the event, in this case a button.</param>
 /// <param name="e">The arguments of the event.</param>
 private void CancelItem_Click(object sender, RoutedEventArgs e)
 {
     if (parentItem != null)
     {
         ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(parentItem, null)));
     }
     else
     {
         (this.DataContext as Order).Remove(item);
         ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new ItemSelectionScreen()));
     }
 }
 /// <summary>
 /// Handles when a user clicks on the cash button option.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The RoutedEventArgs of the event.</param>
 private void CashButton_Click(object sender, RoutedEventArgs e)
 {
     ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CurrencyPayment(DataContext as Order)));
 }
        /// <summary>
        /// Handle adding an item into the POS.
        /// </summary>
        /// <param name="sender">The object that send the event, in this case a button.</param>
        /// <param name="e">The arguments of the event.</param>
        private void AddItem(object sender, RoutedEventArgs e)
        {
            //TODO: Find more elegant solution to this.
            //this.Visibility = Visibility.Hidden;
            switch ((sender as Button).Name)
            {
            case "AddBriarheartBurgerButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new BriarheartBurger(), null)));
                break;

            case "AddDoubleDraugrButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new DoubleDraugr(), null)));
                break;

            case "AddThalmorTripleButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new ThalmorTriple(), null)));
                break;

            case "AddGardenOrcOmeletteButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new GardenOrcOmelette(), null)));
                break;

            case "AddPhillyPoacherButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new PhillyPoacher(), null)));
                break;

            case "AddSmokehouseSkeletonButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new SmokehouseSkeleton(), null)));
                break;

            case "AddThugsTBoneButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new ThugsTBone(), null)));
                break;

            case "AddAretinoAppleJuiceButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new AretinoAppleJuice(), null)));
                break;

            case "AddCandlehearthCoffeeButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new CandlehearthCoffee(), null)));
                break;

            case "AddMarkathMilkButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new MarkarthMilk(), null)));
                break;

            case "AddSailorSodaButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new SailorSoda(), null)));
                break;

            case "AddWarriorWaterButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new WarriorWater(), null)));
                break;

            case "AddDragonbornWaffleFriesButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new DragonbornWaffleFries(), null)));
                break;

            case "AddFriedMiraakButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new FriedMiraak(), null)));
                break;

            case "AddMadOtarGritsButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new MadOtarGrits(), null)));
                break;

            case "AddVokunSaladButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new VokunSalad(), null)));
                break;

            case "AddComboButton":
                ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen(new ComboItem(), null)));
                break;

            default:
                throw new InvalidOperationException("Some item does not exist!");
            }
        }
 /// <summary>
 /// Handles when the user wants to return to the order and make some changes.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The RoutedEventArgs of the event.</param>
 private void ReturnToOrder_Click(object sender, RoutedEventArgs e)
 {
     ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new ItemSelectionScreen()));
 }
 /// <summary>
 /// Handles when the user clicks on the complete order button.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The RoutedEventArgs of the event.</param>
 private void CompleteOrder(object sender, RoutedEventArgs e)
 {
     ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new PaymentOptions()));
 }
 /// <summary>
 /// Button that handles when a user decides to customize a drink in a combo.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The routed event args from the event.</param>
 private void CustomizeDrinkButtonClick(object sender, RoutedEventArgs e)
 {
     ScreenChangeEvent?.Invoke(this, new ScreenChangeEventArgs(new CustomizationScreen((this.item as ComboItem).Drink, this.item as ComboItem)));
 }