示例#1
0
        void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
        {
            if (e.Succeeded)
            {
                this.Dispatcher.BeginInvoke(delegate()
                {
                    _phoneCamera.FlashMode = FlashMode.Off;
                    _previewBuffer         = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width, (int)_phoneCamera.PreviewResolution.Height);

                    _barcodeReader = new BarcodeReader();

                    _barcodeReader.Options.TryHarder       = true;
                    _barcodeReader.ResultFound            += _bcReader_ResultFound;
                    _barcodeReader.Options.PossibleFormats = new List <BarcodeFormat>()
                    {
                        BarcodeFormat.EAN_13
                    };

                    _scanTimer.Start();
                });
            }
            else
            {
                Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("Unable to initialize the camera");
                });
            }
        }
示例#2
0
        void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
        {
            if (e.Succeeded)
            {
                this.Dispatcher.BeginInvoke(delegate()
                {
                    _phoneCamera.FlashMode = FlashMode.Off;
                    _previewBuffer         = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width, (int)_phoneCamera.PreviewResolution.Height);

                    _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);
                    //_barcodeReader.PossibleFormats = supportedBarcodeFormats;

                    _barcodeReader.TryHarder = true;

                    _barcodeReader.ResultFound += _bcReader_ResultFound;
                    _scanTimer.Start();
                });
            }
            else
            {
                Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("Unable to initialize the camera");
                });
            }
        }
示例#3
0
 void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
 {
     if (e.Succeeded)
     {
         this.Dispatcher.BeginInvoke(delegate()
         {
             txtDebug.Text = "Camera initialized";
         });
     }
 }
 // Update the UI if initialization succeeds.
 void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
 {
     if (e.Succeeded)
     {
         this.Dispatcher.BeginInvoke(delegate()
         {
             ShutterButton.Visibility = System.Windows.Visibility.Visible;
         });
     }
 }
示例#5
0
 // Update the UI if initialization succeeds.
 void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
 {
     try
     {
         if (e.Succeeded)
         {
             cam.FlashMode  = FlashMode.Off;
             cam.Resolution = cam.AvailableResolutions.First();
         }
     }
     catch (Exception ex) { LittleWatson.ReportException(ex); }
 }
示例#6
0
 // Update the UI if initialization succeeds.
 private void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
 {
     if (e.Succeeded)
     {
         this.Dispatcher.BeginInvoke(delegate()
         {
             // Write message.
             //txtDebug.Text = "Camera initialized.";
             //isCameraInitialized = true;
         });
     }
 }
示例#7
0
 // Update the UI if initialization succeeds.
 void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
 {
     if (e.Succeeded)
     {
         this.Dispatcher.BeginInvoke(delegate()
         {
             // Write message.
             txtDebug.Text = "Camera initialized.";
             // Set flash button text.
             FlashButton.Content = "Fl:" + cam.FlashMode.ToString();
         });
     }
 }
示例#8
0
 void CameraInitialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
 {
     if (e.Succeeded)
     {
         this.Dispatcher.BeginInvoke(delegate()
         {
             DisplayWelcomeMessage();
         });
     }
     else
     {
         Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show("Unable to initialize the camera");
         });
     }
 }
        // Update the UI if initialization succeeds.
        void PhotoCameraOnInitialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
        {
            if (e.Succeeded)
            {
                // Disable the flash to avoid reflections
                _photoCamera.FlashMode = FlashMode.Off;

                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);
                _reader.ResultFound += ReaderOnResultFound;

                Dispatcher.BeginInvoke(() => _photoCamera.Focus());
            }
        }
示例#10
0
        private void CameraInitialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
        {
            cameraReady = e.Succeeded;
            if (cameraReady)
            {
                if (camera.PreviewResolution.Width != cameraWidth || camera.PreviewResolution.Height != cameraHeight)
                {
                    throw new GoblinException(cameraWidth + "x" + cameraHeight + " is not supported. The supported resolutions is: " +
                                              camera.PreviewResolution.Width + "x" + camera.PreviewResolution.Height);
                }

                luminance = new byte[cameraWidth * cameraHeight];
            }
            else
            {
                Notifier.AddMessage(e.Exception.Message);
            }
        }
示例#11
0
        void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                timer.Interval = TimeSpan.FromMilliseconds(5.0);
                timer.Tick    += new EventHandler(callback);
                timer.Start();
            });

            if (!cam.IsFlashModeSupported(FlashMode.On))
            {
                System.Diagnostics.Debug.WriteLine("No flash support!");
            }
            else
            {
                cam.FlashMode = FlashMode.On;
            }
        }
示例#12
0
 private void cam_CaptureCompleted(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
 {
 }
示例#13
0
 private void cam_AutoFocusCompleted(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
 {
     cam.CaptureImage();
 }
示例#14
0
 /// <summary>
 /// Called when the <see cref="PhotoCamera.CaptureCompleted"/> event occurs.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Microsoft.Devices.CameraOperationCompletedEventArgs"/> instance containing the event data.</param>
 private void OnPhotoCameraCaptureCompleted(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
 {
     RaiseCaptureCompleted(new CameraOperationCompletedEventArgs(e.Exception));
 }
示例#15
0
 void camInitialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("Initialized");
     cam.FlashMode = FlashMode.Off;
     setToLargestRes();
 }