Exemple #1
0
        private void onClickDigitsAndOperations(object sender, RoutedEventArgs e)
        {
            Button b  = (Button)sender;
            String op = b.Content.ToString();

            String [] mathOps = { "+", "-", "*", "/" };
            if (MatUtil.isInGivenBase(op, curBase) || mathOps.Contains(op))
            {
                tb.Text += op;
            }
        }
Exemple #2
0
        private void onClickHex(object sender, RoutedEventArgs e)
        {
            Button b = (Button)sender;

            if (tb.Text != "" && MatUtil.isInGivenBase(tb.Text, curBase))
            {
                if (curBase == 2)
                {
                    tb.Text = Convert.ToString(Convert.ToInt32(tb.Text, 2), 16).ToUpper();
                }

                else if (curBase == 10)
                {
                    tb.Text = Convert.ToString(Convert.ToInt32(tb.Text, 10), 16).ToUpper();
                }
            }
            else
            {
                tb.Text = "";
            }
            curBase = 16;
        }