I am making an Enigma Simulator Application in C#. In addition to that I am trying to make its lightboard, which is basically a keyboard that lights up the letter which is returned by the reflector. Now, my idea was to add 26 pictureboxes with yellow images of letters and on top of each one to add 26 other pictureboxes with grey images of letters.
The grey ones are the ones that are visible if 0 letters are typed by the user. When the user types a letter, the enigma decodes it and returns another one based on its settings and that letter should turn on in the keyboard(yellow image of letter), then it turns off (grey image) as the next letter arrives.
The code below is the part that shows how I tried to do this, but I can't figure out how to make them go on one after another not all at once. Any help or advice how to achieve this effect would be welcomed.
StringBuilder ciphertext = new StringBuilder(txtCiphertext.Text);
int i = 0;
while (i < ciphertext.Length)
{
if (ciphertext[i] == (char)Keys.A)
{
Aoff.Visible = false;
Aon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.B)
{
Boff.Visible = false;
Bon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.C)
{
Coff.Visible = false;
Con.Visible = true;
}
else if (ciphertext[i] == (char)Keys.D)
{
Doff.Visible = false;
Don.Visible = true;
}
else if (ciphertext[i] == (char)Keys.E)
{
Eoff.Visible = false;
Eon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.F)
{
Foff.Visible = false;
Fon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.G)
{
Goff.Visible = false;
Gon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.H)
{
Hoff.Visible = false;
Hon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.I)
{
Ioff.Visible = false;
Ion.Visible = true;
}
else if (ciphertext[i] == (char)Keys.J)
{
Joff.Visible = false;
Jon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.K)
{
Koff.Visible = false;
Kon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.L)
{
Loff.Visible = false;
Lon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.M)
{
Moff.Visible = false;
Mon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.N)
{
Noff.Visible = false;
Non.Visible = true;
}
else if (ciphertext[i] == (char)Keys.O)
{
Ooff.Visible = false;
Oon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.P)
{
Poff.Visible = false;
Pon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.Q)
{
Qoff.Visible = false;
Qon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.R)
{
Roff.Visible = false;
Ron.Visible = true;
}
else if (ciphertext[i] == (char)Keys.S)
{
Soff.Visible = false;
Son.Visible = true;
}
else if (ciphertext[i] == (char)Keys.T)
{
Toff.Visible = false;
Ton.Visible = true;
}
else if (ciphertext[i] == (char)Keys.U)
{
Uoff.Visible = false;
Uon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.V)
{
Voff.Visible = false;
Von.Visible = true;
}
else if (ciphertext[i] == (char)Keys.W)
{
Woff.Visible = false;
Won.Visible = true;
}
else if (ciphertext[i] == (char)Keys.X)
{
Xoff.Visible = false;
Xon.Visible = true;
}
else if (ciphertext[i] == (char)Keys.W)
{
Woff.Visible = false;
Won.Visible = true;
}
else if (ciphertext[i] == (char)Keys.Z)
{
Zoff.Visible = false;
Zon.Visible = true;
}
i++;
}