예제 #1
0
 /// <summary>
 /// Helper method to initiate the call to the Hawaii OCR service.
 /// </summary>
 /// <param name="hawaiiAppId">Specifies the Hawaii Application Id.</param>
 /// <param name="imageBuffer">
 /// Specifies a buffer containing an image that has to be processed.
 /// The image must be in JPEG format.
 /// </param>
 /// <param name="onComplete">Specifies an on complete callback method.</param>
 public static void RecognizeImageAsync(
     string hawaiiAppId,
     byte[] imageBuffer,
     ServiceAgent <OcrServiceResult> .OnCompleteDelegate onComplete)
 {
     OcrService.RecognizeImageAsync(
         hawaiiAppId,
         imageBuffer,
         onComplete,
         null);
 }
        private void StartOcrConversion(byte[] photoStream)
        {
            byte[] photoBuffer = photoStream;

            OcrService.RecognizeImageAsync(
                SettingsApi.HawaiiGuid,
                photoBuffer,
                (output) =>
            {
                this.Dispatcher.BeginInvoke(() => OnOcrCompleted(output));
            });
        }
예제 #3
0
        private void StartOcrConversion(byte[] photoStream)
        {
            _progressIndicator.IsVisible = true;
            _progressIndicator.Text      = "Trwa konwersja OCR...";

            byte[] photoBuffer = photoStream;

            OcrService.RecognizeImageAsync(
                SettingsApi.HawaiiGuid,
                photoBuffer,
                (output) =>
            {
                this.Dispatcher.BeginInvoke(() => OnOcrCompleted(output));
            });
        }
예제 #4
0
        private void StartOcrConversion()
        {
            OcrService.RecognizeImageAsync(
                HawaiiClient.HawaiiApplicationId,
                OcrClientUtils.GetPhotoBits(this.ocrData.PhotoStream),
                (output) =>
            {
                // This section defines the body of what is known as an anonymous method.
                // This anonymous method is the callback method
                // called on the completion of the OCR process.
                // Using Dispatcher.BeginInvoke ensures that
                // OnOcrCompleted is invoked on the Main UI thread.
                this.Dispatcher.BeginInvoke(() => OnOcrCompleted(output));
            });

            this.ocrConversionStateManager.OcrConversionState = OcrConversionState.Converting;
            this.Dispatcher.BeginInvoke(() => { this.mainPivot.SelectedIndex = 1; });
        }