Example #1
0
 private void button6_Click(object sender, EventArgs e)
 {
     serialPort1.Write("9");
     serialPort1.Close();
     timer1.Enabled = false;
     LogMsg.AppendText(DateTime.Now + " | " + "Auto Mode Off" + Environment.NewLine);
 }
Example #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            //LogMsg.AppendText(String.Compare(tbRFIDlabel.Text,"") + Environment.NewLine);
            tbRFIDlabel.Focus();
            tbRFIDlabel.ImeMode = System.Windows.Forms.ImeMode.Alpha;
            if (tbRFIDlabel.Text.Length <= 5 || tbRFIDlabel.Text.Length > 10)
            {
                tbRFIDlabel.Text = "";
            }
            if (String.Compare(tbRFIDlabel.Text, "", true) == 0 ? false : true && tbRFIDlabel.Text.Length == 10)
            {
                LogMsg.AppendText(DateTime.Now + " | " + tbRFIDlabel.Text + Environment.NewLine);
                //Console.WriteLine(DateTime.Now);
                //textBox2.Text = DateTime.Now;
                //LogMsg.AppendText(DateTime.Now + Environment.NewLine);
                mysqlcon.Open();
                MySqlCommand cmd = new MySqlCommand("insert into rfid(LogDate,LogTime,cardnumber,name) values('" + DateTime.Now.Date + "','" + DateTime.Now.TimeOfDay + "','" + tbRFIDlabel.Text + "','anonymous')", mysqlcon);
                cmd.ExecuteNonQuery();
                mysqlcon.Close();

                if (tbRFIDlabel.Text.Equals("2152538976")) //#Blue Lisa
                {
                    serialPort1.Write("1");
                }
                else if (tbRFIDlabel.Text.Equals("2771986960")) //#White Vincent
                {
                    serialPort1.Write("2");
                }
                else
                {
                    serialPort1.Write("0");
                }
                tbRFIDlabel.Text = "";
            }
        }
Example #3
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     serialPort1.PortName = tbCOMnum.Text;
     serialPort1.Open();
     LogMsg.AppendText(DateTime.Now + " | " + "Opening Arduino Serial Port" + tbCOMnum.Text + Environment.NewLine);
     serialPort1.Write("3");
 }
Example #4
0
 private void button5_Click(object sender, EventArgs e)
 {
     timer1.Enabled       = true;
     serialPort1.PortName = "COM3";
     serialPort1.Open();
     LogMsg.AppendText(DateTime.Now + " | " + "Auto Mode On" + Environment.NewLine);
     serialPort1.Write("3");
 }
Example #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            Console.WriteLine(DateTime.Now);
            //textBox2.Text = DateTime.Now;
            LogMsg.AppendText(DateTime.Now + " | " + tbRFIDlabel.Text + " | " + tbName.Text + Environment.NewLine);
            mysqlcon.Open();
            MySqlCommand cmd = new MySqlCommand("insert into rfid(LogDate,LogTime,cardnumber,name) values('" + DateTime.Now.Date + "','" + DateTime.Now.TimeOfDay + "','" + tbRFIDlabel.Text + "','" + tbName.Text + "')", mysqlcon);

            cmd.ExecuteNonQuery();
            mysqlcon.Close();
            tbName.Text      = "";
            tbRFIDlabel.Text = "";
        }
Example #6
0
 private void button4_Click(object sender, EventArgs e)
 {
     LogMsg.AppendText(DateTime.Now + " | " + "Save LOG to files" + Environment.NewLine);
 }
Example #7
0
 private void button3_Click(object sender, EventArgs e)
 {
     LogMsg.AppendText(DateTime.Now + " | " + "Serial Port TEST" + Environment.NewLine);
     serialPort1.Write("2");
 }
Example #8
0
 private void button2_Click(object sender, EventArgs e)
 {
     serialPort1.Write("9");
     serialPort1.Close();
     LogMsg.AppendText(DateTime.Now + " | " + "Closed Arduino Serial Port" + Environment.NewLine);
 }
Example #9
0
 private void AppendTextToLogMsg(object text)
 {
     LogMsg.AppendText(text.ToString());
 }