Пример #1
0
        private void cameraToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CaptureDeviceForm form = new CaptureDeviceForm();

            form.StartPosition = FormStartPosition.CenterScreen;

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // create video source
                VideoCaptureDevice c = new VideoCaptureDevice();
                c.Source = form.Device;

                String sourceName = showGetSourceNameBox();
                if (sourceName != null) //user didn't cancel
                {
                    Log.info(String.Format("Video source: {0}", c.Source));
                    VideoSource r = new VideoSource(sourceName, c);
                    sources.Add(r);
                    r.RemoveSelected += new VideoSource.RemoveEventHandler(r_RemoveSelected);
                    sourcesToolStripMenuItem.DropDown.Items.Add(r.ContextMenu);
                    r.setViewerGlobalStickey(showAllToolStripMenuItem.Checked);
                    globalOptions.updateViewer(r);
                    r.startCamera(); //start camera by default
                }
            }
        }
Пример #2
0
        public void Initialize()
        {
            form = new CaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // create video source
                localSource             = new CaptureDevice();
                localSource.VideoSource = form.Device;

                // open it
                OpenVideoSource(localSource);
            }
        }