Inheritance: IMediaCaptureFailedEventArgs
Exemplo n.º 1
0
 private async void cameraCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     // It's safest to return this back onto the UI thread to show the message dialog.
     MessageDialog dialog = new MessageDialog(errorEventArgs.Message);
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
         async () => { await dialog.ShowAsync(); });
 }
 private void mediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     var action = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         progressText.Text = "MediaCapture failed: " + errorEventArgs.Message;
     });
 }
Exemplo n.º 3
0
        private async Task FireMediaCaptureFailedEvent(Windows.Media.Capture.MediaCaptureFailedEventArgs erroreventargs)
        {
            if (erroreventargs == null)
            {
                throw new ArgumentNullException("erroreventargs");
            }

            Delegate[] listeners = null;

            lock (this.dataProtector)
            {
                if (this.mediaCaptureFailedEvent == null)
                {
                    return;
                }

                listeners = this.mediaCaptureFailedEvent.GetInvocationList();

                if (listeners.Length == 0)
                {
                    return;
                }
            }

            await Task.Run(() =>
            {
                foreach (var listener in listeners)
                {
                    var args = new VideoCapture.Common.Core.Events.MediaCaptureFailedEventArgs(erroreventargs.Code, erroreventargs.Message);

                    var currentEventHandler = listener as EventHandler <VideoCapture.Common.Core.Events.MediaCaptureFailedEventArgs>;

                    if (currentEventHandler != null)
                    {
                        try
                        {
                            currentEventHandler(this, args);
                        }
                        catch (Exception)
                        {
                            // Ignore
                        }
                    }
                }
            });
        }
Exemplo n.º 4
0
		//private async void OnVideoButton_Tapped(object sender, TappedRoutedEventArgs e)
		//{
		//await RunFunctionIfOpenAsyncT(async delegate
		//{
		//    if (!_isRecordingVideo)
		//    {
		//        await StartRecordingVideoAsync();
		//    }
		//    else
		//    {
		//        await StopRecordingVideoAsync();
		//    }

		//    // After starting or stopping video recording, update the UI to reflect the MediaCapture state
		//    UpdateCaptureControls();
		//}).ConfigureAwait(false);
		//}

		//private async void OnMediaCapture_RecordLimitationExceeded(MediaCapture sender)
		//{
		//    // This is a notification that recording has to stop, and the app is expected to finalize the recording

		//    //await StopRecordingVideoAsync();

		//    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => UpdateCaptureControls());
		//}

		private async void OnMediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
		{
			//LastMessage = string.Format("MediaCapture_Failed: (0x{0:X}) {1}", errorEventArgs.Code, errorEventArgs.Message);
			LastMessage = string.Format(RuntimeData.GetText("CameraCaptureFailedW2Params"), errorEventArgs.Code, errorEventArgs.Message);

			await CleanupCameraAsync();

			//await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => UpdateCaptureControls());
		}
Exemplo n.º 5
0
 private void OnMediaCaptureFailed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     OnCameraFailed(sender, errorEventArgs);
 }
        private void OnTestedControlCameraFailed(object sender, MediaCaptureFailedEventArgs e)
        {
            if (this.IsInVisualTree())
            {
#pragma warning disable 4014
                new MessageDialog(e != null ? e.Message : "Camera Capture Failed", "Error").ShowAsync();
#pragma warning restore 4014
            }
        }
Exemplo n.º 7
0
 private async void _mediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     Debug.WriteLine("MediaCapture_Failed: (0x{0:X}) {1}", errorEventArgs.Code, errorEventArgs.Message);
     await CleanupCameraAsync();
     //停止扫描线的动画
     tip.Stop();
 }
 async void Device_CaptureFailed(object sender, MediaCaptureFailedEventArgs e)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, (() =>
     {
         rootPage.NotifyUser(e.Message, NotifyType.ErrorMessage);
     }));
 }
 /// <summary>
 /// Callback function for any failures in MediaCapture operations
 /// </summary>
 /// <param name="currentCaptureObject"></param>
 /// <param name="currentFailure"></param>
 private void mediaCapture_Failed(MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)
 {
     status.Text = currentFailure.Message;
 }
        private async void MediaCaptureOnFailed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
        {

        }
Exemplo n.º 11
0
 private void Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     MainHelper.ShowToast(errorEventArgs.Code.ToString(), errorEventArgs.Message);
 }
Exemplo n.º 12
0
 private async void MediaCaptureOnFailed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
     {
         var warningMessage = new MessageDialog(String.Format("The media capture failed: {0}", errorEventArgs.Message), "Capture Failed");
         await warningMessage.ShowAsync();
     });
 }
