예제 #1
0
        private void SearchTextInPage(string text)
        {
            IWebElement body = driver.FindElement(By.TagName("body"));

            if (body.Text.Contains(text))
            {
                tts.Speak("A palavra " + text + " existe!");
            }
            else
            {
                tts.Speak("A palavra " + text + " não existe!");
            }
        }
예제 #2
0
파일: Form2.cs 프로젝트: davidd1995/IM2
        public Form2()
        {
            InitializeComponent();
            t.Speak("Olá, bem vindo ao Web browser!");
            t.Speak("Vamos começar!");
            t.Speak("Em que posso ajudar?");
            webBrowser1.ScriptErrorsSuppressed = true;
            webBrowser1.GoHome();


            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
예제 #3
0
        public void getExpression(dynamic json)
        {
            expression = (string)json.recognized[0].ToString();
            switch (expression)
            {
            case "goodbye": _t.Speak(chooseRandomSpeech("goodbye")); break;

            case "help": _t.Speak(chooseRandomSpeech("help")); break;

            default: if (CheckCorrectness(expression))
                {
                    _t.Speak("O resultado da operação é " + _calc.makeCalculation(expression).ToString());
                }
                else
                {
                    _t.Speak(chooseRandomSpeech("incorreta"));
                } break;
            }
        }
예제 #4
0
 public MainWindow()
 {
     InitializeComponent();
     _t    = new Tts();
     _calc = new Calculator();
     _t.Speak(chooseRandomSpeech("greeting"));
     mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
     mmiC.Message += MmiC_Message;
     mmiC.Start();
 }
        void OnNewGameState(GameState gs)
        {
            if (!gamestate.IsPlanted &&
                gs.Round.Phase == RoundPhase.Live &&
                gs.Round.Bomb == BombState.Planted &&
                gs.Previously.Round.Bomb == BombState.Undefined)
            {
                Console.WriteLine("Bomb has been planted.");
                t.Speak("A bomba foi plantada, explodirá em 45 segundos");
                gamestate.IsPlanted = true;
            }
            else if (gamestate.IsPlanted && gs.Round.Phase == RoundPhase.FreezeTime)
            {
                gamestate.IsPlanted = false;
            }


            gamestate.money        = gs.Player.State.Money;
            gamestate.round_number = gs.Map.Round;
            gamestate.bullets      = gs.Player.Weapons.ActiveWeapon.AmmoClip;
            gamestate.max_bullets  = gs.Player.Weapons.ActiveWeapon.AmmoClipMax;
            gamestate.health       = gs.Player.State.Health;
            gamestate.armour       = gs.Player.State.Armor;
            gamestate.roundkills   = gs.Player.State.RoundKills;
            gamestate.total_kills  = gs.Player.MatchStats.Kills;
            gamestate.total_deaths = gs.Player.MatchStats.Deaths;
            gamestate.spectators   = gs.Map.CurrentSpectators;

            if (gamestate.round_counter < gamestate.round_number)
            {
                Thread.Sleep(17000);
                gamestate.round_counter = gamestate.round_number;
                if (gamestate.armour <= 70)
                {
                    // t.Speak("Aconselho-te a comprar um capacete");
                }

                if (gamestate.money >= 4500)
                {
                    //  t.Speak("Podes comprar um kit...");
                }
            }
        }
예제 #6
0
 public MainWindow()
 {
     InitializeComponent();
     _t    = new Tts();
     _calc = new Calculator();
     _t.Speak(chooseRandomSpeech("greeting"));
     _beggining = true; _confirmation = false;
     _lastNum1  = ""; _lastNum2 = ""; _lastOp = "";
     confidence = 0;
     InitializeComponent();
     mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
     mmiC.Message += MmiC_Message;
     mmiC.Start();
 }
예제 #7
0
        public void handleIMcommand(string command)
        {
            foreach (var t in specialCharacters)
            {
                command = command.Replace(t.Item2, t.Item1);
            }

            dynamic json = JsonConvert.DeserializeObject(command);

            if (((string)json.type.ToString()).Equals("NORMAL"))
            {
                switch ((string)json.confidence.ToString())
                {
                case "GOOD":
                    lastCommand = json.recognized;
                    handleRecognized(json.recognized);
                    break;

                case "MEDIUM":
                    lastCommand = json.recognized;

                    lastCommandInputText = (string)json.inputText.ToString();
                    foreach (var t in specialCharacters)
                    {
                        lastCommandInputText = lastCommandInputText.Replace(t.Item2, t.Item1);
                    }

                    //dizer que nao percebeu
                    t.Speak(answers.getNormalConfidenceTypeNormal(lastCommandInputText), false);
                    break;

                case "BAD":
                    t.Speak(answers.getLowConfidenceTypeNormal());
                    break;
                }
            }
            else if (((string)json.type.ToString()).Equals("YESNO"))
            {
                switch ((string)json.confidence.ToString())
                {
                case "GOOD":
                    if (((string)json.recognized[0].ToString()).Equals("YES"))
                    {
                        Console.WriteLine("Execute " + lastCommand);
                        handleRecognized(lastCommand);
                    }
                    else
                    {
                        t.Speak(answers.getOk(), false);
                    }

                    break;

                case "BAD":
                    t.Speak(answers.getLowConfidenceTypeYesNo(lastCommandInputText), false);
                    break;
                }
            }
        }
예제 #8
0
        public MainWindow()
        {
            InitializeComponent();

            t.Speak("Wait a few seconds, we are just getting everything ready for you!");
            SpotifyAPI spotifyAPI = new SpotifyAPI();

            webSpotify = spotifyAPI.getAPI();
            spotify    = new SpotifyLocalAPI(new SpotifyLocalAPIConfig
            {
                Port    = 4381,
                HostUrl = "http://localhost"
            });
            if (!SpotifyLocalAPI.IsSpotifyRunning())
            {
                t.Speak("Spotify is not running, can you please turn it on ?");
                return; //Make sure the spotify client is running
            }
            if (!SpotifyLocalAPI.IsSpotifyWebHelperRunning())
            {
                t.Speak("Spotify WebHelper is not running");
                return; //Make sure the WebHelper is running
            }

            if (!spotify.Connect())
            {
                t.Speak("Spotify is not connected.");
                return; //We need to call Connect before fetching infos, this will handle Auth stuff
            }

            StatusResponse status = spotify.GetStatus(); //status contains infos

            t.Speak("You can close the browser now, hope you have a good time with our application");

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
예제 #9
0
        private void createEvent(CalendarService service, String summary, String location, EventDateTime start, EventDateTime end, String desc)
        {
            // Refer to the .NET quickstart on how to setup the environment:
            // https://developers.google.com/calendar/quickstart/dotnet
            // Change the scope to CalendarService.Scope.Calendar and delete any stored
            // credentials.
            Event newEvent = new Event()
            {
                Summary     = summary,
                Location    = location,
                Description = desc,
                Start       = start,
                End         = end,
            };
            String calendarId = "primary";

            EventsResource.InsertRequest request = service.Events.Insert(newEvent, calendarId);
            Event createdEvent = request.Execute();

            Console.WriteLine("Event created: {0}", createdEvent.HtmlLink);

            String startDate = start.DateTime.ToString().Split(' ')[0];
            String startTime = start.DateTime.ToString().Split(' ')[1];

            Console.WriteLine("Summary: " + summary +
                              "\nLocation: " + location +
                              "\nDescription: " + desc +
                              "\nStart: " + start.DateTime.ToString() +
                              "\nEnd: " + end.Date);
            t.Speak("Evento " + summary + " criado no dia " + startDate + " às " + startTime);
        }
예제 #10
0
 private void sayHello()
 {
     //rnd = new Random();
     t.Speak(".Olá sou o teu assistente, acêna-me para me conhecêres");
     //return;
 }
예제 #11
0
        private void MmiC_Message(object sender, MmiEventArgs e)
        {
            var     doc  = XDocument.Parse(e.Message);
            var     com  = doc.Descendants("command").FirstOrDefault().Value;
            dynamic json = JsonConvert.DeserializeObject(com);

            Console.WriteLine(json.recognized);
            switch ((string)json.recognized[1].ToString())
            {
            case "muteR":
                _client.SendMessageAsync("!MUTEALL");
                t.Speak("Todos os utilizadores levaram mute.");
                break;

            case "unmuteR":
                _client.SendMessageAsync("!UNMUTEALL");
                t.Speak("Todos os utilizadores levaram unmute.");
                break;

            case "leave":
                _client.SendMessageAsync("!MOVEAFKALL");
                t.Speak("Todos os utilizadores foram retirados da sala.");
                break;

            case "invite":
                _client.SendMessageAsync("!UNMOVEAFKALL");
                t.Speak("Todos os utilizadores foram repostos na sala.");
                break;

            case "bola":
                string          url    = "http://feeds.ojogo.pt/OJ-Futebol";
                XmlReader       reader = XmlReader.Create(url);
                SyndicationFeed feed   = SyndicationFeed.Load(reader);
                reader.Close();
                String subject = "";
                int    i       = 0;
                foreach (SyndicationItem item in feed.Items)
                {
                    subject += item.Title.Text + ".\n";
                    i++;
                    if (i == 5)
                    {
                        break;
                    }
                }
                t.Speak(subject);
                break;

            case "tempo":
                string URL = "http://api.openweathermap.org/data/2.5/weather?q=Aveiro&APPID=6fcebaa15d35d3672004b399373a1279&units=metric";
                Console.WriteLine(URL);
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
                request.Method      = "GET";
                request.ContentType = "application/json";

                try
                {
                    String      temperatura = "";
                    String      info        = "";
                    WebResponse webResponse = request.GetResponse();
                    using (Stream webStream = webResponse.GetResponseStream() ?? Stream.Null)
                        using (StreamReader responseReader = new StreamReader(webStream))
                        {
                            string  response = responseReader.ReadToEnd();
                            dynamic tojson2  = JsonConvert.DeserializeObject(response);

                            Console.Out.WriteLine((string)tojson2.main.temp.ToString());
                            temperatura = (string)tojson2.main.temp.ToString();
                            info        = translate((string)tojson2.weather[0].description.ToString());
                        }

                    t.Speak("Meteorologia em Aveiro.\n" + info + ".\n " + temperatura + " graus Celcius.");
                }
                catch (Exception es)
                {
                    Console.Out.WriteLine("-----------------");
                    Console.Out.WriteLine(es.Message);
                    t.Speak("Algo de errado aconteceu");
                }
                break;
            }
        }
예제 #12
0
        private void MmiC_Message(object sender, MmiEventArgs e)
        {
            Console.WriteLine(e.Message);
            var     doc  = XDocument.Parse(e.Message);
            var     com  = doc.Descendants("command").FirstOrDefault().Value;
            dynamic json = JsonConvert.DeserializeObject(com);

            Console.WriteLine(json);
            Console.WriteLine((string)json.recognized[0].ToString());
            Console.WriteLine((string)json.keys[0].ToString());

            Tts t = new Tts();

            //TODO: See where should have the method cleanAllConfirmations()
            //https://docs.microsoft.com/en-us/office/vba/api/powerpoint.slide
            switch ((string)json.keys[0].ToString())
            {
            //TODO: pôr tudo o que está para baixo aqui dentro
            case "openPowerPoint":
                oPowerPoint   = new PowerPoint.Application();
                oPresentation = oPowerPoint.Presentations.Add();
                break;

            case "slide":
                switch ((string)json.recognized[0].ToString())
                {
                case "NEXT_PRESENTATION":
                    oPresentation.SlideShowWindow.View.Next();
                    break;

                case "PREVIOUS_PRESENTATION":
                    oPresentation.SlideShowWindow.View.Previous();
                    break;

                case "NEXT":
                    oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex + 1].Select();
                    break;

                case "PREVIOUS":
                    oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex - 1].Select();
                    break;

                case "JUMP_TO":
                    oPresentation.Slides[Int32.Parse(json.recognized[1].ToString())].Select();
                    break;

                case "JUMP_TO_SLIDE_PRESENTATION":
                    oPresentation.SlideShowWindow.View.GotoSlide(Int32.Parse(json.recognized[1].ToString()));
                    break;

                case "NEW_SLIDE":
                    if (oPresentation.Slides.Count == 0)
                    {
                        oPresentation.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutTitle).Select();
                    }
                    else
                    {
                        oPresentation.Slides.Add(oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex + 1, PowerPoint.PpSlideLayout.ppLayoutTitle).Select();;
                    }
                    break;


                case "REMOVE_SLIDE":
                    if (oPresentation.Slides.Count > 0)
                    {
                        oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex].Delete();
                        t.Speak("Slide removido!");
                    }
                    else
                    {
                        t.Speak("Não existe nenhum slide.");
                    }
                    break;
                }
                break;

            case "read":
                switch ((string)json.recognized[0].ToString())
                {
                case "TITLE":
                    var title = oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex].Shapes.Title.TextFrame.TextRange.Text;
                    t.Speak(title);
                    break;

                case "TEXT":
                    var text = oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex].Shapes[2].TextFrame.TextRange.Text;
                    t.Speak(text);
                    break;

                case "NOTE":
                    var notas = oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex].NotesPage.Shapes[2].TextFrame.TextRange.Text;
                    t.Speak(notas);
                    break;

                case "TITLE_PRESENTATION":
                    var title_pres = oPresentation.SlideShowWindow.View.Slide.Shapes.Title.TextFrame.TextRange.Text;
                    t.Speak(title_pres);
                    break;

                case "TEXT_PRESENTATION":
                    var text_pres = oPresentation.SlideShowWindow.View.Slide.Shapes[2].TextFrame.TextRange.Text;
                    t.Speak(text_pres);
                    break;

                case "NOTE_PRESENTATION":
                    var note_pres = oPresentation.SlideShowWindow.View.Slide.NotesPage.Shapes[2].TextFrame.TextRange.Text;
                    t.Speak(note_pres);
                    break;
                }
                break;



            case "theme":
                switch ((string)json.recognized[0].ToString())
                {
                case "1":

                    string dir = @"C:\Program Files (x86)\Microsoft Office\";
                    if (Directory.Exists(dir))
                    {
                        oPresentation.ApplyTheme(@"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16\Facet.thmx");
                    }
                    else
                    {
                        oPresentation.ApplyTheme(@"C:\Program Files\Microsoft Office\root\Document Themes 16\Facet.thmx");
                    }


                    break;

                case "2":

                    string dir1 = @"C:\Program Files (x86)\Microsoft Office\";
                    if (Directory.Exists(dir1))
                    {
                        oPresentation.ApplyTheme(@"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16\Gallery.thmx");
                    }
                    else
                    {
                        oPresentation.ApplyTheme(@"C:\Program Files\Microsoft Office\root\Document Themes 16\Gallery.thmx");
                    }
                    break;

                case "3":
                    string dir2 = @"C:\Program Files (x86)\Microsoft Office\";
                    if (Directory.Exists(dir2))
                    {
                        oPresentation.ApplyTheme(@"C:\Program Files (x86)\Microsoft Office\root\Document Themes 16\Ion.thmx");
                    }
                    else
                    {
                        oPresentation.ApplyTheme(@"C:\Program Files\Microsoft Office\root\Document Themes 16\Ion.thmx");
                    }
                    break;
                }
                break;

            case "save":
                oPresentation.Save();
                break;

            case "color":
                Slide     activeSlide = oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex];;
                TextRange textRange   = activeSlide.Shapes.Title.TextFrame.TextRange;;
                if (json.recognized.Count > 1)
                {
                    switch ((string)json.recognized[0].ToString())
                    {
                    /*case "TITLE":
                     *  activeSlide = oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex];
                     *  textRange = activeSlide.Shapes.Title.TextFrame.TextRange;
                     *  break;*/
                    case "TEXT":
                        activeSlide = oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex];
                        textRange   = activeSlide.Shapes[2].TextFrame.TextRange;
                        break;
                    }
                }
                switch ((string)json.recognized[1].ToString())
                {
                case "YELLOW":
                    textRange.Font.Color.RGB = 379903;
                    t.Speak("Mudado para Amarelo");
                    break;

                case "RED":
                    textRange.Font.Color.RGB = 255;
                    t.Speak("Mudado para Vermelho");
                    break;

                case "BLUE":
                    textRange.Font.Color.RGB = 16711680;
                    t.Speak("Mudado para Azul");
                    break;

                case "GREEN":
                    textRange.Font.Color.RGB = 2540123;
                    t.Speak("Mudado para Verde");
                    break;

                case "BLACK":
                    textRange.Font.Color.RGB = 0;
                    t.Speak("Mudado para Preto");
                    break;
                }
                break;

            case "example":
                String presentationTitle = "Proposta de Trabalho 2";

                //Save the file
                //oPresentation.SaveAs(presentationTitle, PowerPoint.PpSaveAsFileType.ppSaveAsPresentation);

                //Add a new slide with Title Layout
                oSlide = oPresentation.Slides.Add(oPresentation.Slides.Count + 1, PowerPoint.PpSlideLayout.ppLayoutTitle);
                tShape = oSlide.Shapes.Title;
                tShape.TextFrame.TextRange.Text = presentationTitle;
                tShape = oSlide.Shapes[2];
                tShape.TextFrame.TextRange.Text = "Carlos Ribeiro\nGisela Pinto";

                oSlide = oPresentation.Slides.Add(oPresentation.Slides.Count + 1, PowerPoint.PpSlideLayout.ppLayoutText);
                tShape = oSlide.Shapes.Title;
                tShape.TextFrame.TextRange.Text = "Tema";
                tShape = oSlide.Shapes[2];
                tShape.TextFrame.TextRange.Text = "Interação por voz do Powerpoint";

                //Add Image
                //tShape = oSlide.Shapes.AddPicture("imagePowerPoint.png", Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue, 0, 0);

                oSlide = oPresentation.Slides.Add(oPresentation.Slides.Count + 1, PowerPoint.PpSlideLayout.ppLayoutText);
                tShape = oSlide.Shapes.Title;
                tShape.TextFrame.TextRange.Text = "Features para utilizar durante uma apresentação";
                tShape = oSlide.Shapes[2];
                tShape.TextFrame.TextRange.Text = "Avançar slide.\n" +
                                                  "Recuar slide.\n" +
                                                  "Saltar slides, por exemplo mudar do slide 2 para o 5.\n" +
                                                  "Ler texto de um slide.\n" +
                                                  "Ler notas de um slide fazendo assim a apresentação completa.\n" +
                                                  "Terminar a apresentação.\n" +
                                                  "Controlar um video que esteja integrado no slide(Iniciar/ parar).";

                oSlide.NotesPage.Shapes[2].TextFrame.TextRange.Text = "Eu, Salvador, estou a ler notas do slide 3, beijinhos e abraços";

                //oSlide = oPresentation.Slides.Add(oPresentation.Slides.Count + 1, PowerPoint.PpSlideLayout.ppLayoutText);

                //tShape = oSlide.Shapes.AddMediaObject2(@"C:\Users\Gisela Pinto\Documents\IM\Trabalho1\im_2019_2020\Basis4Assignment2\ppt.mp4", MsoTriState.msoTrue, MsoTriState.msoTrue, 8, 8, 530, 530);

                oSlide = oPresentation.Slides.Add(oPresentation.Slides.Count + 1, PowerPoint.PpSlideLayout.ppLayoutText);
                tShape = oSlide.Shapes.Title;
                tShape.TextFrame.TextRange.Text = "Features para construção de uma apresentação";
                tShape = oSlide.Shapes[2];
                tShape.TextFrame.TextRange.Text = "Iniciar a criação da apresentação com um dos temas sugeridos.\n" +
                                                  "Acrescentar um novo slide em branco/ duplicado.\n" +
                                                  "Remover determinado slide.\n" +
                                                  "Escrever o que o utilizador ditar.\n" +
                                                  "Guardar alterações.\n" +
                                                  "Mudar cor do texto(algumas cores mais usadas).";
                oPresentation.Slides[oSlide.SlideIndex].Select();
                break;

            case "presentation":
                switch ((string)json.recognized[0].ToString())
                {
                case "START":
                    oPresentation.SlideShowSettings.Run();
                    break;

                case "STOP_PRESENTATION":
                    oPresentation.SlideShowWindow.View.Exit();
                    break;
                }
                break;

            case "close":
                oPowerPoint.Quit();
                System.Diagnostics.Process[] pros = System.Diagnostics.Process.GetProcesses();
                for (int i = 0; i < pros.Count(); i++)
                {
                    if (pros[i].ProcessName.ToLower().Contains("powerpnt"))
                    {
                        pros[i].Kill();
                    }
                }
                break;
            }

            /*
             *
             *
             * //Edition
             *
             *
             *          case "COLOR_TITLE":
             *              var activeSlide = oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex];
             *              rangeTitle = activeSlide.Shapes.Title.TextFrame.TextRange;
             *              if (json.recognized.Count > 1) {
             *                  switch ((string)json.recognized[1].ToString()) {
             *                      case "YELLOW":
             *                          rangeTitle.Font.Color.RGB = 379903;
             *                          t.Speak("Mudado para Amarelo");
             *                          break;
             *                      case "RED":
             *                          rangeTitle.Font.Color.RGB = 255;
             *                          t.Speak("Mudado para Vermelho");
             *                          break;
             *                      case "BLUE":
             *                          rangeTitle.Font.Color.RGB = 16711680;
             *                          t.Speak("Mudado para Azul");
             *                          break;
             *                      case "GREEN":
             *                          rangeTitle.Font.Color.RGB = 2540123;
             *                          t.Speak("Mudado para Verde");
             *                          break;
             *                      case "BLACK":
             *                          rangeTitle.Font.Color.RGB = 0;
             *                          t.Speak("Mudado para Preto");
             *                          break;
             *                  }
             *              }else {
             *                  t.Speak("Deseja mudar para que cor?");
             *                  selectColorTitle = true;
             *              }
             *              break;
             *
             *          case "COLOR_TEXT":
             *              t.Speak("Deseja mudar para que cor?");
             *              var activeSlide2 = oPresentation.Slides[oPowerPoint.ActiveWindow.Selection.SlideRange.SlideIndex];
             *              rangeShape = activeSlide2.Shapes[2].TextFrame.TextRange;
             *              if (json.recognized.Count > 1) {
             *                  switch ((string)json.recognized[1].ToString()) {
             *                      case "YELLOW":
             *                          rangeTitle.Font.Color.RGB = 379903;
             *                          t.Speak("Mudado para Amarelo");
             *                          break;
             *                      case "RED":
             *                          rangeTitle.Font.Color.RGB = 255;
             *                          t.Speak("Mudado para Vermelho");
             *                          break;
             *                      case "BLUE":
             *                          rangeTitle.Font.Color.RGB = 16711680;
             *                          t.Speak("Mudado para Azul");
             *                          break;
             *                      case "GREEN":
             *                          rangeTitle.Font.Color.RGB = 2540123;
             *                          t.Speak("Mudado para Verde");
             *                          break;
             *                      case "BLACK":
             *                          rangeTitle.Font.Color.RGB = 0;
             *                          t.Speak("Mudado para Preto");
             *                          break;
             *                  }
             *              } else {
             *                  t.Speak("Deseja mudar para que cor?");
             *                  selectColorText = true;
             *              }
             *              break;
             *
             *          case "YELLOW":
             *              if (selectColorTitle == true) {
             *                  selectColorTitle = false;
             *                  rangeTitle.Font.Color.RGB = 379903;
             *                  t.Speak("Mudado para Amarelo");
             *              } else if (selectColorText == true) {
             *                  selectColorText = false;
             *                  rangeShape.Font.Color.RGB = 379903;
             *                  t.Speak("Mudado para Amarelo");
             *              } else {
             *                  t.Speak("Devo ter percebido mal.");
             *
             *              }
             *              break;
             *
             *          case "RED":
             *              if (selectColorTitle == true) {
             *                  selectColorTitle = false;
             *                  rangeTitle.Font.Color.RGB = 255;
             *                  t.Speak("Mudado para Vermelho");
             *              } else if (selectColorText == true) {
             *                  selectColorText = false;
             *                  rangeShape.Font.Color.RGB = 255;
             *                  t.Speak("Mudado para Vermelho");
             *              } else {
             *                  t.Speak("Devo ter percebido mal.");
             *              }
             *              break;
             *
             *          case "BLUE":
             *              if (selectColorTitle == true) {
             *                  selectColorTitle = false;
             *                  rangeTitle.Font.Color.RGB = 16711680;
             *                  t.Speak("Mudado para Azul");
             *              } else if (selectColorText == true) {
             *                  selectColorText = false;
             *                  rangeShape.Font.Color.RGB = 16711680;
             *                  t.Speak("Mudado para Azul");
             *              } else {
             *
             *                  t.Speak("Devo ter percebido mal.");
             *
             *              }
             *              break;
             *
             *          case "GREEN":
             *              if (selectColorTitle == true) {
             *                  selectColorTitle = false;
             *                  rangeTitle.Font.Color.RGB = 2540123;
             *                  t.Speak("Mudado para Verde");
             *              } else if (selectColorText == true) {
             *                  selectColorText = false;
             *                  rangeShape.Font.Color.RGB = 2540123;
             *                  t.Speak("Mudado para Verde");
             *              } else {
             *                  t.Speak("Devo ter percebido mal.");
             *              }
             *              break;
             *
             *          case "BLACK":
             *              if (selectColorTitle == true) {
             *                  selectColorTitle = false;
             *                  rangeTitle.Font.Color.RGB = 0;
             *                  t.Speak("Mudado para Preto");
             *              } else if (selectColorText == true) {
             *                  selectColorTitle = false;
             *                  rangeShape.Font.Color.RGB = 0;
             *                  t.Speak("Mudado para Preto");
             *              } else {
             *                  t.Speak("Devo ter percebido mal.");
             *              }
             *              break;
             *
             */
        }
예제 #13
0
 private static void warnUserTimeout()
 {
     rnd = new Random();
     t.Speak(_timeoutMessages[rnd.Next(0, _timeoutMessages.Length)]);
 }
        private async void MmiC_Message(object sender, MmiEventArgs e)
        {
            Console.WriteLine(e.Message);
            var     doc  = XDocument.Parse(e.Message);
            var     com  = doc.Descendants("command").FirstOrDefault().Value;
            dynamic json = JsonConvert.DeserializeObject(com);

            //double confidence = Double.Parse((string)json.recognized[0].ToString());
            String command = (string)json.recognized[0].ToString();
            String movie   = (string)json.recognized[1].ToString();
            String number  = (string)json.recognized[2].ToString();
            String time    = (string)json.recognized[3].ToString();

            var info = await mpcHomeCinema.GetInfo();

            Console.WriteLine($"{info.FileName} is playing");
            Console.WriteLine($"{info.State} is its state");
            switch (command)
            {
            case "HELP":
                if (movie == "EMP" && number == "EMP" && time == "EMP")
                {
                    t.Speak("Hello. You can play or pause movie, change volume, mute or unmute, skip movie or play last one, skip or rewind given time stamp, or open new movie.");
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "PLAY":
                if (movie == "EMP" && number == "EMP" && time == "EMP")
                {
                    await mpcHomeCinema.PlayAsync();
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "PAUSE":
                if (movie == "EMP" && number == "EMP" && time == "EMP")
                {
                    await mpcHomeCinema.PauseAsync();
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "NEXT":
                if (movie == "EMP" && number == "EMP" && time == "EMP")
                {
                    await mpcHomeCinema.NextAsync();
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "BACK":
                if (movie == "EMP" && number == "EMP" && time == "EMP")
                {
                    await mpcHomeCinema.PrevAsync();
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "MOVEFWD":
                info = await mpcHomeCinema.GetInfo();

                if (movie == "EMP" && number != "EMP" && time != "EMP")
                {
                    await App.Current.Dispatcher.Invoke(async() =>
                    {
                        if (time == "HOUR")
                        {
                            await mpcHomeCinema.SetPosition(new TimeSpan(info.Position.Hours + int.Parse(number), info.Position.Minutes, info.Position.Seconds));
                        }
                        else if (time == "MINUTE")
                        {
                            await mpcHomeCinema.SetPosition(new TimeSpan(info.Position.Hours, info.Position.Minutes + int.Parse(number), info.Position.Seconds));
                        }
                        else if (time == "SECOND")
                        {
                            await mpcHomeCinema.SetPosition(new TimeSpan(info.Position.Hours, info.Position.Minutes, info.Position.Seconds + int.Parse(number)));
                        }
                    });
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "MOVEBWD":
                info = await mpcHomeCinema.GetInfo();

                if (movie == "EMP" && number != "EMP" && time != "EMP")
                {
                    await App.Current.Dispatcher.Invoke(async() =>
                    {
                        if (time == "HOUR")
                        {
                            await mpcHomeCinema.SetPosition(new TimeSpan(info.Position.Hours - int.Parse(number), info.Position.Minutes, info.Position.Seconds));
                        }
                        else if (time == "MINUTE")
                        {
                            await mpcHomeCinema.SetPosition(new TimeSpan(info.Position.Hours, info.Position.Minutes - int.Parse(number), info.Position.Seconds));
                        }
                        else if (time == "SECOND")
                        {
                            await mpcHomeCinema.SetPosition(new TimeSpan(info.Position.Hours, info.Position.Minutes, info.Position.Seconds - int.Parse(number)));
                        }
                    });
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "SETTIME":
                if (movie == "EMP" && number != "EMP" && time != "EMP")
                {
                    await App.Current.Dispatcher.Invoke(async() =>
                    {
                        if (time == "HOUR")
                        {
                            await mpcHomeCinema.SetPosition(new TimeSpan(int.Parse(number), 0, 0));
                        }
                        else if (time == "MINUTE")
                        {
                            await mpcHomeCinema.SetPosition(new TimeSpan(0, int.Parse(number), 0));
                        }
                        else if (time == "SECOND")
                        {
                            await mpcHomeCinema.SetPosition(new TimeSpan(0, 0, int.Parse(number)));
                        }
                    });
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "MUTE":
                if (movie == "EMP" && number == "EMP" && time == "EMP")
                {
                    await mpcHomeCinema.MuteAsync();
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "UNMUTE":
                if (movie == "EMP" && number == "EMP" && time == "EMP")
                {
                    await mpcHomeCinema.UnMuteAsync();
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "SETVOL":
                if (number == "EMP" && time != "EMP" && movie != "EMP")
                {
                    t.Speak("This command is forbidden");
                }
                else
                {
                    info = await mpcHomeCinema.GetInfo();

                    await App.Current.Dispatcher.Invoke(async() =>
                    {
                        await mpcHomeCinema.SetVolumeLevel(int.Parse(number));
                    });
                }
                break;

            case "VUP":
                info = await mpcHomeCinema.GetInfo();

                if (movie == "EMP" && number == "EMP" && time == "EMP")
                {
                    if (info.VolumeLevel <= 80)
                    {
                        await mpcHomeCinema.SetVolumeLevel(info.VolumeLevel + 20);
                    }
                    else
                    {
                        t.Speak("You can only increase volume by 20 points with this command. If you want to do it with custom number of points, please use set volume command,");
                    }
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "VDOWN":
                info = await mpcHomeCinema.GetInfo();

                if (movie == "EMP" && number == "EMP" && time == "EMP")
                {
                    if (info.VolumeLevel >= 20)
                    {
                        await mpcHomeCinema.SetVolumeLevel(info.VolumeLevel - 20);
                    }
                    else
                    {
                        t.Speak("You can only decrease volume by 20 points with this command. If you want to do it with custom number of points, please use set volume command,");
                    }
                }
                else
                {
                    t.Speak("This command is forbidden");
                }
                break;

            case "OPENFILE":
                if (movie == "EMP" || number != "EMP" || time != "EMP")
                {
                    t.Speak("This command is forbidden");
                }
                else
                {
                    await App.Current.Dispatcher.Invoke(async() =>
                    {
                        switch (movie)
                        {
                        case "ANIMALS":
                            await mpcHomeCinema.OpenFileAsync("C:\\Users\\Public\\Videos\\SampleVideos\\Animals.wmv");
                            break;

                        case "ODYSSEY":
                            await mpcHomeCinema.OpenFileAsync("C:\\Users\\Public\\Videos\\SampleVideos\\2001_ A SPACE ODYSSEY - Trailer.mp4");
                            break;

                        case "BLUEPLANET":
                            await mpcHomeCinema.OpenFileAsync("C:\\Users\\Public\\Videos\\SampleVideos\\Blue Planet II  The Prequel.wmv");
                            break;

                        case "PLANETEARTH":
                            await mpcHomeCinema.OpenFileAsync("C:\\Users\\Public\\Videos\\SampleVideos\\Planet Earth II Official Extended Trailer  BBC Earth.wmv");
                            break;
                        }
                    });
                }
                break;
            }
        }
예제 #15
0
        private void MmiC_Message(object sender, MmiEventArgs e)
        {
            if (!_t.getSpeaking())
            {
                var     doc  = XDocument.Parse(e.Message);
                var     com  = doc.Descendants("command").FirstOrDefault().Value;
                dynamic json = JsonConvert.DeserializeObject(com);
                fillValuesWithMessage(json);

                string numberOne = "", numberTwo = "", operation = "";
                _calc.resetValues();

                if (_beggining == true && confidence < 0.40)
                {
                    _t.Speak(chooseRandomSpeech("help"));
                    _beggining = false;
                }
                else if (_confirmation == true)
                {
                    if (confirmation.Equals("sim"))
                    {
                        _t.Speak("O resultado da operação é " + _calc.makeCalculation(_lastNum1 + _lastOp + _lastNum2).ToString());
                        _confirmation = false;
                    }
                    else if (confirmation.Equals("nao"))
                    {
                        _t.Speak(chooseRandomSpeech("repetition"));
                        _confirmation = false;
                    }
                }
                else
                {
                    if (_beggining == true)
                    {
                        _beggining = false;
                    }
                    if (confidence > 0.7 && goodbye.Equals("goodbye"))
                    {
                        _t.Speak(chooseRandomSpeech("goodbye"));
                    }
                    if (confidence > 0.7 && ajuda.Equals("ajuda"))
                    {
                        _t.Speak(chooseRandomSpeech("help"));
                    }
                    else if (confidence >= 0.90)
                    {
                        numberOne = getNumberTranslated(1);
                        numberTwo = getNumberTranslated(2);
                        if (!oprt.Equals(""))
                        {
                            operation = oprt + ",";
                        }
                        _t.Speak("O resultado da operação é " + _calc.makeCalculation(numberOne + operation + numberTwo).ToString());
                    }
                    else if (confidence >= 0.80 && confidence < 0.90)
                    {
                        numberOne = getNumberTranslated(1);
                        numberTwo = getNumberTranslated(2);
                        if (!oprt.Equals(""))
                        {
                            operation = oprt + ",";
                        }
                        if (numberTwo.Equals("") || numberOne.Equals(""))
                        {
                            if (oprt.Equals("raiz"))
                            {
                                _t.Speak("O resultado de raiz de " + numberTwo.ToString() + "é de " + _calc.makeCalculation(numberOne + operation + numberTwo).ToString());
                            }
                            else if (oprt.Equals("^,2"))
                            {
                                _t.Speak("O resultado de " + numberOne.ToString() + "ao quadrado é de: " + _calc.makeCalculation(numberOne + operation + numberTwo).ToString());
                            }
                            else
                            {
                                _t.Speak("O resultado de " + numberOne.ToString() + "ao cubo é de: " + _calc.makeCalculation(numberOne + operation + numberTwo).ToString());
                            }
                        }
                        else
                        {
                            _t.Speak("O resultado de " + numberOne.ToString() + " " + getOperador(oprt) + " " + numberTwo.ToString() + " é " + _calc.makeCalculation(numberOne + operation + numberTwo).ToString());
                        }
                    }
                    else if (confidence >= 0.45 && confidence < 0.8)
                    {
                        numberOne = getNumberTranslated(1);
                        numberTwo = getNumberTranslated(2);
                        if (!oprt.Equals(""))
                        {
                            operation = oprt + ",";
                        }
                        if (numberTwo.Equals("") || numberOne.Equals(""))
                        {
                            if (oprt.Equals("raiz"))
                            {
                                _t.Speak("Deseja saber o resultado de raiz de " + numberTwo.ToString() + "certo?");
                            }
                            else if (oprt.Equals("^,2"))
                            {
                                _t.Speak("Deseja saber o resultado  de " + numberOne.ToString() + "ao quadrado certo?");
                            }
                            else
                            {
                                _t.Speak("Deseja saber o resultado de " + numberOne.ToString() + "ao cubo certo?");
                            }
                        }
                        else
                        {
                            _t.Speak("Deseja saber o resultado de " + numberOne.ToString() + " " + getOperador(oprt) + " " + numberTwo.ToString() + " certo?");
                        }
                        _lastNum1     = numberOne;
                        _lastNum2     = numberTwo;
                        _lastOp       = operation;
                        _confirmation = true;
                    }
                    else if (confidence < 0.45)
                    {
                        _t.Speak(chooseRandomSpeech("repetition"));
                    }
                }
            }
        }
예제 #16
0
        private void MmiC_Message(object sender, MmiEventArgs e)
        {
            var doc = XDocument.Parse(e.Message);

            var     com  = doc.Descendants("command").FirstOrDefault().Value;
            dynamic json = JsonConvert.DeserializeObject(com);

            int sizeJson = com.Split(',').Length;

            var gesto = (string)json.recognized[1].ToString();



            switch (gesto) //confimation
            {
            case "scrollDownRapido":
                velocidade = 5;
                direcao    = "baixo";
                break;

            case "scrollDownDevagar":
                velocidade = 1;
                direcao    = "baixo";
                break;

            case "scrollUpRapido":
                velocidade = 5;
                direcao    = "cima";
                break;

            case "scrollUpDevagar":
                velocidade = 1;
                direcao    = "cima";
                break;

            case "esvaziarC":
                if (orderStart == true)
                {
                    if (produtos > 0)
                    {
                        verCarrinho();
                        t.Speak("Tem a certeza que deseja apagar o carrinho de compras?");
                        esvaziar = true;
                        try
                        {
                            esvaziarCarrinho();
                        }
                        catch { }
                    }
                    else
                    {
                        t.Speak("O carrinho está vazio");
                    }
                }
                break;

            case "RecuarR":
                driver.Navigate().Back();
                break;

            case "AvancarL":
                driver.Navigate().Forward();
                break;

            case "StopS":
                direcao = "parado";
                break;

            case "ScrollDR":
                direcao = "baixo";
                break;

            case "ScrollU":
                direcao = "cima";
                break;

            case "verC":
                if (produtos > 0)
                {
                    try
                    {
                        verCarrinho();
                    }
                    catch { }
                    t.Speak("Aqui tem o seu carrinho!");
                }
                else
                {
                    t.Speak("O carrinho está vazio");
                }
                break;

            case "homePC":
                homepage();
                break;

            default:
                break;
            }

            confirmationValue = (string)json.recognized[7].ToString();
            if (esvaziar == true)
            {
                switch (confirmationValue) //confimation
                {
                case "":
                    break;

                case "sim":
                    esvaziarCarrinho();
                    break;

                case "nao":
                    t.Speak("O carrinho de compras não foi apagado!");
                    esvaziar = false;
                    break;

                default:
                    t.Speak("Não percebi");
                    break;
                }
            }

            if (sizeJson > 3)
            {
                if ((string)json.recognized[0].ToString() == "KEY")
                {
                    orderStart = true;
                    t.Speak("Olá! O que gostaria de fazer?");
                }
                else if ((string)json.recognized[0].ToString() == "EXIT")
                {
                    t.Speak("Tem a certeza que deseja sair?");
                    leaving = true;
                }

                confirmationValue = (string)json.recognized[7].ToString();
                if (leaving == true)
                {
                    switch (confirmationValue) //confimation
                    {
                    case "":
                        break;

                    case "sim":
                        sairAplicacao();
                        break;

                    case "nao":
                        leaving = false;
                        t.Speak("Ok!");
                        break;

                    default:
                        t.Speak("Não percebi");
                        break;
                    }
                }

                if (orderStart)
                {
                    switch ((string)json.recognized[1].ToString())
                    {
                    case "scroll":
                        scrollSmooth();
                        break;

                    case "search":
                        if ((string)json.recognized[2].ToString() == "")
                        {
                            t.Speak("O que deseja procurar?");
                        }
                        break;

                    case "return":
                        homepage();
                        break;

                    case "addtocart":
                        adicionarCarrinho();
                        t.Speak("Adicionado ao carrinho com sucesso!");
                        break;

                    case "changedate":
                        changeDate();

                        t.Speak("Ok, a data de entrega foi alterada!");
                        break;

                    case "viewcart":
                        if (produtos > 0)
                        {
                            verCarrinho();
                            t.Speak("Aqui tem o seu carrinho!");
                        }
                        else
                        {
                            t.Speak("O carrinho está vazio");
                        }
                        break;

                    case "closecart":
                        fecharCarrinho();
                        t.Speak("O carrinho foi fechado com sucesso!");
                        break;

                    case "emptycart":
                        if (produtos > 0)
                        {
                            verCarrinho();
                            t.Speak("Tem a certeza que deseja apagar o carrinho de compras?");
                            esvaziar = true;
                        }
                        else
                        {
                            t.Speak("O carrinho está vazio");
                        }
                        break;

                    default:
                        break;
                    }

                    confirmationValue = (string)json.recognized[7].ToString();
                    if (esvaziar == true)
                    {
                        switch (confirmationValue) //confimation
                        {
                        case "":
                            break;

                        case "sim":
                            esvaziarCarrinho();
                            break;

                        case "nao":
                            t.Speak("O carrinho de compras não foi apagado!");
                            esvaziar = false;
                            break;

                        default:
                            t.Speak("Não percebi");
                            break;
                        }
                    }

                    string place;
                    switch ((string)json.recognized[2].ToString()) //restaurants
                    {
                    case "MCDONALDS":
                        //search mcdonalds
                        driver.FindElementByXPath("//div[contains(text(), 'Procurar')]/parent::button").Click();
                        wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//input[@placeholder='O que deseja?']")));
                        var searchBox = driver.FindElementByXPath("//input[@placeholder='O que deseja?']");
                        for (int i = 0; i < 20; i++)
                        {
                            searchBox.SendKeys(Keys.Backspace);
                        }
                        searchBox.SendKeys("mcdonalds ");

                        switch ((string)json.recognized[3].ToString()) //place
                        {
                        case "UNIVERSIDADE":
                            place = "(Aveiro Universidade)";
                            searchBox.SendKeys("universidade");
                            searchBox.SendKeys(Keys.Enter);

                            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div/*[contains(text(), '" + place + "')]")));
                            driver.FindElementByXPath("//div/*[contains(text(), '" + place + "')]").Click();

                            if (pedidoGrupo == false)
                            {
                                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//a[contains(text(), 'Entendido')]")));
                                driver.FindElementByXPath("//a[contains(text(), 'Entendido')]").Click();
                                pedidoGrupo = true;
                            }
                            break;

                        case "FORUM":
                            place = "(Aveiro Fórum)";
                            searchBox.SendKeys("fórum");
                            searchBox.SendKeys(Keys.Enter);

                            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div/*[contains(text(), '" + place + "')]")));
                            driver.FindElementByXPath("//div/*[contains(text(), '" + place + "')]").Click();

                            if (pedidoGrupo == false)
                            {
                                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//a[contains(text(), 'Entendido')]")));
                                driver.FindElementByXPath("//a[contains(text(), 'Entendido')]").Click();
                                pedidoGrupo = true;
                            }
                            break;

                        case "GLICINIAS":
                            place = "(Aveiro Glicinias)";
                            searchBox.SendKeys("glicinias");
                            searchBox.SendKeys(Keys.Enter);

                            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div/*[contains(text(), '" + place + "')]")));
                            driver.FindElementByXPath("//div/*[contains(text(), '" + place + "')]").Click();

                            if (pedidoGrupo == false)
                            {
                                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//a[contains(text(), 'Entendido')]")));
                                driver.FindElementByXPath("//a[contains(text(), 'Entendido')]").Click();
                                pedidoGrupo = true;
                            }
                            break;

                        case "":
                            searchBox.SendKeys(Keys.Enter);
                            break;
                        }

                        if ((string)json.recognized[3].ToString() == "")
                        {
                            t.Speak("De qual restaurante?");
                        }
                        else
                        {
                            t.Speak("Que produto quer adquirir?");
                        }

                        break;

                    case "MONTADITOS":
                        driver.FindElementByXPath("//div[contains(text(), 'Procurar')]/parent::button").Click();
                        wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//input[@placeholder='O que deseja?']")));
                        searchBox = driver.FindElementByXPath("//input[@placeholder='O que deseja?']");
                        for (int i = 0; i < 20; i++)
                        {
                            searchBox.SendKeys(Keys.Backspace);
                        }
                        searchBox.SendKeys("100 montaditos ");

                        searchBox.SendKeys(Keys.Enter);

                        place = "100 Montaditos";

                        wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div/*[contains(text(), '" + place + "')]")));
                        driver.FindElementByXPath("//div/*[contains(text(), '" + place + "')]").Click();

                        if (pedidoGrupo == false)
                        {
                            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//a[contains(text(), 'Entendido')]")));
                            driver.FindElementByXPath("//a[contains(text(), 'Entendido')]").Click();
                            pedidoGrupo = true;
                        }
                        break;

                    case "PIZZAHUT":
                        driver.FindElementByXPath("//div[contains(text(), 'Procurar')]/parent::button").Click();
                        wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//input[@placeholder='O que deseja?']")));
                        searchBox = driver.FindElementByXPath("//input[@placeholder='O que deseja?']");
                        for (int i = 0; i < 20; i++)
                        {
                            searchBox.SendKeys(Keys.Backspace);
                        }
                        searchBox.SendKeys("pizza hut ");

                        searchBox.SendKeys(Keys.Enter);

                        place = "Pizza Hut";

                        wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//div/*[contains(text(), '" + place + "')]")));
                        driver.FindElementByXPath("//div/*[contains(text(), '" + place + "')]").Click();

                        if (pedidoGrupo == false)
                        {
                            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//a[contains(text(), 'Entendido')]")));
                            driver.FindElementByXPath("//a[contains(text(), 'Entendido')]").Click();
                            pedidoGrupo = true;
                        }
                        break;
                    }


                    switch ((string)json.recognized[4].ToString()) //options
                    {
                    case "":
                        break;

                    case ".":
                        //search mcdonalds
                        //pergunta ao user o que quer?
                        break;

                    case "-":

                        break;

                    case "-.":

                        break;
                    }

                    switch ((string)json.recognized[5].ToString()) //food on mcdonalds
                    {
                    case "":
                        break;

                    default:

                        var food = (string)json.recognized[5].ToString();
                        foodRestaurant(food);
                        break;
                    }

                    string itemName = "";
                    switch ((string)json.recognized[6].ToString()) //food options on mcdonalds
                    {
                    case "":
                        break;

                    default:
                        itemName = (string)json.recognized[6].ToString();

                        foodOptions(itemName);
                        break;
                    }
                }
            }
        }