Example #1
0
        private void button_start_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                this.label_error.Visible  = false;
                this.label_error2.Visible = false;
                this.label_error3.Visible = false;
                this.label_info.Visible   = true;
                if (!SoundDevice.IsSoundCardInstalled())
                {
                    this.label_error3.Visible = true;
                    this.label_error3.Text    = "声卡没有安装";
                }

                var reIni = this.multimediaManager.CameraDeviceIndex != this.comboBox_camera.SelectedIndex ||
                            this.multimediaManager.MicrophoneDeviceIndex != this.comboBox_mic.SelectedIndex ||
                            this.multimediaManager.SpeakerIndex != this.comboBox_speaker.SelectedIndex;

                this.multimediaManager.CameraDeviceIndex     = this.comboBox_camera.SelectedIndex;
                this.multimediaManager.MicrophoneDeviceIndex = this.comboBox_mic.SelectedIndex;
                this.multimediaManager.SpeakerIndex          = this.comboBox_speaker.SelectedIndex;
                if (this.DeviceSelected != null)
                {
                    this.DeviceSelected(this);
                }

                if (!this.multimediaManager.Available)
                {
                    this.multimediaManager.Initialize(this.userID, "", this.ipe.IPAddress, this.ipe.Port); //与OMCS服务器建立连接,并登录
                }

                //尝试连接设备
                this.cameraConnector1.BeginConnect(this.userID);
                this.microphoneConnector1.BeginConnect(this.userID);

                this.decibelDisplayer1.Working = true;
                this.button_start.Enabled      = false;
                this.button_stop.Enabled       = true;
                this.button_refresh.Enabled    = false;
                this.comboBox_camera.Enabled   = false;
                this.comboBox_mic.Enabled      = false;
                this.comboBox_speaker.Enabled  = false;
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Example #2
0
        private void button_start_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                this.label_error.Visible  = false;
                this.label_error2.Visible = false;
                this.label_error3.Visible = false;
                this.label_info.Visible   = true;
                if (!SoundDevice.IsSoundCardInstalled())
                {
                    this.label_error3.Visible = true;
                    this.label_error3.Text    = "声卡没有安装";
                }

                bool reIni = this.multimediaManager.CameraDeviceIndex != this.comboBox1.SelectedIndex ||
                             this.multimediaManager.MicrophoneDeviceIndex != this.comboBox2.SelectedIndex ||
                             this.multimediaManager.SpeakerIndex != this.comboBox3.SelectedIndex;
                if (reIni && this.multimediaManager.Available)
                {
                    this.multimediaManager.Dispose();

                    //初始化多媒体管理器
                    this.multimediaManager.CameraDeviceIndex     = this.comboBox1.SelectedIndex;
                    this.multimediaManager.MicrophoneDeviceIndex = this.comboBox2.SelectedIndex;
                    this.multimediaManager.SpeakerIndex          = this.comboBox3.SelectedIndex;
                    this.multimediaManager.Initialize(this.userID, "", this.ipe.IPAddress, this.ipe.Port); //与OMCS服务器建立连接,并登录
                }

                //尝试连接设备
                this.cameraConnector1.BeginConnect(this.userID);
                this.microphoneConnector1.BeginConnect(this.userID);

                this.button_start.Enabled   = false;
                this.button1.Visible        = false;
                this.button_stop.Enabled    = true;
                this.button_refresh.Enabled = false;
                this.comboBox1.Enabled      = false;
                this.comboBox2.Enabled      = false;
                this.comboBox3.Enabled      = false;
            }
            catch (Exception ee)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(ee.Message);
            }
        }