Exemplo n.º 1
0
        private bool InitCommand(SerialCommand command)
        {
            Byte slaveAddress;

            if (!Byte.TryParse(txtSlaveAddress.Text, out slaveAddress))
            {
                Log("Error: Invalid slave address.", Color.Red);
                return(false);
            }

            command.SlaveAddress = slaveAddress;
            command.OnSend      += new EventHandler <LogEventArgs>(LogSend);
            command.OnReceive   += new EventHandler <LogEventArgs>(LogReceive);
            command.OnError     += new EventHandler <ErrorEventArgs>(LogError);
            return(true);
        }
Exemplo n.º 2
0
        private bool InitCommand(SerialCommand command)
        {
            Byte slaveAddress;
            if (!Byte.TryParse(txtSlaveAddress.Text, out slaveAddress))
            {
                Log("Error: Invalid slave address.", Color.Red);
                return false;
            }

            command.SlaveAddress = slaveAddress;
            command.OnSend += new EventHandler<LogEventArgs>(LogSend);
            command.OnReceive += new EventHandler<LogEventArgs>(LogReceive);
            command.OnError += new EventHandler<ErrorEventArgs>(LogError);
            return true;
        }