Exemplo n.º 13
0
 private async void OnMediaCaptureFailed(MediaCapture sender, Windows.Media.Capture.MediaCaptureFailedEventArgs erroreventargs)
 {
     await this.FireMediaCaptureFailedEvent(erroreventargs);
 }
        /// <summary>
        /// Handles MediaCapture failures. Cleans up the camera resources.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="errorEventArgs"></param>
        private async void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
        {
            await CleanupCameraAsync();

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                ExtractButton.Visibility = Visibility.Collapsed;
                CameraButton.Visibility = Visibility.Visible;

                rootPage.NotifyUser("MediaCapture Failed. " + errorEventArgs.Message, NotifyType.ErrorMessage);
            });
        }
 void device_CaptureFailed(object sender, MediaCaptureFailedEventArgs e)
 {
     rootPage.NotifyUser(e.Message, NotifyType.ErrorMessage);
 }
 private void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs e)
 {
     var task = _dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
     {
         MainPage.Current.NotifyUser("Preview stopped: " + e.Message, NotifyType.ErrorMessage);
         IsRecording = false;
         IsPreviewing = false;
         await CleanupCameraAsync();
     });
 }
Exemplo n.º 17
0
 private void OnCameraFailed(object sender, MediaCaptureFailedEventArgs e)
 {
     if (CameraFailed != null)
         CameraFailed(sender, e);
 }
Exemplo n.º 18
0
 /// <summary>
 ///  Handler for the wrapped MediaCapture object's Failed event. It just wraps and forward's MediaCapture's 
 ///  Failed event as own CaptureFailed event
 /// </summary>
 private void mediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     if (CaptureFailed != null && forwardEvents) CaptureFailed(this, errorEventArgs);
 }
Exemplo n.º 19
0
 private void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     //TODO: Handle failure during media capture
 }
Exemplo n.º 20
0
 /// <summary>
 /// Callback function for any failures in MediaCapture operations
 /// </summary>
 /// <param name="currentCaptureObject"></param>
 /// <param name="currentFailure"></param>
 private async void CameraInit_Failed(MediaCapture currentCaptureObject,
     MediaCaptureFailedEventArgs currentFailure)
 {
     await
         Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
             () => { Debug.WriteLine("MediaCaptureFailed: " + currentFailure.Message); });
 }
Exemplo n.º 21
0
 public async void Failed(Windows.Media.Capture.MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)
 {
     try
     {
         await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
         {
             ShowStatusMessage("Fatal error" + currentFailure.Message);
         });
     }
     catch (Exception e)
     {
         ShowExceptionMessage(e);
     }
 }
Exemplo n.º 22
0
 private async void OnMediaCaptureFailed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     try
     {
         await CloseAsync();
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
        private async void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
        {
            Debug.WriteLine("MediaCapture_Failed: (0x{0:X}) {1}", errorEventArgs.Code, errorEventArgs.Message);

            await CleanupCameraAsync();

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => GetPreviewFrameButton.IsEnabled = _isPreviewing);
        }
 public void RecordingFailed(Windows.Media.Capture.MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)
 {
     _recordingStatus = RecordingStatus.failed;
     NotifyUser("RecordFailed Event raised. ", NotifyType.ErrorMessage);
 }
Exemplo n.º 25
0
 private void HandleMediaCaptureFailed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 26
0
 /// <summary>
 /// Raised when an error occurs during media capture.
 /// </summary>
 /// <param name="sender">The media capture.</param>
 /// <param name="errorEventArgs">The error.</param>
 private void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     Debug.WriteLine("MediaCapture_Failed: (0x{0:X}) {1}", errorEventArgs.Code, errorEventArgs.Message);
     this.Dispose();
 }
Exemplo n.º 27
0
 private async void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     await CleanupCaptureResources();
 }
Exemplo n.º 28
0
 /// <summary>
 /// The <see cref="MediaCapture.Failed"/> event handler.
 /// </summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">The <see cref="MediaCaptureFailedEventArgs"/> instance containing the event data.</param>
 /// <exception cref="InvalidOperationException">Failure details.</exception>
 private void MediaCaptureFailed(MediaCapture sender, MediaCaptureFailedEventArgs e)
 {
     Tracing.Trace("CameraController: MediaCaptureFailed: {0} (0x{1:X8}).", e.Message, e.Code);
     throw new InvalidOperationException(e.Message);
 }
 void capture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     // Dispatch call to the UI thread since the event may get fired on some other thread
     var ignore = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
     {
         await DisposeCaptureAsync();
     });
 }
Exemplo n.º 30
0
 private void CameraCaptureOnFailed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         CancelCameraButton_OnClick(null, null);
     });
 }
        private async void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
        {
            Debug.WriteLine("MediaCapture_Failed: (0x{0:X}) {1}", errorEventArgs.Code, errorEventArgs.Message);

            await CleanupCameraAsync();

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => UpdateCaptureControls());
        }
Exemplo n.º 32
0
 private void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     string s = string.Empty;
     Recording = false;
 }