private void LoadCallBack(IAsyncResult r) { var result = _loadDel.EndInvoke(r); if (result) { Dispatcher.Invoke(() => { //Selects the first video device. VideoDevicesComboBox.SelectedIndex = 0; StopButton.IsEnabled = true; RecordPauseButton.IsEnabled = true; FpsNumericUpDown.IsEnabled = true; VideoDevicesComboBox.IsEnabled = true; _actHook.Start(false, true); //false for the mouse, true for the keyboard. }); return; } Dispatcher.Invoke(() => { StopButton.IsEnabled = false; RecordPauseButton.IsEnabled = false; FpsNumericUpDown.IsEnabled = false; VideoDevicesComboBox.IsEnabled = false; NoVideoLabel.Visibility = Visibility.Visible; }); }
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 }