예제 #1
0
        /// <summary>
        /// Changes Radio button display so appropriate button is checked according to size of IOrderItem
        /// </summary>
        private void UpdateSizeDisplay()
        {
            CowboyCafe.Data.Size size = CowboyCafe.Data.Size.Small;
            if (DataContext is Side side)
            {
                size = side.Size;
            }
            else if (DataContext is Drink drink)
            {
                size = drink.Size;
            }
            switch (size)
            {
            case CowboyCafe.Data.Size.Large:
                LgRadioButton.IsChecked = true;
                break;

            case CowboyCafe.Data.Size.Medium:
                MedRadioButton.IsChecked = true;
                break;

            case CowboyCafe.Data.Size.Small:
                SmlRadioButton.IsChecked = true;
                break;

            default:
                break;
            }
        }
예제 #2
0
        /// <summary>
        /// Separates the cases of Drink Size to the correct Size RadioButton to be checked
        /// </summary>
        /// <param name="size"></param>
        public void ButtonSizeSwitch(Size size)
        {
            switch (size)
            {
            case Size.Small:
                ButtonSmall.IsChecked  = true;
                ButtonMedium.IsChecked = false;
                ButtonLarge.IsChecked  = false;
                break;

            case Size.Medium:
                ButtonSmall.IsChecked  = false;
                ButtonMedium.IsChecked = true;
                ButtonLarge.IsChecked  = false;
                break;

            case Size.Large:
                ButtonSmall.IsChecked  = false;
                ButtonMedium.IsChecked = false;
                ButtonLarge.IsChecked  = true;
                break;

            default:
                break;
            }
        }
예제 #3
0
 /// <summary>
 /// Changes the size of DataContext object if that object is a Side or Drink
 /// </summary>
 /// <param name="size">Size to change IOrderItem's size to</param>
 private void ChangeSize(CowboyCafe.Data.Size size)
 {
     if (DataContext is Side side)
     {
         side.Size = size;
     }
     else if (DataContext is Drink drink)
     {
         drink.Size = size;
     }
 }
        /// <summary>
        /// Sets the size of the side object based on the user's choice.
        /// </summary>
        /// <param name="sender">The user's interaction.</param>
        /// <param name="args">Event argument.</param>
        private void OnSize_Checked(object sender, RoutedEventArgs args)
        {
            Size s2 = Size.Small;
            Size s3;

            if (DataContext is ChiliCheeseFries chili)
            {
                s3 = chili.Size;
                if (sender is RadioButton rb)
                {
                    switch (rb.Tag)
                    {
                    case "Small":
                        chili.Size = Size.Small;
                        s2         = Size.Small;
                        break;

                    case "Medium":
                        chili.Size = Size.Medium;
                        s2         = Size.Medium;
                        break;

                    case "Large":
                        chili.Size = Size.Large;
                        s2         = Size.Large;
                        break;

                    default:
                        throw new NotImplementedException("Size not Avialable");
                    }
                }
                ChiliCheeseFries b = new ChiliCheeseFries();
                if (s3 == Size.Medium)
                {
                    b.Size = Size.Medium;
                }
                else if (s3 == Size.Large)
                {
                    b.Size = Size.Large;
                }
                order.subtotalHelperFunction(b, s2);
            }
        }