Example #1
0
        private void button_refresh_Click(object sender, EventArgs e)
        {
            try
            {
                //获取摄像头列表
                IList <CameraInformation> cameras = Camera.GetCameras();
                this.comboBox_camera.DataSource = cameras;
                if (cameras.Count > 0)
                {
                    this.comboBox_camera.SelectedIndex = 0;
                }

                //获取麦克风列表
                IList <MicrophoneInformation> microphones = SoundDevice.GetMicrophones();
                this.comboBox_mic.DataSource = microphones;
                if (microphones.Count > 0)
                {
                    this.comboBox_mic.SelectedIndex = 0;
                }

                //获取扬声器列表
                IList <SpeakerInformation> speakers = SoundDevice.GetSpeakers();
                this.comboBox_speaker.DataSource = speakers;
                if (speakers.Count > 0)
                {
                    this.comboBox_speaker.SelectedIndex = 0;
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }