コード例 #1
0
        public void Load_pro()
        {
            try
            {
                Form_admin fa = new Form_admin();
                serialPort1.PortName = fa.Port2;
                serialPort1.BaudRate = 9600;
                serialPort1.Open();
                proximity prox = new proximity();
                prox.Show();
                try
                {
                    string idr = serialPort1.ReadLine();
                    prox.Close();


                    validate(idr);
                }
                catch (TimeoutException t)
                {
                    prox.Close();
                    MessageBox.Show(t.Message);
                }

                serialPort1.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        private void button21_Click(object sender, EventArgs e)
        {
            try
            {
                serialPort1.PortName = Port;
                serialPort1.BaudRate = 9600;
                serialPort1.Open();
                proximity prox = new proximity();
                prox.Show();
                try
                {
                    string id = serialPort1.ReadLine();
                    prox.Close();


                    if (validate(id))
                    {
                        textBox14.Text = id;
                    }
                }
                catch (TimeoutException t)
                {
                    prox.Close();
                    MessageBox.Show(t.Message);
                }

                serialPort1.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (price == 0.00)
            {
                MessageBox.Show("Please Select Items You Want to by");
                return; // return because we don't want to run normal code of buton click
            }
            try
            {
                Form_admin fa = new Form_admin();
                serialPort1.PortName = fa.Port;
                serialPort1.BaudRate = 9600;
                serialPort1.Open();
                proximity prox = new proximity();
                prox.Show();
                try
                {
                    string id = serialPort1.ReadLine();
                    prox.Close();


                    validate(id);
                }
                catch (TimeoutException t)
                {
                    prox.Close();
                    MessageBox.Show(t.Message);
                }

                serialPort1.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }