private void button1_Click(object sender, EventArgs e) { if (!recogButtonState) { if (mydb.IsServerConnected()) { //Console.WriteLine(mydb.getUserData("54010001")); //fishRecog = new Classifier_Fisher(); capture = new Capture(); Console.WriteLine("resolution:" + capture.Height + "," + capture.Width); Application.Idle += new EventHandler(ProcessFrame); Application.Idle += new EventHandler(runningFrame); // Application.Idle += new EventHandler(runningCropFrame); button1.Text = "STOP RECOGNIZE"; button2.Enabled = false; //button3.Enabled = false; button6.Enabled = false; recogButtonState = true; } else { MessageBox.Show("Database not connect."); } } else { Application.Idle -= new EventHandler(ProcessFrame); Application.Idle -= new EventHandler(runningFrame); imageBox1.Image = null; imageFrame = null; realfaceRectangle = Rectangle.Empty; button1.Text = "START RECOGNIZE"; ARDisplayFlag = false; recogButtonState = false; label2.Text = "Idle"; progressBar1.Value = 0; button2.Enabled = true; //button3.Enabled = true; button6.Enabled = true; capture.Dispose(); } }