示例#1
0
        /// <summary>
        /// Initializes the camera and populates the UI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void InitializeCameraButton_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            // Clear any previous message.
            rootPage.NotifyUser("", NotifyType.StatusMessage);

            button.IsEnabled = false;
            await _previewer.InitializeCameraAsync();

            button.IsEnabled = true;

            if (_previewer.IsPreviewing)
            {
                button.Visibility         = Visibility.Collapsed;
                PreviewControl.Visibility = Visibility.Visible;
                CheckIfStreamsAreIdentical();
                PopulateComboBox(MediaStreamType.VideoPreview, PreviewSettings);
                PopulateComboBox(MediaStreamType.Photo, PhotoSettings, false);
                PhotoButton.IsEnabled = true;
            }

            var picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            // Fall back to the local app storage if the Pictures Library is not available
            _captureFolder = picturesLibrary.SaveFolder ?? ApplicationData.Current.LocalFolder;
        }
        /// <summary>
        /// Initializes the camera and populates the UI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void InitializeCameraButton_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            // Clear any previous message.
            rootPage.NotifyUser("", NotifyType.StatusMessage);

            button.IsEnabled = false;
            await _previewer.InitializeCameraAsync();

            button.IsEnabled = true;

            if (_previewer.IsPreviewing)
            {
                if (string.IsNullOrEmpty(_previewer.MediaCapture.MediaCaptureSettings.AudioDeviceId))
                {
                    rootPage.NotifyUser("No audio device available. Cannot capture.", NotifyType.ErrorMessage);
                }
                else
                {
                    button.Visibility         = Visibility.Collapsed;
                    PreviewControl.Visibility = Visibility.Visible;
                    CheckIfStreamsAreIdentical();
                    PopulateComboBoxes();
                    VideoButton.IsEnabled = true;
                }
            }

            var picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            // Fall back to the local app storage if the Pictures Library is not available
            _captureFolder = picturesLibrary.SaveFolder ?? ApplicationData.Current.LocalFolder;
        }
        /// <summary>
        /// Initializes the camera and populates the UI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void InitializeCameraButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            var button = sender as Button;

            // Clear any previous message.
            rootPage.NotifyUser("", NotifyType.StatusMessage);

            button.IsEnabled = false;
            await _previewer.InitializeCameraAsync();

            button.IsEnabled = true;

            if (_previewer.IsPreviewing)
            {
                if (string.IsNullOrEmpty(_previewer.MediaCapture.MediaCaptureSettings.AudioDeviceId))
                {
                    rootPage.NotifyUser("No audio device available. Cannot capture.", NotifyType.ErrorMessage);
                }
                else
                {
                    button.Visibility         = Visibility.Collapsed;
                    PreviewControl.Visibility = Visibility.Visible;
                    CheckIfStreamsAreIdentical();
                    PopulateComboBoxes();
                    VideoButton.IsEnabled = true;
                }
            }
        }
示例#4
0
        /// <summary>
        /// Initializes the camera and populates the UI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void InitializeCameraButton_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            // Clear any previous message.
            rootPage.NotifyUser("", NotifyType.StatusMessage);

            button.IsEnabled = false;
            await _previewer.InitializeCameraAsync();

            button.IsEnabled = true;

            if (_previewer.IsPreviewing)
            {
                button.Visibility         = Visibility.Collapsed;
                PreviewControl.Visibility = Visibility.Visible;
                PopulateSettingsComboBox();
            }
        }
        /// <summary>
        /// Initializes the camera and populates the UI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void InitializeCameraButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            var button = sender as Button;

            // Clear any previous message.
            rootPage.NotifyUser("", NotifyType.StatusMessage);

            button.IsEnabled = false;
            await _previewer.InitializeCameraAsync();

            button.IsEnabled = true;

            if (_previewer.IsPreviewing)
            {
                button.Visibility         = Visibility.Collapsed;
                PreviewControl.Visibility = Visibility.Visible;
                CheckIfStreamsAreIdentical();
                PopulateComboBox(MediaStreamType.VideoPreview, PreviewSettings);
                PopulateComboBox(MediaStreamType.Photo, PhotoSettings, false);
                PhotoButton.IsEnabled = true;
            }
        }