private void ReadParametersButton_Click(object sender, EventArgs e)
 {
     //print the parameters
     TopMessageBox.Clear();
     TopMessageBox.AppendText("Baud rate : " + baudRate.ToString() + " BPS, " + WordLength.ToString() + " Data bits," +
                              "1 Start," + StopBit.ToString() + " Stop bit," + actualParity.ToString() + " Parity");
 }
        private void CommandBox_KeyUp(object sender, KeyEventArgs userKey)
        {
            if (userKey.KeyCode == Keys.Return)                        // Enter key
            {
                switch (CommandBox.Lines[CommandBox.Lines.Length - 2]) // the last line(with indes [Length-1]) will be empty (the user press enter)
                {
                case "set red":
                    port.Write("1");
                    port.Write(">");
                    break;

                case "set blue":
                    port.Write("2");
                    port.Write(">");
                    break;

                case "set yellow":
                    port.Write("3");
                    port.Write(">");
                    break;

                case "set green":
                    port.Write("4");
                    port.Write(">");
                    break;

                case "set purpule":
                    port.Write("5");
                    port.Write(">");
                    break;

                case "set white":
                    port.Write("6");
                    port.Write(">");
                    break;

                case "set azule":
                    port.Write("7");
                    port.Write(">");
                    break;

                case "clear rgb":
                    port.Write("C");
                    port.Write(">");
                    break;

                case "reset":
                    port.Write("R");
                    port.Write(">");
                    break;

                default:     // else
                    TopMessageBox.Clear();
                    TopMessageBox.AppendText(" Valid Command's :  ");
                    TopMessageBox.AppendText(" 1. set red - Turn on red led ");
                    TopMessageBox.AppendText(" 2. set blue - Turn on blue led ");
                    TopMessageBox.AppendText(" 3. set yellow - Turn on yellow led ");
                    TopMessageBox.AppendText(" 4. set green - Turn on green led ");
                    TopMessageBox.AppendText(" 5. set azule - Turn on azule led ");
                    TopMessageBox.AppendText(" 6. set white - Turn on white led ");
                    TopMessageBox.AppendText(" 7. set purple - Turn on purple led ");
                    TopMessageBox.AppendText(" 8. clear rgb - Turn off rgb led ");
                    TopMessageBox.AppendText(" 9. reset - To reset the controller ");
                    TopMessageBox.AppendText(" 10. in Script only : delay X miliseconds ");
                    break;
                }
            }
        }