Example #1
0
        private void TagGetIdButton_Click(object sender, EventArgs e)
        {
            AvailablePorts instance = new AvailablePorts(this);

            if (portTextLabel.Text != "NA")
            {
                if ((dispCalibXBox.Text == "") && (dispCalibYBox.Text == ""))
                {
                    dispCalibXBox.Text = "8";
                    dispCalibYBox.Text = "8";
                }
                string info = "Place the tag on the 0,0 tile.(top left)\n\n" +
                              "You do not need to click this button again to scan a tag.";
                System.Windows.Forms.MessageBox.Show(info, "About", MessageBoxButtons.OK, MessageBoxIcon.Information);


                string[] arr   = portTextLabel.Text.Split(' ');
                int      index = arr.Length;
                /* Initialize set-up here*/

                serialPort.PortName  = arr[index - 1];
                serialPort.BaudRate  = 9600;
                serialPort.DataBits  = 8;
                serialPort.Parity    = Parity.None;
                serialPort.StopBits  = StopBits.One;
                serialPort.RtsEnable = false;
                serialPort.DtrEnable = false;

                serialPort.Open();
                serialPort.DiscardInBuffer();
                serialPort.DiscardOutBuffer();
                TX_Sync(serialPort, dispCalibXBox.Text, dispCalibYBox.Text);


                serialPort.DataReceived += new
                                           SerialDataReceivedEventHandler(port_DataReceived);

                tagGetIdButton.Enabled = false;
            }
            else
            {
                instance.getAvailablePorts();
                if (portTextLabel.Text != "NA")
                {
                    TagGetIdButton_Click(sender, e);
                }
            }
        }
Example #2
0
        private void ChooseCOMToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AvailablePorts to = new AvailablePorts(this);

            to.Show();
        }