//按ASCII码发送
        private void checkBox1_Unchecked(object sender, RoutedEventArgs e)
        {
            hex = false;

            if (textBox3.Text != "")
            {
                textBox3.Text = DataDeclaration.Hex2String(textBox3.Text);
            }

            if (textBox4.Text != "")
            {
                textBox4.Text = DataDeclaration.Hex2String(textBox4.Text);
            }

            if (textBox5.Text != "")
            {
                textBox5.Text = DataDeclaration.Hex2String(textBox5.Text);
            }

            if (textBox6.Text != "")
            {
                textBox6.Text = DataDeclaration.Hex2String(textBox6.Text);
            }

            if (textBox7.Text != "")
            {
                textBox7.Text = DataDeclaration.Hex2String(textBox7.Text);
            }

            if (textBox8.Text != "")
            {
                textBox8.Text = DataDeclaration.Hex2String(textBox8.Text);
            }
        }
        //按十六进制码发送
        private void checkBox1_Checked(object sender, RoutedEventArgs e)
        {
            hex = true;

            if (textBox3.Text != "")
            {
                textBox3.Text = DataDeclaration.String2Hex(textBox3.Text);
            }

            if (textBox4.Text != "")
            {
                textBox4.Text = DataDeclaration.String2Hex(textBox4.Text);
            }

            if (textBox5.Text != "")
            {
                textBox5.Text = DataDeclaration.String2Hex(textBox5.Text);
            }

            if (textBox6.Text != "")
            {
                textBox6.Text = DataDeclaration.String2Hex(textBox6.Text);
            }

            if (textBox7.Text != "")
            {
                textBox7.Text = DataDeclaration.String2Hex(textBox7.Text);
            }

            if (textBox8.Text != "")
            {
                textBox8.Text = DataDeclaration.String2Hex(textBox8.Text);
            }
        }
        private void WriteProjectorCode(byte function, string inputCodes)
        {
            byte[] data = DataDeclaration.SetDataFormat(function, byBaudRate, byParityBit,
                                                        inputCodes, hex);
            communicate.SendData(data, 0, data.Length);

            Thread.Sleep(100);
        }
        private void WriteProjectorCode(string[] inputCodes)
        {
            for (int i = 0; i < 6; i++)
            {
                byte[] data = DataDeclaration.SetDataFormat(functionCodes[i], byBaudRate, byParityBit,
                                                            inputCodes[i], hex);
                communicate.SendData(data, 0, data.Length);

                Thread.Sleep(100);
            }
        }