Example #1
0
        void SetRadixButton(RADIX_TYPE radixType)
        {
            switch (radixType)
            {
            case RADIX_TYPE.DEC_RADIX:
            {
                decimalButton.IsChecked = true;
                break;
            }

            case RADIX_TYPE.HEX_RADIX:
            {
                hexButton.IsChecked = true;
                break;
            }

            case RADIX_TYPE.OCT_RADIX:
            {
                octButton.IsChecked = true;
                break;
            }

            case RADIX_TYPE.BIN_RADIX:
            {
                binaryButton.IsChecked = true;
                break;
            }

            default:
                Debug.Assert(false);
                break;
            }
        }
Example #2
0
        public void ProgModeRadixChange()
        {
            num0Button.IsEnabled = true;
            num1Button.IsEnabled = true;
            num2Button.IsEnabled = true;
            num3Button.IsEnabled = true;
            num4Button.IsEnabled = true;
            num5Button.IsEnabled = true;
            num6Button.IsEnabled = true;
            num7Button.IsEnabled = true;
            num8Button.IsEnabled = true;
            num9Button.IsEnabled = true;

            var        vm        = (StandardCalculatorViewModel)(this.DataContext);
            RADIX_TYPE radixType = vm.GetCurrentRadixType();

            if (radixType == RADIX_TYPE.BIN_RADIX)
            {
                num2Button.IsEnabled = false;
                num3Button.IsEnabled = false;
                num4Button.IsEnabled = false;
                num5Button.IsEnabled = false;
                num6Button.IsEnabled = false;
                num7Button.IsEnabled = false;
                num8Button.IsEnabled = false;
                num9Button.IsEnabled = false;
            }
            else if (radixType == RADIX_TYPE.OCT_RADIX)
            {
                num8Button.IsEnabled = false;
                num9Button.IsEnabled = false;
            }
        }