Example #1
0
        private void ImageProcessorOnCameraErrorEvent(object sender, CameraEventBase cameraErrorInfo)
        {
            switch (cameraErrorInfo.EventType)
            {
                case CameraEventType.Shutdown:
                    _logger.Trace("Пришло событие CameraEventType.Shutdown");

                    TakingPicture = false;
                    _dialogService.ShowInfo(cameraErrorInfo.Message);
                    Dispose();
                    UpdateCommands();
                    break;
                case CameraEventType.Error:
                    var oldCameraStatus = TakingPicture;
                    TakingPicture = false;
                    SetWindowStatus(true);
                    UpdateCommands();

                    var ev = cameraErrorInfo as ErrorEvent;
                    if (ev != null && ev.ErrorCode == ReturnValue.NotSupported)
                    {
                        _logger.Trace("Пришло событие ошибки CameraEventType.Error, Type: NotSupported");
                        //не убирать. пропадёт отсчёт
                        //camera is still in previous state, just some setting parameter is not supported
                        TakingPicture = oldCameraStatus;
                        return;
                    }
                    if (ev != null && ev.ErrorCode == ReturnValue.TakePictureAutoFocusNG)
                    {
                        _dialogService.ShowInfo("Не удалось сфокусироваться. Пожалуйста, повторите попытку.");
                    }
                    else
                    {
                        _dialogService.ShowInfo("Упс... Что-то пошло не так =(");
                    }
                    _logger.Error($"Пришло событие ошибки CameraEventType.Error, Type: {ev?.ErrorCode} , Message: {ev?.Message.ToString()}");

                    //TODO разобраться как перезапустить камеру
                    GoBack();
                    break;
            }
        }
        private void ImageProcessorOnCameraErrorEvent(object sender, CameraEventBase cameraErrorInfo)
        {
            switch (cameraErrorInfo.EventType)
            {
                case CameraEventType.Shutdown:
                    // Dispose();

                    break;
                case CameraEventType.Error:

                    var ev = cameraErrorInfo as ErrorEvent;
                    if (ev != null && ev.ErrorCode == ReturnValue.TakePictureAutoFocusNG)
                    {
                        _dialogService.ShowInfo("Не удалось сфокусироваться. Пожалуйста, повторите попытку.");
                        //Dispose();
                        //Initialize();
                        //TODO Временное решение, вообще надо оставлять на этой же View
                        GoBack();
                        //_imageProcessor.StopLiveView();
                        //_imageProcessor.StartLiveView();
                        //_takePhotoEnable = true;
                    }
                    if (ev != null && ev.ErrorCode == ReturnValue.NotSupported)
                        return;
                    else
                    {
                        _dialogService.ShowInfo("Упс... Что-то пошло не так =(");
                    }
                    _logger.Error($"Пришло событие ошибки CameraEventType.Error, Type: {ev?.ErrorCode} , Message: {ev?.Message.ToString()}");
                    GoBack();
                    break;
            }
        }
Example #3
0
 protected virtual void RaiseCameraEvent(CameraEventBase eventBase)
 {
     CameraErrorEvent?.Invoke(this, eventBase);
 }