Exemple #1
0
        private void buttonSetReaderAddress_Click(object sender, EventArgs e)
        {
            byte aNewComAdr = Convert.ToByte(textBoxReaderAddress.Text, 16);

            try
            {
                ErrorsCatcher.errorName = RWDev.SetAddress(ref RWDev.comAddress, aNewComAdr, RWDev.frmComPortIndex);
                if (ErrorsCatcher.errorName != 0)
                {
                    string strLog = "Set address failed " + ErrorsCatcher.GetReturnCodeDesc(ErrorsCatcher.errorName) + Environment.NewLine;
                    richTextBoxLogs.AppendText(strLog);
                    return;
                }
                else
                {
                    string strLog = "Address " + textBoxReaderAddress.Text + " set" + Environment.NewLine;
                    richTextBoxLogs.AppendText(strLog);
                }
            }
            catch
            {
                richTextBoxLogs.AppendText("Set address failed!" + Environment.NewLine);
            }
        }