Beispiel #1
0
        private void StartListening()
        {
            try
            {
                _speechRecognitionInstance.StartSpeechToText();
            }
            catch (Exception ex)
            {
                var toastConfig = new ToastConfig("Er is iets mis gegaan bij het opnemen. Neem contact op wanneer dit blijft gebeuren");
                toastConfig.SetDuration(5000);
                toastConfig.SetBackgroundColor(System.Drawing.Color.Firebrick);

                UserDialogs.Instance.Toast(toastConfig);
            }
        }
        private void recordClick(object sender, EventArgs e)
        {
            ImageButton btn = sender as ImageButton;

            try
            {
                if (btn.ClassId == "recordName")
                {
                    txtName.Focus();
                }
                else if (btn.ClassId == "recordAddress")
                {
                    txtAddress.Focus();
                }
                else if (btn.ClassId == "recordDes")
                {
                    txtDes.Focus();
                }
                _speechRecongnitionInstance.StartSpeechToText();
            }
            catch (Exception ex)
            {
                txtName.Text = ex.Message;
            }

            if (Device.RuntimePlatform == Device.iOS)
            {
                recordName.IsEnabled    = false;
                recordAddress.IsEnabled = false;
                recordDes.IsEnabled     = false;
            }
        }
Beispiel #3
0
        private async void Start_Clicked(object sender, EventArgs e)
        {
            try
            {
                var canProceed = await CheckPermissionAsync();

                if (canProceed)
                {
                    _speechRecongnitionInstance.StartSpeechToText();
                }
                else
                {
                    if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Microphone))
                    {
                        await DisplayAlert("Need Mic", "Need MicrophoneAccess", "OK");
                    }

                    var status = await CrossPermissions.Current.RequestPermissionAsync <MicrophonePermission>();

                    if (status == PermissionStatus.Granted)
                    {
                        Start_Clicked(sender, e);
                    }
                }
            }
            catch (Exception ex)
            {
                recon.Text = ex.Message;
            }

            if (Device.RuntimePlatform == Device.iOS)
            {
                start.IsEnabled = false;
            }
        }
Beispiel #4
0
 private void Button_Clicked(object sender, EventArgs e)
 {
     try
     {
         _speechRecongnitionInstance.StartSpeechToText();
     }
     catch (Exception ex)
     {
         recon.Text = ex.Message;
     }
 }
        private void RecordDes_Clicked(object sender, EventArgs e)
        {
            ImageButton btn = sender as ImageButton;

            try
            {
                if (btn.ClassId == "recordDes")
                {
                    txtDes.Focus();
                }
                _speechRecongnitionInstance.StartSpeechToText();
            }
            catch (Exception)
            {
            }

            if (Device.RuntimePlatform == Device.iOS)
            {
                recordDes.IsEnabled = false;
            }
        }
Beispiel #6
0
 private void RecordAudio()
 {
     if (paired == true)
     {
         try
         {
             _speechRecongnitionInstance.StartSpeechToText();
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
 }
Beispiel #7
0
        private void Start_Clicked(object sender, EventArgs e)
        {
            try
            {
                _speechRecongnitionInstance.StartSpeechToText();
            }
            catch (Exception ex)
            {
                recon.Text = ex.Message;
            }

            if (Device.RuntimePlatform == Device.iOS)
            {
                start.IsEnabled = false;
            }
        }
Beispiel #8
0
        public void SpeechCommandExecute()
        {
            try
            {
                _speechRecongnitionInstance.StartSpeechToText();
            }
            catch (Exception ex)
            {
                ShowSpokenText = ex.Message;
            }

            if (Device.RuntimePlatform == Device.iOS)
            {
                //start.IsEnabled = false;
            }
        }
Beispiel #9
0
        public void StartSpeechRecognition()
        {
            try
            {
                _speechRecongnitionInstance.StartSpeechToText();
            }
            catch (Exception ex)
            {
                //recon.Text = ex.Message;
            }

            if (Device.RuntimePlatform == Device.iOS)
            {
                //start.IsEnabled = false;
            }
        }
        private void SetUpSubscribes()
        {
            MessagingCenter.Subscribe <ISpeechToText, string>(this, "STT", (sender, args) =>
            {
                Text += args + " ";
                UpdateText();
            });


            MessagingCenter.Subscribe <MainPage>(this, "Speech_Clicked", (sender) =>
            {
                try
                {
                    SpeechToText.StartSpeechToText();
                }
                catch (Exception ex)
                {
                    Text = ex.Message;
                    UpdateText();
                }
            });

            MessagingCenter.Subscribe <IMessageSender, string>(this, "STT", (sender, args) =>
            {
                Text = Text + args + " ";
                UpdateText();
            });

            MessagingCenter.Subscribe <NewGroupPage, GroupOfItems>(this, "AddGroup", async(sender, group) =>
            {
                var newItem = group as GroupOfItems;
                Groups.Add(newItem);
                // await DataStore.AddItemAsync(newItem);
            });

            MessagingCenter.Subscribe <NewItemPage, Item>(this, "AddItem", (sender, item) =>
            {
                var newItem = item as Item;
                Groups[item.WhichGroup].Items.Add(newItem);
            });

            MessagingCenter.Subscribe <MainPage, Item>(this, "ClickPicture", (obj, item) =>
            {
                Text += item.Text + " ";
                UpdateText();
            });

            MessagingCenter.Subscribe <MainPage>(this, "Delete_Clicked", (sender) =>
            {
                if (Text.Length < 1)
                {
                    return;
                }
                Text = Text.Remove(Text.Length - 1, 1);
                if (Text.Contains(" "))
                {
                    Text  = Text.Remove(Text.LastIndexOf(" "));
                    Text += " ";
                }
                else
                {
                    Text = "";
                }
                UpdateText();
            });

            MessagingCenter.Subscribe <MainPage>(this, "Listen_Clicked", (sender) =>
            {
                TextToSpeech.Speak(Text);
            });
        }
 private void tapToSpeech()
 {
     _speechToText.StartSpeechToText();
 }
 private void VoiceCommandExecute()
 {
     _speechRecongnitionInstance.StartSpeechToText();
 }