Ejemplo n.º 1
0
        /// <summary>
        /// 检测机器上面是否有麦克风,有/true,没有/false
        /// </summary>
        /// <returns></returns>
        public bool existMicro(string zimuD)
        {
            if (zimuD == "")
            {
                JsEvent.parameter = null;
            }
            else
            {
                JsEvent.parameter = Deserialize <parameter>(zimuD);
            }
            IList <MicrophoneInformation> microphones = SoundDevice.GetMicrophones();
            bool existMicro = false;

            if (microphones != null && microphones.Count > 0)
            {
                foreach (MicrophoneInformation mi in microphones)
                {
                    if (mi.Name.Contains("麦克风") || mi.Name.ToLower().Contains("microphone"))
                    {
                        existMicro = true;
                    }
                }
            }
            return(existMicro);
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 检测机器上面是否有麦克风,1.3版本
        /// </summary>
        /// <param name="zimuD"></param>
        /// <returns></returns>
        public void recordAuthority_n(string zimuD)
        {
            if (zimuD == "")
            {
                JsEvent.parameter = null;
            }
            else
            {
                parameter           = new parameter();
                parameter1          = Deserialize <parameter1>(zimuD);
                parameter.zimu      = parameter1.captions;
                parameter.wordIndex = parameter1.wordIndex.ToString();
                parameter.type      = parameter1.recordType;
            }
            IList <MicrophoneInformation> microphones = SoundDevice.GetMicrophones();
            bool existMicro = false;

            if (microphones != null && microphones.Count > 0)
            {
                foreach (MicrophoneInformation mi in microphones)
                {
                    if (mi.Name.Contains("麦克风") || mi.Name.ToLower().Contains("microphone"))
                    {
                        existMicro = true;
                    }
                }
            }
            mesage msag = new mesage();

            if (existMicro)
            {
                msag.code = 0;
                msag.msg  = "检测有麦克风";
                msag.data = null;
            }
            else
            {
                msag.code = 100;
                msag.msg  = "检测没有麦克风";
                msag.data = null;
            }
            string res = EnSerialize <mesage>(msag);

            JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + parameter1.cbId + "','" + res + "');");
        }