Exemplo n.º 1
0
        private void btnSetReqWriteParam_Click(object sender, EventArgs e)
        {
            if (_serialPort == null)
            {
                Log("Serial port is not connected.", Color.Red);
                return;
            }

            try
            {
                Set_Req_Write_Param command = new Set_Req_Write_Param();
                if (!InitCommand(command))
                {
                    return;
                }

                Log(command.ToString(), Color.Black);
                command.Send(_serialPort);
                if (!command.Receive(_serialPort))
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                Log(ex.Message, Color.Red);
                Log(ex.StackTrace, Color.Red);
            }
        }
Exemplo n.º 2
0
        private void btnSetReqWriteParam_Click(object sender, EventArgs e)
        {
            if (_serialPort == null)
            {
                Log("Serial port is not connected.", Color.Red);
                return;
            }

            try
            {
                Set_Req_Write_Param command = new Set_Req_Write_Param();
                if (!InitCommand(command))
                    return;

                Log(command.ToString(), Color.Black);
                command.Send(_serialPort);
                if (!command.Receive(_serialPort))
                    return;
            }
            catch (Exception ex)
            {
                Log(ex.Message, Color.Red);
                Log(ex.StackTrace, Color.Red);
            }
        }