Beispiel #1
0
        private void ProcessInputText()
        {
            if (ValueText.Text.Trim() == "")
            {
                if (!ValueText.ContainsFocus)
                {
                    ValueText.Focus();
                }
                return;
            }

            if (IsNumericString(ValueText.Text.Trim()))
            {
                var enteredValue = Convert.ToInt32(ValueText.Text.Trim());

                Status.Text = enteredValue == m_currentNumber ?
                              "Correct" : "Incorrect";
            }
            else
            {
                Status.Text = "Bad Input Value";
            }

            if (!ValueText.ContainsFocus)
            {
                ValueText.Focus();
            }
        }
Beispiel #2
0
        private void NewNumber_Click(object sender, EventArgs e)
        {
            var RandNum = new Random();

            m_currentNumber = RandNum.Next(255);

            var ba   = BitConverter.GetBytes(m_currentNumber);
            var bits = new BitArray(ba);

            Bit_1.Text   = GetBitString(bits[0]);
            Bit_2.Text   = GetBitString(bits[1]);
            Bit_4.Text   = GetBitString(bits[2]);
            Bit_8.Text   = GetBitString(bits[3]);
            Bit_16.Text  = GetBitString(bits[4]);
            Bit_32.Text  = GetBitString(bits[5]);
            Bit_64.Text  = GetBitString(bits[6]);
            Bit_128.Text = GetBitString(bits[7]);

            Status.Text    = "";
            ValueText.Text = "";
            ValueText.Focus();
        }
Beispiel #3
0
 private void NoRead_MouseCaptureChange(object sender, EventArgs e)
 {
     ValueText.Focus();
 }
Beispiel #4
0
 private void NoRead_MouseClick(object sender, MouseEventArgs e)
 {
     ValueText.Focus();
 }
Beispiel #5
0
 public Main()
 {
     InitializeComponent();
     ValueText.Focus();
 }