Exemple #1
0
        private void LoadCallBack(IAsyncResult r)
        {
            var result = _loadDel.EndInvoke(r);

            #region If no devices detected

            if (result.Count == 0)
            {
                Dispatcher.Invoke(() =>
                {
                    RecordPauseButton.IsEnabled    = false;
                    FpsNumericUpDown.IsEnabled     = false;
                    VideoDevicesComboBox.IsEnabled = false;

                    WebcamControl.Visibility = Visibility.Collapsed;
                    NoVideoLabel.Visibility  = Visibility.Visible;
                });

                return;
            }

            #endregion

            #region Detected at least one device

            Dispatcher.Invoke(() =>
            {
                VideoDevicesComboBox.ItemsSource   = result;
                VideoDevicesComboBox.SelectedIndex = 0;

                RecordPauseButton.IsEnabled    = true;
                FpsNumericUpDown.IsEnabled     = true;
                VideoDevicesComboBox.IsEnabled = true;

                WebcamControl.Visibility = Visibility.Visible;
                NoVideoLabel.Visibility  = Visibility.Collapsed;

                _actHook.Start(false, true); //false for the mouse, true for the keyboard.
            });

            #endregion
        }
Exemple #2
0
    private async Task LoadWebcams()
    {
        var result = await Task.Run(LoadVideoDevices);

        #region If no devices detected

        if (result.Count == 0)
        {
            RecordPauseButton.IsEnabled    = false;
            FpsNumericUpDown.IsEnabled     = false;
            VideoDevicesComboBox.IsEnabled = false;

            WebcamControl.Visibility = Visibility.Collapsed;
            NoVideoLabel.Visibility  = Visibility.Visible;

            return;
        }

        #endregion

        #region Detected at least one device

        VideoDevicesComboBox.ItemsSource   = result;
        VideoDevicesComboBox.SelectedIndex = 0;

        RecordPauseButton.IsEnabled    = true;
        FpsNumericUpDown.IsEnabled     = true;
        VideoDevicesComboBox.IsEnabled = true;

        WebcamControl.Visibility = Visibility.Visible;
        NoVideoLabel.Visibility  = Visibility.Collapsed;

        _actHook.Start(false, true); //false for the mouse, true for the keyboard.

        #endregion
    }
 protected override void OnStartup(object sender, StartupEventArgs e)
 {
     DisplayRootViewFor <ShellViewModel>();
     InputHook.Start();
 }