/// <summary> /// Initialize all the components /// </summary> public MainGUI() { InitializeComponent(); m_camCapture = CamCapture.getInstance(); //Set up combo box with devices m_capDevBinding = new BindingSource(); m_capDevBinding.DataSource = CamCapture.CapDev; comboBox1.DisplayMember = "Name"; /* use Name feild for display */ comboBox1.ValueMember = "DevicePath"; /* use DevicePath (moniker) for value */ comboBox1.DataSource = m_capDevBinding.DataSource; mainAlteredFeed.SizeMode = PictureBoxSizeMode.StretchImage; capturePic.SizeMode = PictureBoxSizeMode.StretchImage; testingPic.SizeMode = PictureBoxSizeMode.StretchImage; transperency.SizeMode = PictureBoxSizeMode.StretchImage; //Set up processing m_processing = Processing.getInstance(); setupProcessingListener(); //I want to have the feed running right when the aplication starts m_camCapture.CaptureWindow = mainLiveFeed; m_camCapture.start(); }
/// <summary> /// Capture data from a different source /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { bool tempRunning = false; //If the cam is recording stop it to make the switch if (m_camCapture != null) { tempRunning = m_camCapture.Running; m_camCapture.stop(); } //Resume the display if it was running at the beginning m_camCapture.FilterIndex = comboBox1.SelectedIndex; if (tempRunning) { m_camCapture.CaptureWindow = (tabControl1.SelectedIndex == 0 ? mainLiveFeed : testingPic); m_camCapture.start(); } }