private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Title = "Open"; open.Filter = "All Files|*.*"; try { if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //khởi tạo đối tượng myVehicleCountingWrapper = new MyVehicleCountingWrapper(open.FileName, myVehicleCountingWrapper.COUNT_DOWN_TO_TOP); //bắt đầu đếm myVehicleCountingWrapper.functionMain(); axWindowsMediaPlayer1.URL = (open.FileName); } } catch (ArgumentException ex) { MessageBox.Show(ex.Message.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnStartStop_Click(object sender, EventArgs e) { if (!counting) { counting = true; //khởi tạo đối tượng int type_count = typeCounting.SelectedIndex; System.Diagnostics.Debug.WriteLine("DUongthdg" + type_count); myVehicleCountingWrapper = new MyVehicleCountingWrapper(txtInput.Text, type_count); thread = new Thread(new ThreadStart(this.startCounting)); thread.Start(); //bắt đầu đếm btnStartStop.Text = "Stop"; getNumberVehicle(); } else { thread.Abort(); myVehicleCountingWrapper.stopCounting(); counting = false; myTimer.Stop(); btnStartStop.Text = "Start"; } }