예제 #1
0
        private void FormSecurity_Load(object sender, EventArgs e)
        {
            this.roomsTableAdapter.FillByName(this.accessControlSystemDataSet.Rooms, ConfigurationManager.AppSettings["Room"].ToString());

            Clear_the_Form();

            toolStripStatusLabelDate.Text = DateTime.Now.ToLongDateString();
            toolStripStatusLabelTime.Text = DateTime.Now.ToShortTimeString();
            this.labelObject.Text        += ConfigurationManager.AppSettings["Room"].ToString();
            this.roomsBindingSource.MoveFirst();
            this.id_room = Convert.ToInt32(((DataRowView)this.roomsBindingSource.Current).Row["ID_room"].ToString());

            arduinoRW = new ArduinoRW();
            arduinoRW.ArduinoPortClose += _arduinoRW_ArduinoPortClose;
            arduinoRW.ArduinoReadUID   += _arduinoRW_ArduinoReadUID;
            arduinoThread = new Thread(arduinoRW.Start);
            arduinoThread.IsBackground = true;
            arduinoThread.Start();
            Thread.Sleep(100);
            arduinoRW.ReadUID();

            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer()
            {
                Interval = 1000
            };
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
        }
 private void GetNewArduinoThread()
 {
     this.arduinoRW = new ArduinoRW();
     this.arduinoRW.ArduinoPortClose += this._arduinoRW_ArduinoPortClose;
     this.arduinoRW.ArduinoReadUID   += this._arduinoRW_ArduinoReadUID;
     this.arduinoThread = new Thread(arduinoRW.Start);
     this.arduinoThread.IsBackground = true;
     this.arduinoThread.Start();
 }
        private void FormKeyUser_Load(object sender, EventArgs e)
        {
            this.view_key_userTableAdapter.Fill(this.accessControlSystemDataSet.View_key_user);

            arduinoRW     = new ArduinoRW();
            arduinoThread = new Thread(arduinoRW.Start);
            arduinoThread.IsBackground  = true;
            arduinoRW.ArduinoPortClose += _arduinoRW_ArduinoPortClose;
            arduinoRW.ArduinoReadUID   += _arduinoRW_ArduinoReadUID;
            arduinoThread.Start();
        }
        private void FormKeysAddEdit_Load(object sender, EventArgs e)
        {
            this.key_typeTableAdapter.Fill(this.accessControlSystemDataSet.Key_type);
            this.key_statusTableAdapter.Fill(this.accessControlSystemDataSet.Key_status);
            this.keysTableAdapter.Fill(this.accessControlSystemDataSet.Keys);

            arduinoRW = new ArduinoRW();

            arduinoRW.ArduinoPortClose += _arduinoRW_ArduinoPortClose;
            arduinoRW.ArduinoReadUID   += _arduinoRW_ArduinoReadUID;

            arduinoThread = new Thread(arduinoRW.Start);
            arduinoThread.IsBackground = true;
            arduinoThread.Start();
        }