Esempio n. 1
0
 /// <summary>
 /// Sets the size for the selected drink.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void SelectSize(object sender, RoutedEventArgs e)
 {
     if (DataContext is Drink)
     {
         Size size = SizeSelectionMethod.DrinkSizeSelection(this, sender);
         aj.Size = size;
     }
     else
     {
         throw new NotImplementedException("Invalid type");
     }
 }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">routed to trace back to ancestor</param>
        private void SelectSize(object sender, RoutedEventArgs e)
        {
            if (sender is Button b)
            {
                Size size = b.Name switch
                {
                    "smallButton" => Size.Small,
                    "mediumButton" => Size.Medium,
                    "largeButton" => Size.Large,
                    _ => throw new NotImplementedException("Invalid size button selected"),
                };
                if (DataContext is Side side)
                {
                    side.Size = size;
                }

                else
                {
                    throw new NotImplementedException("Invalid item type");
                }
            }
        }