private void OnCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(() => { this.phoneCamera.FlashMode = FlashMode.Auto; this.phoneCamera.Focus(); this.previewBuffer = new WriteableBitmap((int)this.phoneCamera.PreviewResolution.Width, (int)this.phoneCamera.PreviewResolution.Height); this.barcodeReader = new BarcodeReader(); // By default, BarcodeReader will scan every supported barcode type // If we want to limit the type of barcodes our app can read, // we can do it by adding each format to this list object //var supportedBarcodeFormats = new List<BarcodeFormat>(); //supportedBarcodeFormats.Add(BarcodeFormat.QR_CODE); //supportedBarcodeFormats.Add(BarcodeFormat.DATA_MATRIX); //_bcReader.PossibleFormats = supportedBarcodeFormats; this.barcodeReader.Options.TryHarder = true; this.barcodeReader.ResultFound += this.OnBarcodeResultFound; this.scanTimer.Start(); }); } else { this.Dispatcher.BeginInvoke(() => { this.BarcodeScannerPlugin.OnScanFailed("Unable to initialize the camera"); }); } }
void _phoneCamera_AutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { if (e.Exception != null) { Debug.WriteLine("{0}", e.Exception.Message); } }
private void camera_Initialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { cameraInitialized = true; } }
private void cam_Initialized(object sender, CameraOperationCompletedEventArgs e) { if (!e.Succeeded) { cam = null; return; } try { cam = (PhotoCamera)sender; cam.Resolution = cam.AvailableResolutions.First(); } catch (Exception) { cam = null; return; } this.Dispatcher.BeginInvoke(delegate() { if (cam == null) return; WriteableBitmap bitmap = new WriteableBitmap((int)cam.PreviewResolution.Width, (int)cam.PreviewResolution.Height); frameStart = DateTime.Now; cam.GetPreviewBufferArgb32(bitmap.Pixels); detectFaces(bitmap); }); }
void Camera_Initialized(object sender, CameraOperationCompletedEventArgs e) { try { if (e.Succeeded) { this.Camera.FlashMode = FlashMode.Off; var resx = this.Camera.AvailableResolutions; this.Camera.Resolution = resx.ElementAt(0); } else { Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("Something Error with your camera"); }); } } catch (Exception ex) { Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("Something Error with your camera"); }); } }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { MobileBarcodeScanner.Log("Initialized Camera"); if (_photoCamera == null) { return; } MobileBarcodeScanner.Log("Creating Luminance Source"); var width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); var height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); _luminance = new PhotoCameraLuminanceSource(width, height); if (_photoCamera.IsFlashModeSupported(FlashMode.On)) { _photoCamera.FlashMode = FlashMode.Off; } _initialized = true; MobileBarcodeScanner.Log("Luminance Source Created"); OnCameraInitialized(_initialized); }
private void CameraInitialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { try { // available resolutions are ordered based on number of pixels in each resolution CameraWidth = (int)Camera.PreviewResolution.Width; CameraHeight = (int)Camera.PreviewResolution.Height; if (CamInitialized != null) { CamInitialized.Invoke(this, e); } _cameraInitializedEvent.Set(); _pauseFramesEvent.Set(); } catch (ObjectDisposedException) { // If the camera was disposed, try initializing again } } }
private void OnCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(() => { this.phoneCamera.FlashMode = FlashMode.Auto; this.phoneCamera.Focus(); this.previewBuffer = new WriteableBitmap((int)this.phoneCamera.PreviewResolution.Width, (int)this.phoneCamera.PreviewResolution.Height); this.barcodeReader = new BarcodeReader(); // By default, BarcodeReader will scan every supported barcode type // If we want to limit the type of barcodes our app can read, // we can do it by adding each format to this list object //var supportedBarcodeFormats = new List<BarcodeFormat>(); //supportedBarcodeFormats.Add(BarcodeFormat.QR_CODE); //supportedBarcodeFormats.Add(BarcodeFormat.DATA_MATRIX); //_bcReader.PossibleFormats = supportedBarcodeFormats; this.barcodeReader.Options.TryHarder = true; this.barcodeReader.ResultFound += this.OnBarcodeResultFound; this.scanTimer.Start(); }); } else { this.Dispatcher.BeginInvoke(() => { this.BarcodeScannerPlugin.OnScanFailed("Unable to initialize the camera"); }); } }
/// <summary> /// Called when device camera initialized. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="CameraOperationCompletedEventArgs"/> instance containing the event data.</param> private void CameraInitialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { // Start scan process in separate thread Deployment.Current.Dispatcher.BeginInvoke( () => { while (result == null) { var cameraBuffer = new WriteableBitmap( (int)camera.PreviewResolution.Width, (int)camera.PreviewResolution.Height); camera.GetPreviewBufferArgb32(cameraBuffer.Pixels); cameraBuffer.Invalidate(); reader.Decode(cameraBuffer); } }); } else { this.result = new BarcodeScannerTask.ScanResult(TaskResult.None); NavigationService.GoBack(); } }
void _phoneCamera_AutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { Deployment.Current.Dispatcher.BeginInvoke(delegate() { focusBrackets.Visibility = Visibility.Collapsed; }); }
private void Camera_Initialized(object sender, CameraOperationCompletedEventArgs e) { int width = Convert.ToInt32(Camera.PreviewResolution.Width); int height = Convert.ToInt32(Camera.PreviewResolution.Height); decoder.Init(width, height); }
/// <summary> /// The camera object has been initialised. /// </summary> /// <param name="sender"> /// The sender object is not used. /// </param> /// <param name="e"> /// The event arguments. /// </param> private void CameraInitialised(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(delegate() { this.camera.FlashMode = FlashMode.Off; this.camera.Focus(); var pixelWidth = (int)this.camera.PreviewResolution.Width; var pixelHeight = (int)this.camera.PreviewResolution.Height; this.previewBuffer = new WriteableBitmap(pixelWidth, pixelHeight); this.barcodeReader = new BarcodeReader(); this.barcodeReader.Options.TryHarder = true; this.barcodeReader.ResultFound += this.BarcodeReaderResultFound; this.scanTimer.Start(); }); } else { Dispatcher.BeginInvoke(() => { this.ResolveWithError("Unable to initialize the camera"); }); } }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { try { if (_photoCamera == null) { return; } var width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); var height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); _luminance = new PhotoCameraLuminanceSource(width, height); _photoCamera.FlashMode = FlashMode.Off; _initialized = true; OnCameraInitialized(_initialized); } catch { InitializeCamera(); //Re-Initialize Camera } }
/// <summary> /// Called when device camera initialized. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="CameraOperationCompletedEventArgs"/> instance containing the event data.</param> private void CameraInitialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { // Start scan process in separate thread Deployment.Current.Dispatcher.BeginInvoke( () => { while (result == null) { var cameraBuffer = new WriteableBitmap( (int)camera.PreviewResolution.Width, (int)camera.PreviewResolution.Height); camera.GetPreviewBufferArgb32(cameraBuffer.Pixels); cameraBuffer.Invalidate(); reader.Decode(cameraBuffer); } }); } else { this.result = new BarcodeScannerTask.ScanResult(TaskResult.None); NavigationService.GoBack(); } }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { MobileBarcodeScanner.Log("Initialized Camera"); if (_photoCamera == null) { return; } MobileBarcodeScanner.Log("Creating Luminance Source"); var width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); var height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); _luminance = new PhotoCameraLuminanceSource(width, height); var supportedCameraModes = AudioVideoCaptureDevice.GetSupportedPropertyValues(_photoCamera.SensorLocation, KnownCameraAudioVideoProperties.VideoTorchMode); if (supportedCameraModes.ToList().Contains((UInt32)VideoTorchMode.On)) { _photoCamera.SetProperty(KnownCameraAudioVideoProperties.VideoTorchMode, VideoTorchMode.Off); } _initialized = true; MobileBarcodeScanner.Log("Luminance Source Created"); OnCameraInitialized(_initialized); }
void _phoneCamera_AutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { Deployment.Current.Dispatcher.BeginInvoke(delegate() { focusBrackets.Visibility = Visibility.Collapsed; }); }
private void Camera_Initialized(object sender, CameraOperationCompletedEventArgs e) { width = Convert.ToInt32(Camera.PreviewResolution.Width); height = Convert.ToInt32(Camera.PreviewResolution.Height); luminance = new PhotoCameraLuminanceSource(width, height); Camera.Focus(); }
void Camera_AutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { var luminance = new PhotoCameraLuminanceSource(this.CameraW, this.CameraH); this.Camera.GetPreviewBufferY(luminance.PreviewBufferY); luminance.Cutout((int)this.RR.Left, (int)this.RR.Top, (int)this.RR.Width, (int)this.RR.Height); var result = this.Reader.Decode(luminance); //this.Tip = result != null ? result.Text : DateTime.Now.ToString("不能识别 HH:mm:ss"); if (result != null) { VibrateController.Default.Start(new TimeSpan(0, 0, 0, 0, 200)); this.IsScanning = false; this.ScanBtnVisibility = Visibility.Visible; this.Tip = result.Text; this.NotifyOfPropertyChange(() => this.Tip); this.NotifyOfPropertyChange(() => this.IsScanning); this.NotifyOfPropertyChange(() => this.ScanBtnVisibility); } else { this.SetFocus(); } }
/// <summary> /// The auto focus has completed event. /// </summary> /// <param name="sender"> /// This parameter is ignored. /// </param> /// <param name="e"> /// The event arguments. /// </param> private void CameraAutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded && !this.barcodeFound) { // no barcode was found so lets try again this.camera.Focus(); } }
/// <summary> /// Called when the camera is initialized. /// </summary> private void Camera_Initialized(object sender, CameraOperationCompletedEventArgs e) { Dispatcher.BeginInvoke(() => { PreviewTransform.Rotation = _camera.Orientation; _timer.Start(); }); }
void cam_AutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { Deployment.Current.Dispatcher.BeginInvoke(delegate() { // Write message to UI. txtDebug.Text = "Auto focus has completed."; }); }
private void PhotoCamera_CaptureCompleted(object sender, CameraOperationCompletedEventArgs e) { var eventHandler = CaptureCompleted; if (eventHandler != null) { eventHandler(this, e); } }
void camera_CaptureCompleted(object sender, CameraOperationCompletedEventArgs e) { if (!e.Succeeded) { photoContainer.Fill = new SolidColorBrush(Colors.Gray); imageDetails.Text = "Camera capture failed.\n" + e.Exception.Message; } CleanUpCamera(); }
void _currentCamera_Initialized(object sender, CameraOperationCompletedEventArgs e) { Dispatcher.BeginInvoke(() => { //Start the timer that should always be initialiazed before the camera //once the camera ready we start the timer ResumeScan(); }); }
void camera_CaptureCompleted(object sender, CameraOperationCompletedEventArgs e) { if (!e.Succeeded) { photoContainer.Fill = new SolidColorBrush(Colors.Gray); imageDetails.Text = "Camera capture failed.\n" + e.Exception.Message; } CleanUpCamera(); }
/// <summary> /// Called when device camera initialized. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="CameraOperationCompletedEventArgs"/> instance containing the event data.</param> private void CameraInitialized(object sender, CameraOperationCompletedEventArgs e) { this.isInit = true; if (this.shouldDispose) { CleanUp(); return; } if (e.Succeeded) { if (this.camera.IsFlashModeSupported(FlashMode.Off)) { this.camera.FlashMode = FlashMode.Off; } // Start scan process in separate thread Task.Factory.StartNew(async (_) => { while (this.result == null) { var waitTask = Task.Delay(1500); if (this.camera.IsFocusSupported) { this.camera.Focus(); } await waitTask; int width = (int)this.camera.PreviewResolution.Width; int height = (int)this.camera.PreviewResolution.Height; int size = width * height; var cameraBuffer = new int[size]; this.camera.GetPreviewBufferArgb32(cameraBuffer); var converted = new byte[size * sizeof(int)]; Buffer.BlockCopy(cameraBuffer, 0, converted, 0, converted.Length); try { this.reader.Decode(converted, width, height, RGBLuminanceSource.BitmapFormat.BGRA32); } catch (Exception) { } } }, TaskCreationOptions.LongRunning | TaskCreationOptions.DenyChildAttach, CancellationToken.None); } else { this.result = new BarcodeScannerTask.ScanResult(TaskResult.None); NavigationService.GoBack(); } }
void cam_Initialized(object sender, CameraOperationCompletedEventArgs e) { Dictionary<object, object> zxingHints = new Dictionary<object, object>() { { DecodeHintType.TRY_HARDER, true } }; _cam.FlashMode = FlashMode.Auto; _reader = new MultiFormatUPCEANReader(zxingHints); _cam.Focus(); }
void Camera_CaptureCompleted(object sender, CameraOperationCompletedEventArgs e) { // Increments the savedCounter variable used for generating JPEG file names. SavedCounter++; Debug.WriteLine(SavedCounter.ToString()); if (IsActive) { Camera.CaptureImage(); } }
void camAutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { try { cam.CaptureImage(); System.Diagnostics.Debug.WriteLine("CaptureImage()"); } catch { } }
private void PhotoCamera_Initialized(object sender, CameraOperationCompletedEventArgs e) { State = PhotoCameraServiceState.Started; var eventHandler = Initialized; if (eventHandler != null) { eventHandler(this, e); } }
void camera_Initialized(object sender, CameraOperationCompletedEventArgs e) { Dispatcher.BeginInvoke(() => { imageDetails.Text += string.Format("{0} supported resolutions.\n", camera.AvailableResolutions.Count()); imageDetails.Text += string.Format("Current resolution: {0}\n", camera.Resolution); imageDetails.Text += string.Format("Preview resolution: {0}\n", camera.PreviewResolution); }); camera.Initialized -= camera_Initialized; }
void cam_AutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { Deployment.Current.Dispatcher.BeginInvoke(delegate() { // Write message to UI. txtDebug.Text = "Auto focus has completed."; // Hide the focus brackets. focusBrackets.Visibility = Visibility.Collapsed; }); }
void Camera_Initialized(object sender, CameraOperationCompletedEventArgs e) { this.Camera.Resolution = this.Camera.AvailableResolutions.First(); this.Camera.FlashMode = FlashMode.Off; this.CameraW = Convert.ToInt32(this.Camera.Resolution.Width); this.CameraH = Convert.ToInt32(this.Camera.Resolution.Height); this.CameraInitialized = true; this.ScanBtnVisibility = Visibility.Visible; this.NotifyOfPropertyChange(() => this.ScanBtnVisibility); }
private void PhotoCameraOnAutoFocusCompleted(object sender, CameraOperationCompletedEventArgs cameraOperationCompletedEventArgs) { try { ScanPreviewBuffer(); } catch (Exception e) { MessageBox.Show(e.Message); } }
private void CamOnInitialized(object sender, CameraOperationCompletedEventArgs eventArgs) { Dispatcher.BeginInvoke(() => { if (eventArgs.Succeeded) { TurnOffFlash(); StartFocusing(); StartScanning(); } }); }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { int width = Convert.ToInt32(PhotoCamera.PreviewResolution.Width); int height = Convert.ToInt32(PhotoCamera.PreviewResolution.Height); luminance = new PhotoCameraLuminanceSource(width, height); qrReader = new QRCodeReader(); ean13Reader = new EAN13Reader(); code39Reader = new Code39Reader(); timer = new Timer((s) => ScanPreviewBuffer(), null, 0, 250); }
void photoCamera_Initialized(object sender, CameraOperationCompletedEventArgs e) { // Initialize the Detector //This need to be done AFTER the camera is initialized arDetector = new GrayBufferMarkerDetector(); // Setup both markers Marker[] markers = GameState.getInstance().getMarkers(); arDetector.Initialize(System.Convert.ToInt32(photoCamera.PreviewResolution.Width), System.Convert.ToInt32(photoCamera.PreviewResolution.Height), 1, 4000, markers); isInitialized = true; }
//------------QR CODE ----------------- private void camera_Initialised(object sender, CameraOperationCompletedEventArgs e) { // set the camera resolution if (e.Succeeded) { var res = from resolution in camera.AvailableResolutions where resolution.Width == 640 select resolution; camera.Resolution = res.First(); } }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { int width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); int height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); _luminance = new PhotoCameraLuminanceSource(width, height); _reader = new QRCodeReader(); Dispatcher.BeginInvoke(() => { _previewTransform.Rotation = _photoCamera.Orientation; _timer.Start(); }); }
private void CameraAutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { Action action = () => { lock (this) { try { camera.CaptureImage(); } catch (Exception exception) { Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show(exception.ToString())); } } }; Deployment.Current.Dispatcher.BeginInvoke(action); }
void _camera_Initialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded == true) { Dispatcher.BeginInvoke(() => { VisualStateManager.GoToState(this, StartCaptureState.Name, false); }); } else { //TODO : 카메라 초기화 실패시에 재시도 처리가 필요함. } }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { int width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); int height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); this._luminance = new PhotoCameraLuminanceSource(width, height); this._reader = new BarcodeReader(); _reader.Options.TryHarder = true; Dispatcher.BeginInvoke(() => _previewTransform.Rotation = _photoCamera.Orientation); _photoCamera.Resolution = _photoCamera.AvailableResolutions.First(); _isInitialized = true; }
void cam_Initialized(object sender, CameraOperationCompletedEventArgs e) { //int width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); //int height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); int width = 640; int height = 480; _luminance = new PhotoCameraLuminanceSource(width, height); Dispatcher.BeginInvoke(() => { _previewTransform.Rotation = _photoCamera.Orientation; _timer.Start(); }); _photoCamera.FlashMode = FlashMode.Auto; _photoCamera.Focus(); }
void CollectCameraCaps(object sender, CameraOperationCompletedEventArgs e) { var camera = sender as PhotoCamera; if (camera == null) return; if (camera.CameraType == CameraType.Primary) { CurrentCameraResolution = camera.Resolution; HasFocusAtPoint = camera.IsFocusAtPointSupported; HasFocus = camera.IsFocusSupported; PhotoPixelLayout = camera.YCbCrPixelLayout; SupportedResolutions = camera.AvailableResolutions; } UninitializeCamera(camera); }
private void cam_Initialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { Dispatcher.BeginInvoke(delegate { _phoneCamera.FlashMode = FlashMode.Off; _previewBuffer = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width, (int)_phoneCamera.PreviewResolution.Height); _barcodeReader = new BarcodeReader { Options = { TryHarder = true } }; _barcodeReader.ResultFound += _bcReader_ResultFound; _scanTimer.Start(); }); } else Dispatcher.BeginInvoke(() => MessageBox.Show("No se ha podido inicializar la cámara!")); }
private void CamCaptureCompleted(object sender, CameraOperationCompletedEventArgs e) { _savedCounter++; }
void camera_Initialized(object sender, CameraOperationCompletedEventArgs e) { Dispatcher.BeginInvoke(() => { imageDetails.Text += string.Format("{0} supported resolutions.\n", camera.AvailableResolutions.Count()); imageDetails.Text += string.Format("Current resolution: {0}\n", camera.Resolution); imageDetails.Text += string.Format("Preview resolution: {0}\n", camera.PreviewResolution); }); camera.Initialized -= camera_Initialized; }
private void myCam_CaptureCompleted(object sender, CameraOperationCompletedEventArgs e) { //todo stuff when photo taken }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { Dispatcher.BeginInvoke(() => { _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(250); _timer.Tick += (o, arg) => ScanPreviewBuffer(); int width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); int height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); _luminance = new PhotoCameraLuminanceSource(width, height); _reader = new BarcodeReader(null, bmp => _luminance, null); }); Dispatcher.BeginInvoke(() => { _previewTransform.Rotation = _photoCamera.Orientation; _timer.Start(); }); }
/// <summary> /// Called when [camera capture completed]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Microsoft.Devices.CameraOperationCompletedEventArgs"/> instance containing the event data.</param> private void OnCameraCaptureCompleted(object sender, CameraOperationCompletedEventArgs e) { System.Diagnostics.Debug.WriteLine("CaptureCompleted"); }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { var width = Convert.ToInt32(photoCamera.PreviewResolution.Width); var height = Convert.ToInt32(photoCamera.PreviewResolution.Height); Dispatcher.BeginInvoke(() => { previewTransform.Rotation = photoCamera.Orientation; // create a luminance source which gets its values directly from the camera // the instance is returned directly to the reader luminance = new PhotoCameraLuminanceSource(width, height); reader = new BarcodeReader(null, bmp => luminance, null); }); }
/// <summary> /// Called when [camera initialized]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Microsoft.Devices.CameraOperationCompletedEventArgs"/> instance containing the event data.</param> private void OnCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { this.camera.FlashMode = FlashMode.Off; }
void _phoneCamera_AutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { if (e.Exception != null) { Debug.WriteLine("{0}", e.Exception.Message); } }
//camera setup void cam_Initialized(object sender, CameraOperationCompletedEventArgs e) { _cam.FlashMode = FlashMode.Auto; _cam.Focus(); }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { var width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); var height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); _luminance = new PhotoCameraLuminanceSource(width, height); _photoCamera.FlashMode = FlashMode.Off; _initialized = true; OnCameraInitialized(_initialized); }
void cam_CaptureCompleted(object sender, CameraOperationCompletedEventArgs e) { Debug.WriteLine("cam_CaptureCompleted"); switch (cm) { case CaptureMode.CaptureFrame: cm = CaptureMode.CapturePhoto; break; case CaptureMode.CapturePhoto: cm = CaptureMode.PostView; //cm = CaptureMode.CaptureFrame; //Deployment.Current.Dispatcher.BeginInvoke(delegate() //{ // NavigationService.Navigate(new Uri("/Postview.xaml", UriKind.Relative)); // lastView.Visibility = Visibility.Collapsed; // GuidelineIn.Begin(); //}); break; } // Increments the savedCounter variable used for generating JPEG file names. savedCounter++; savedCounter %= 2; // toggle 0 and 1 }
void cam_CaptureCompleted(object sender, CameraOperationCompletedEventArgs e) { // Increments the savedCounter variable used for generating JPEG file names. savedCounter++; }
private void PhotoCamera_Initialized(object sender, CameraOperationCompletedEventArgs e) { State = PhotoCameraServiceState.Started; var eventHandler = Initialized; if (eventHandler != null) { eventHandler(this, e); } }
private void PhotoCamera_CaptureCompleted(object sender, CameraOperationCompletedEventArgs e) { var eventHandler = CaptureCompleted; if (eventHandler != null) { eventHandler(this, e); } }
//searches for QRCode in bitmap void cam_AutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e) { if (result == null) { try { _nbTry++; watch.Reset(); watch.Start(); while ((result == null) && (watch.ElapsedMilliseconds < 1500)) { var binaryBitmap = GetBitmapFromVideo(_cam); if (binaryBitmap != null) { try { //decodes QRcode result = BarCodeManager.ZXingReader.decode(binaryBitmap); } catch { // Wasn't able to find a barcode } } } if (result != null) { BarCodeManager._onBarCodeFound(result.Text); } else { // Try to focus again if (_nbTry < BarCodeManager.MaxTry) { _cam.Focus(); } else { BarCodeManager._onError(new VideoScanException("Nothing was found during the scan")); } } } catch (Exception exc) { BarCodeManager._onError(exc); } } }