Exemple #1
0
        private void ToGoods_Click(object sender, EventArgs e)
        {
            byte[] byData = new byte[8];

            UART.Send[0] = 69; //向MCU发送指令‘E’,读取过敏信息
            UART.Send[1] = 27;

            if (UART.mySerialPort.IsOpen)
            {
                UART.mySerialPort.Close();
            }
            if (UART.mySerialPort.IsOpen == false)
            {
                UART.mySerialPort.Open();

                UART.mySerialPort.Write(UART.Send, 0, 2);//发送指令
            }



            //char[] charData = new char[1000];

            /*public void Read()
             * /*
             * FileStream file = new FileStream(@"D:\AllergyInfor.txt", FileMode.Open);
             *  file.Seek(0, SeekOrigin.Begin);
             *  file.Read(byData, 0, 8); //byData传进来的字节数组,用以接受FileStream对象中的数据,第2个参数是字节数组中开始写入数据的位置,它通常是0,表示从数组的开端文件中向数组写数据,最后一个参数规定从文件读多少字符.
             *  Decoder d = Encoding.Default.GetDecoder();
             *  d.GetChars(byData, 0, byData.Length, Allregy.allergy, 0);
             * // Console.WriteLine(charData);
             *  file.Close();
             *
             */


            if (Enon.enon)
            {
                Play("//goodslist.wav");
            }
            else
            {
                Play("//GOODSLIST (2).wav");
            }

            Thread.Sleep(100);
            UART.mySerialPort.Close();
            GoodsList goodsList = new GoodsList();

            goodsList.Show();
            this.Hide();
        }
        private void Return_Click(object sender, EventArgs e)
        {
            if (MianForm.Enon.enon)
            {
                Play("//return.wav");
            }
            else
            {
                Play("//RETURN (2).wav");
            }
            GoodsList goodsList = new GoodsList();

            mySerialPort.Close();
            goodsList.Show();
            this.Close();
        }