예제 #1
0
        private void ConnMES(short cmd, ref string value)
        {
            byte[] str    = new byte[800];
            char[] mychar = value.ToCharArray();
            int    mylen;

            for (int i = 0; i < mychar.Length; i++)
            {
                str[i] = Convert.ToByte(Convert.ToInt32(mychar[i]));
            }
            try
            {
                if (MES.SajetTransStart())
                {
                    Thread.Sleep(500);
                    mylen = str.Length;
                    if (MES.SajetTransData(cmd, ref str[0], ref mylen))
                    {
                        value = ValueChar_MES(str, mylen);
                    }
                    else
                    {
                        value = "连接失败";
                    }
                    value = ValueChar_MES(str, mylen);
                }
            }
            catch (Exception ex)
            {
                value = "连接错误";
            }
            finally
            {
                MES.SajetTransClose();
            }
        }
예제 #2
0
 private void btnStart_Click(object sender, EventArgs e)
 {
     MES.SajetTransStart();
 }