Example #1
0
    private void VideoDevicesComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        try
        {
            if (VideoDevicesComboBox.SelectedIndex == -1)
            {
                WebcamControl.VideoDevice = null;
                return;
            }

            WebcamControl.VideoDevice = _filters.VideoInputDevices[VideoDevicesComboBox.SelectedIndex];
            WebcamControl.Refresh();

            if (WebcamControl.VideoWidth > 0)
            {
                Width  = WebcamControl.VideoWidth * _scale / 2;
                Height = (WebcamControl.VideoHeight + 31) * _scale / 2;
            }

            if (Top < 0)
            {
                Top = 0;
            }

            if (Left < 0)
            {
                Left = 0;
            }
        }
        catch (Exception ex)
        {
            LogWriter.Log(ex, "Video device not supported");
        }
    }
Example #2
0
        private void VideoDevicesComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                WebcamControl.VideoDevice = (VideoDevicesComboBox.SelectedIndex > -1
                    ? _filters.VideoInputDevices[VideoDevicesComboBox.SelectedIndex] : null);

                WebcamControl.Refresh();
            }
            catch (Exception ex)
            {
                LogWriter.Log(ex, "Video device not supported");
            }
        }