コード例 #1
0
        private void start_Click(object sender, EventArgs e)
        {
            if (!isRunning)
            {
                if (DeviceExist)
                {
                    for (int i = 0; i < comboBox1.Items.Count; i++)
                    {
                        var videoForm = new VideoForm(videoDevices[i].MonikerString, imageSize, this);
                        videoForm.Show();
                        VideoForms.Add(videoForm);
                    }

                    label2.Text   = "Device running...";
                    start.Text    = "&Stop";
                    timer.Enabled = true;
                    isRunning     = true;
                }
                else
                {
                    label2.Text = "Error: No Device selected.";
                }
            }
            else
            {
                timer.Enabled = false;
                foreach (VideoForm videoForm in VideoForms)
                {
                    videoForm.Close();
                }

                label2.Text = "Device stopped.";
                start.Text  = "&Start";
                isRunning   = false;
            }
        }
コード例 #2
0
        private void start_Click(object sender, EventArgs e)
        {
            if (!isRunning) {
                if (DeviceExist) {
                    for (int i = 0; i < comboBox1.Items.Count; i++) {
                        var videoForm = new VideoForm(videoDevices[i].MonikerString, imageSize, this);
                        videoForm.Show();
                        VideoForms.Add(videoForm);
                    }

                    label2.Text = "Device running...";
                    start.Text = "&Stop";
                    timer.Enabled = true;
                    isRunning = true;
                }
                else {
                    label2.Text = "Error: No Device selected.";
                }
            }
            else {
                timer.Enabled = false;
                foreach (VideoForm videoForm in VideoForms)
                    videoForm.Close();

                label2.Text = "Device stopped.";
                start.Text = "&Start";
                isRunning = false;
            }
        }