Пример #1
0
 /// <summary>
 /// Gerufen durch SaveAktieCommand als 'Execute'-Methode
 /// Speichert Aktiensymbol im lokalen Storage
 /// </summary>
 private void Save()
 {
     _aktienStorage.AddAktie(Symbol);
     AppNavigationService.GoBack();
 }
Пример #2
0
 public void Remove()
 {
     _appContacts.Remove(EMail);
     AppNavigationService.GoBack();
 }
Пример #3
0
        private async Task TakePhotoAsync()
        {
            IsBusy = true;

            string recognizeText = null;

            try
            {
                using (var stream = await mediaPicker.TakePhotoAsync())
                {
                    if (stream != null)
                    {
                        var imageBytes = await stream.ToArrayAsync();

                        MessengerInstance.Send(new NotificationMessage <byte[]>(imageBytes, Constants.PhotoTaken));
                        Message = null;

                        if (await NetworkService.IsInternetAvailableAsync())
                        {
                            var result = await cognitiveClient.AnalyzeAsync(stream, Language, RecognitionType.Text);

                            var ocrResult = result.OcrResult;

                            if (ocrResult.ContainsText)
                            {
                                recognizeText = ocrResult.Text;
                            }
                            else
                            {
                                recognizeText = AppResources.UnableToRecognizeText;
                            }
                        }
                        else
                        {
                            // Internet isn't available, the service cannot be reached.
                            recognizeText = AppResources.NoConnection;
                        }
                    }
                    else
                    {
                        // If message is null at this point, this is the first request. If we cancel it, turns automatically to the
                        // previous page.
                        if (message == null)
                        {
                            AppNavigationService.GoBack();
                        }

                        IsBusy = false;
                        return;
                    }
                }
            }
            catch (CognitiveException ex)
            {
                // Unable to access the service (message contains translated error details).
                recognizeText = ex.Message;
            }
            catch (WebException)
            {
                // Internet isn't available, the service cannot be reached.
                recognizeText = AppResources.NoConnection;
            }
            catch (Exception ex)
            {
                var error = AppResources.RecognitionError;

                if (Settings.ShowExceptionOnError)
                {
                    error = $"{error} ({ex.Message})";
                }

                recognizeText = error;
            }

            // Shows the result.
            Message = this.GetNormalizedMessage(recognizeText);
            IsBusy  = false;
        }
Пример #4
0
 public void Update()
 {
     _appContacts.Update(this);
     AppNavigationService.GoBack();
 }
Пример #5
0
 public void Save()
 {
     //geänderte Daten speichern
     AppNavigationService.GoBack();
 }