public override void VoiceInput(string voiceData, string grammarName) { try { voiceData = voiceData.ToLower(); //Getting the latest fixation and converting it to a absolute so the mouse can be moved to it double mouseXPos = convertXToAbsolute(latestFixation.GetFixationLocation().X); double mouseYPos = convertYToAbsolute(latestFixation.GetFixationLocation().Y); inputsim.Mouse.MoveMouseTo(mouseXPos, mouseYPos); //Running a normal voice command if (!scrollManager.VoiceInput(voiceData) && !keyboardManager.VoiceInput(voiceData)) { //Load the command that matches the command word, that isnt a key press command. Command commandToFire = commandList.FirstOrDefault(i => i.GetKeyWord() == voiceData && i.GetCommandType() != eCommandType.KeyPressCommand); if (commandToFire != null) { commandToFire.RunCommand(); } else { throw new Exception(); } } } catch (Exception e) { // If the length of the words that wasnt recognized is longer than 10 characters, concatenate it. string toPrint = voiceData.Length > 10 ? voiceData.Substring(0, 10) + "..." : voiceData; toastOverlay.NewMessage("\"" + toPrint + "\" not recognized.\nPlease try again."); } }