Exemple #1
0
 public void hwc()
 {
     webcam = new WebCam();
     webcam.InitializeWebCam(ref pictureBox1);
     webcam.Start();
     backgroundWorker4.RunWorkerAsync();
 }
Exemple #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            textBox5.PasswordChar = '*';
            textBox4.PasswordChar = '*';

            groupBox1.Visible = false;
            groupBox2.Visible = true;
            groupBox3.Visible = false;
            client            = new TcpClient();

            serverEndPoint = new IPEndPoint(IPAddress.Parse("192.168.116.1"), 3000);

            client.Connect(serverEndPoint);

            clientStream = client.GetStream();

            //webcam
            client1 = new TcpClient();

            IPEndPoint serverEndPoint1 = new IPEndPoint(IPAddress.Parse("192.168.116.1"), 3001);

            client1.Connect(serverEndPoint1);

            clientStream1 = client1.GetStream();

            //text tranmsmission
            client2 = new TcpClient();

            IPEndPoint serverEndPoint2 = new IPEndPoint(IPAddress.Parse("192.168.116.1"), 3002);

            client2.Connect(serverEndPoint2);

            clientStream2 = client2.GetStream();

            pictureBox1.Image = pictureBox1.InitialImage;


            try
            {
                _waveOut = new WaveOut();

                int sampleRate = 8000; // 8 kHz
                int channels   = 1;    // mono

                waveIn = new WaveIn(this.Handle);
                waveIn.BufferMilliseconds = 100;

                //waveIn.DataAvailable += waveIn_DataAvailable;
                backgroundWorker1.RunWorkerAsync();
                backgroundWorker3.RunWorkerAsync();



                waveIn.WaveFormat = new WaveFormat(sampleRate, channels);
                waveIn.StartRecording();


                bwp = new BufferedWaveProvider(waveIn.WaveFormat);

                _waveOut.Init(bwp);
                _waveOut.Play();



                webcam = new WebCam();
                webcam.InitializeWebCam(ref pictureBox1);
            }
            catch (Exception ee)
            {
                label1.Text = ee.Message;
            }
            backgroundWorker2.RunWorkerAsync();
            backgroundWorker5.RunWorkerAsync();
            //backgroundWorker3.RunWorkerAsync();

            //webcam
            backgroundWorker4.RunWorkerAsync();
        }