Exemplo n.º 1
0
        private void btnApplySettings_Click(object sender, EventArgs e)
        {
            var mainForm = (FrmPrincipal)Application.OpenForms["FrmPrincipal"];

            if (mainForm == null)
            {
                MessageBox.Show(@"Can not reached Main Form.", @"Warning");
                return;
            }

            var deviceSignature  = cbCaptureDevices.SelectedValue;
            var deviceResolution = cbVideoResolutions.SelectedIndex;

            if (deviceSignature == null || deviceResolution == -1)
            {
                MessageBox.Show(@"Can not reached the device and/or device resolution properties.", @"Warning");
                return;
            }

            var currDevice = _captureDeviceManager.GetCaptureDevices().FirstOrDefault(i => i.DeviceSignature.Equals(deviceSignature));

            if (currDevice == null)
            {
                MessageBox.Show(@"Can not reached the device.", @"Warning");
                return;
            }

            currDevice.Resolution = deviceResolution;
            mainForm.Camara       = currDevice;

            DialogResult = DialogResult.OK;
        }
Exemplo n.º 2
0
        private void btnApplySettings_Click(object sender, EventArgs e)
        {
            var mainForm = (FormDetection)Application.OpenForms["FormDetection"];

            if (mainForm == null)
            {
                MessageBox.Show(@"Не может достичь главной формы", @"Ошибка");
                return;
            }

            var deviceSignature  = cbCaptureDevices.SelectedValue;
            var deviceResolution = cbVideoResolutions.SelectedIndex;

            if (deviceSignature == null || deviceResolution == -1)
            {
                MessageBox.Show(@"Недостижимое разрешение устройства.", @"Ошибка");
                return;
            }

            var currDevice = captureDeviceManager.GetCaptureDevices().FirstOrDefault(i => i.DeviceSignature.Equals(deviceSignature));

            if (currDevice == null)
            {
                MessageBox.Show(@"Недостижимое устройство.", @"Ошибка");
                return;
            }

            currDevice.Resolution      = deviceResolution;
            mainForm.CurrCaptureDevice = currDevice;

            DialogResult = DialogResult.OK;
        }