/// <summary> /// Starts asynchronous cancellation on a long-running operation. The servermakes a best effort to cancel the operation, but success is notguaranteed. If the server doesn't support this method, it returns`google.rpc.Code.UNIMPLEMENTED`. Clients can useOperations.GetOperation orother methods to check whether the cancellation succeeded or whether theoperation completed despite cancellation. On successful cancellation,the operation is not deleted; instead, it becomes an operation withan Operation.error value with a google.rpc.Status.code of 1,corresponding to `Code.CANCELLED`. /// Documentation https://developers.google.com/speech/v1/reference/operations/cancel /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Speech service.</param> /// <param name="name">The name of the operation resource to be cancelled.</param> /// <param name="body">A valid Speech v1 body.</param> /// <returns>EmptyResponse</returns> public static Empty Cancel(SpeechService service, string name, CancelOperationRequest body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (name == null) { throw new ArgumentNullException(name); } // Make the request. return(service.Operations.Cancel(body, name).Execute()); } catch (Exception ex) { throw new Exception("Request Operations.Cancel failed.", ex); } }
public void TestPathingString3() { SpeechService SpeechService = new SpeechService(); string pathingString = @"There [are;might be;could be] [4;5;] lights;It's dark in here;"; List <string> pathingOptions = new List <string>() { "There are 4 lights" , "There are 5 lights" , "There are lights" , "There might be 4 lights" , "There might be 5 lights" , "There might be lights" , "There could be 4 lights" , "There could be 5 lights" , "There could be lights" , "It's dark in here" , "" }; HashSet <string> pathingResults = new HashSet <string>(); for (int i = 0; i < 1000; i++) { string pathedString = SpeechService.SpeechFromScript(pathingString); pathingResults.Add(pathedString); } Assert.IsTrue(pathingResults.SetEquals(new HashSet <string>(pathingOptions))); }
static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); InitializeServices(); SimpleIoc.Default.Register <ISpeechService>(() => { var language = GetLanguage(); var service = new SpeechService { Language = language }; return(service); }); SimpleIoc.Default.Register <Services.IDialogService, Services.DialogService>(); SimpleIoc.Default.Register <IStreamingService, StreamingService>(); SimpleIoc.Default.Register <ISettingsService, SettingsService>(); SimpleIoc.Default.Register <INetworkService, NetworkService>(); SimpleIoc.Default.Register <ILauncherService, LauncherService>(); SimpleIoc.Default.Register <IAppService, AppService>(); SimpleIoc.Default.Register <IMediaPicker, MediaPicker>(); SimpleIoc.Default.Register <IVisionSettingsProvider, LocalVisionSettingsProvider>(); SimpleIoc.Default.Register <MainViewModel>(); SimpleIoc.Default.Register <SettingsViewModel>(); SimpleIoc.Default.Register <AboutViewModel>(); SimpleIoc.Default.Register <RecognizeTextViewModel>(); SimpleIoc.Default.Register <PrivacyViewModel>(); OnInitialize(); }
public void TestShipSizes() { SpeechService.Speak("This is a test for a small ship.", "IVONA 2 Emma", 0, 0, 60, -50, 0, true); SpeechService.Speak("This is a test for a medium ship.", "IVONA 2 Emma", 0, 0, 60, -25, 0, true); SpeechService.Speak("This is a test for a large ship.", "IVONA 2 Emma", 0, 0, 60, -10, 0, true); SpeechService.Speak("This is a test for a huge ship.", "IVONA 2 Emma", 0, 0, 60, -2, 0, true); }
private async void OnLoaded(object sender, RoutedEventArgs routedEventArgs) { try { await ApiData.GetApiData(); await SpeechService.Startup(); Browser.Navigate(new Uri("http://localhost/home.html")); speechRecognition.StartRecognizing(); TimeSpan period = TimeSpan.FromMinutes(30); ThreadPoolTimer.CreatePeriodicTimer(async source => { Debug.WriteLine("API Daten werden aktualisiert."); await ApiData.GetApiData(); await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { Browser.Refresh(); }); Debug.WriteLine("Anzeige aktualisiert."); }, period); } catch (Exception exception) { Log.Log.WriteException(exception); } }
private async void addToDoButton_Click(object sender, EventArgs e) { var selectedLanguage = checkSelectedLanguage(); SpeechService speechService = new SpeechService(); var result = await speechService.RecognizeSpeechAsync(selectedLanguage); result = trimResult(result); var newTodo = todos.FirstOrDefault(s => s.Title == result); if (newTodo == null) { var todo = new Todo(result); todos.Add(todo); ListViewItem item = new ListViewItem(todo.Title); var toDoStatus = checkToDoStatus(todo); item.SubItems.Add(toDoStatus); listViewAll.Items.Add(item); updateListViewActive(); updateListViewAll(); updateListViewCompleted(); } else { MessageBox.Show($"Todo { result } already exists"); } }
private async Task <DialogTurnResult> PromptForNameStepAsync( WaterfallStepContext stepContext, CancellationToken cancellationToken) { var greetingState = await UserProfileAccessor.GetAsync(stepContext.Context); if (string.IsNullOrWhiteSpace(greetingState.Name)) { await SpeechService.TextToSpeechAsync("Hi, What is your name?"); // prompt for name, if missing var opts = new PromptOptions { Prompt = new Activity { Type = ActivityTypes.Message, Text = "What is your name?", }, }; SpeechService.PlaySound(); return(await stepContext.PromptAsync(NamePrompt, opts)); } else { return(await stepContext.NextAsync()); } }
public IActionResult Post(FileModel file) { var uploads = configuration.GetValue <string>("AppConfiguration:Uploads"); var bytes = Convert.FromBase64String(file.File); string pathToWavFile = ""; string path = ""; string result = ""; using (ZipArchive archive = new ZipArchive(new MemoryStream(bytes))) { foreach (ZipArchiveEntry entry in archive.Entries) { string extension = Path.GetExtension(entry.FullName); if (!string.IsNullOrEmpty(extension)) //make sure it's not a folder { path = Path.Combine(uploads, entry.FullName); entry.ExtractToFile(path, true); if (extension.ToLower() == ".wav") { pathToWavFile = path; } } else { Directory.CreateDirectory(Path.Combine(uploads, entry.FullName)); } } var speechServices = new SpeechService(); result = speechServices.RecognizeSpeechFromFileAsync(pathToWavFile).Result; } return(Ok(result)); }
public void TestPathingString4() { SpeechService SpeechService = new SpeechService(); string pathingString = @";;;;;;Seven;;;"; List <string> pathingOptions = new List <string>() { "" , "Seven" }; int sevenCount = 0; for (int i = 0; i < 10000; i++) { string pathedString = SpeechService.SpeechFromScript(pathingString); if (pathedString == "Seven") { sevenCount++; } } Assert.IsTrue(sevenCount > 750); Assert.IsTrue(sevenCount < 1500); }
public void TestPathingString7() { SpeechService SpeechService = new SpeechService(); string pathingString = @"[{TXT:Ship model} {TXT:Ship callsign (spoken)};This is {TXT:Ship model} {TXT:Ship callsign (spoken)}] [requesting docking permission;requesting docking clearance;requesting permission to dock;requesting clearance to dock]."; List <string> pathingOptions = new List <string>() { "{TXT:Ship model} {TXT:Ship callsign (spoken)} requesting docking permission." , "This is {TXT:Ship model} {TXT:Ship callsign (spoken)} requesting docking permission." , "{TXT:Ship model} {TXT:Ship callsign (spoken)} requesting docking clearance." , "This is {TXT:Ship model} {TXT:Ship callsign (spoken)} requesting docking clearance." , "{TXT:Ship model} {TXT:Ship callsign (spoken)} requesting clearance to dock." , "This is {TXT:Ship model} {TXT:Ship callsign (spoken)} requesting clearance to dock." , "{TXT:Ship model} {TXT:Ship callsign (spoken)} requesting permission to dock." , "This is {TXT:Ship model} {TXT:Ship callsign (spoken)} requesting permission to dock." }; HashSet <string> pathingResults = new HashSet <string>(); for (int i = 0; i < 1000; i++) { string pathedString = SpeechService.SpeechFromScript(pathingString); pathingResults.Add(pathedString); } Assert.IsTrue(pathingResults.SetEquals(new HashSet <string>(pathingOptions))); }
public void testSendAndReceive() { SpeechService SpeechService = new SpeechService(); SpeechService.Say(null, ShipDefinitions.ShipFromEliteID(128049339), "Issuing docking request. Please stand by."); SpeechService.Transmit(null, ShipDefinitions.ShipFromEliteID(128049339), "Anaconda golf foxtrot lima one niner six eight requesting docking."); SpeechService.Receive(null, ShipDefinitions.ShipFromEliteID(128049339), "Roger golf foxtrot lima one niner six eight docking request received"); }
public void TestSpeechServiceEscaping1() { // Test escaping for invalid ssml. var line = @"<invalid>test</invalid> <invalid withattribute='attribute'>test2</invalid>"; var result = SpeechService.escapeSsml(line); Assert.AreEqual("<invalid>test</invalid> <invalid withattribute='attribute'>test2</invalid>", result); }
public void TestSpeechServiceEscaping2() { // Test escaping for double quotes, single quotes, and <phoneme> ssml commands. XML characters outside of ssml elements are escaped. var line = @"<phoneme alphabet=""ipa"" ph=""ʃɪnˈrɑːrtə"">Shinrarta</phoneme> <phoneme alphabet='ipa' ph='ˈdezɦrə'>Dezhra</phoneme> & Co's shop"; var result = SpeechService.escapeSsml(line); Assert.AreEqual("<phoneme alphabet=\"ipa\" ph=\"ʃɪnˈrɑːrtə\">Shinrarta</phoneme> <phoneme alphabet='ipa' ph='ˈdezɦrə'>Dezhra</phoneme> & Co's shop", result); }
public void TestSpeechServiceEscaping4() { // Test escaping for Cereproc unique <usel> and <spurt> elements var line = @"<spurt audio='g0001_004'>cough</spurt> This is a <usel variant=""1"">test</usel> sentence."; var result = SpeechService.escapeSsml(line); Assert.AreEqual(line, result); }
public void TestSpeechServiceEscaping5() { // Test escaping for characters included in the escape sequence ('X' in this case) var line = @"Brazilian armada <say-as interpret-as=""characters"">X</say-as>"; var result = SpeechService.escapeSsml(line); Assert.AreEqual(line, result); }
public SpeechHandler(SpeechService speechService) { _speechService = speechService; _jsonSerializerSettings = new JsonSerializerSettings() { ContractResolver = new CamelCasePropertyNamesContractResolver() }; }
public void TestSpeechServiceEscaping3() { // Test escaping for <break> elements. XML characters outside of ssml elements are escaped. var line = @"<break time=""100ms""/>He said ""Foo""."; var result = SpeechService.escapeSsml(line); Assert.AreEqual("<break time=\"100ms\"/>He said "Foo".", result); }
public void TestChorus() { SpeechService.Speak("Chorus level 0", "IVONA 2 Emma", 0, 0, 0, 0, 0, true); SpeechService.Speak("Chorus level 20", "IVONA 2 Emma", 0, 0, 20, 0, 0, true); SpeechService.Speak("Chorus level 40", "IVONA 2 Emma", 0, 0, 40, 0, 0, true); SpeechService.Speak("Chorus level 60", "IVONA 2 Emma", 0, 0, 60, 0, 0, true); SpeechService.Speak("Chorus level 80", "IVONA 2 Emma", 0, 0, 80, 0, 0, true); SpeechService.Speak("Chorus level 100", "IVONA 2 Emma", 0, 0, 100, 0, 0, true); }
private void ttsTestDamagedVoiceButtonClicked(object sender, RoutedEventArgs e) { Ship testShip = ShipDefinitions.ShipFromModel((string)ttsTestShipDropDown.SelectedValue); testShip.Health = 20; SpeechServiceConfiguration speechConfiguration = SpeechServiceConfiguration.FromFile(); SpeechService speechService = new SpeechService(speechConfiguration); speechService.Say(null, testShip, "Severe damage to your " + Translations.ShipModel((string)ttsTestShipDropDown.SelectedValue) + "."); }
private void GetGrammarSpeech() { this.SpeechDomainsList.Visibility = Visibility.Collapsed; SpeechService.GetGrammarsAsync( HawaiiClient.HawaiiApplicationId, (result) => this.Dispatcher.BeginInvoke(() => this.OnSpeechGrammarsReceived(result))); this.RetrievingGrammarsLabel.Visibility = Visibility.Visible; this.RecognizingProgress.Visibility = Visibility.Visible; }
public void TestVariants() { SpeechService SpeechService = new SpeechService(); SpeechService.Say(null, ShipDefinitions.ShipFromEliteID(128049309), "Welcome to your Vulture. Weapons online."); SpeechService.Transmit(null, ShipDefinitions.ShipFromEliteID(128049309), "Vulture x-ray whiskey tango seven one seven six requesting docking."); SpeechService.Say(null, ShipDefinitions.ShipFromEliteID(128049339), "Welcome to your Python. Scanning at full range."); SpeechService.Transmit(null, ShipDefinitions.ShipFromEliteID(128049339), "Python victor oscar Pappa fife tree fawer niner requesting docking."); SpeechService.Say(null, ShipDefinitions.ShipFromEliteID(128049363), "Welcome to your Anaconda. All systems operational."); SpeechService.Transmit(null, ShipDefinitions.ShipFromEliteID(128049363), "Anaconda charlie november delta one niner eight fawer requesting docking."); }
public void TestChorus() { SpeechService SpeechService = new SpeechService(); SpeechService.Speak("Chorus level 0", null, 0, 0, 0, 0, 0, true); SpeechService.Speak("Chorus level 20", null, 0, 0, 20, 0, 0, true); SpeechService.Speak("Chorus level 40", null, 0, 0, 40, 0, 0, true); SpeechService.Speak("Chorus level 60", null, 0, 0, 60, 0, 0, true); SpeechService.Speak("Chorus level 80", null, 0, 0, 80, 0, 0, true); SpeechService.Speak("Chorus level 100", null, 0, 0, 100, 0, 0, true); }
public UserStoriesViewModel( IVstsService vstsService, NavigationServiceEx navigationService, IDialogServiceEx dialogService, RecognitionService recognitionService, SpeechService speechService) : base(vstsService, navigationService, dialogService, recognitionService, speechService) { }
static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); SimpleIoc.Default.Register <CognitiveClient>(() => { VisionSettings visionSettings = null; using (var stream = typeof(ViewModelLocator).GetTypeInfo().Assembly.GetManifestResourceStream(Constants.VisionSettingsFile)) { using (var reader = new StreamReader(stream)) visionSettings = JsonConvert.DeserializeObject <VisionSettings>(reader.ReadToEnd()); } var visionSettingsProvider = new SimpleVisionSettingsProvider(visionSettings); var cognitiveClient = new CognitiveClient(visionSettingsProvider); var cognitiveSettings = cognitiveClient.Settings; cognitiveSettings.EmotionSubscriptionKey = ServiceKeys.EmotionSubscriptionKey; cognitiveSettings.VisionSubscriptionKey = ServiceKeys.VisionSubscriptionKey; cognitiveSettings.FaceSubscriptionKey = ServiceKeys.FaceSubscriptionKey; cognitiveSettings.TranslatorSubscriptionKey = ServiceKeys.TranslatorSubscriptionKey; return(cognitiveClient); }); SimpleIoc.Default.Register <ISpeechService>(() => { var language = GetLanguage(); var service = new SpeechService { Language = language }; return(service); }); SimpleIoc.Default.Register <Services.IDialogService, Services.DialogService>(); SimpleIoc.Default.Register <IStreamingService, StreamingService>(); SimpleIoc.Default.Register <ISettingsService, SettingsService>(); SimpleIoc.Default.Register <INetworkService, NetworkService>(); SimpleIoc.Default.Register <ILauncherService, LauncherService>(); SimpleIoc.Default.Register <IAppService, AppService>(); SimpleIoc.Default.Register <IMediaPicker, MediaPicker>(); SimpleIoc.Default.Register <MainViewModel>(); SimpleIoc.Default.Register <SettingsViewModel>(); SimpleIoc.Default.Register <AboutViewModel>(); SimpleIoc.Default.Register <RecognizeTextViewModel>(); SimpleIoc.Default.Register <PrivacyViewModel>(); OnInitialize(); }
private async void MicrophoneIcon_Tapped(object sender, TappedRoutedEventArgs e) { if (_speechService == null) { _speechService = new SpeechService(); } var notifier = NotifyTaskCompletion.Create(_speechService.RecognizeAsync()); await notifier.TaskCompleted; if (notifier.IsSuccessfullyCompleted) { searchBox.Text = notifier.Result; } }
public void TestStandard() { SpeechService.Speak("This is a test for a small ship.", null, 0, 0, 10, 0, 0, true); SpeechService.Speak("This is a test for a medium ship.", null, 0, 0, 10, 0, 0, true); SpeechService.Speak("This is a test for a large ship.", null, 0, 0, 10, 0, 0, true); SpeechService.Speak("This is a test.", null, 0, 0, 0, 0, 0, true); SpeechService.Speak("This is a test with chorus.", null, 0, 0, 10, 0, 0, true); //SpeechService.Speak("This is a test with echo.", null, 0, 0, 70, 0, 0, true); //SpeechService.Speak("This is a test with reverb.", null, 0, 0, 0, 100, 0, true); //SpeechService.Speak("This is a test with reverb and echo.", null, 0, 0, 70, 100, 0, true); //SpeechService.Speak("This is a test with chorus and reverb.", null, 0, 0, 10, 100, 0, true); //SpeechService.Speak("This is a test with chorus, reverb and echo.", null, 0, 0, 70, 100, 0, true); SpeechService.Speak("This commodity should sell for at least 6000 credits.", null, 0, 0, 10, 100, 0, true); }
public void TestPowerplay() { SpeechService SpeechService = new SpeechService(); //SpeechService.Say(ShipDefinitions.ShipFromEliteID(128049363), Translations.Power("Aisling Duval") + "."); //SpeechService.Say(ShipDefinitions.ShipFromEliteID(128049363), Translations.Power("Archon Delaine") + "."); //SpeechService.Say(ShipDefinitions.ShipFromEliteID(128049363), Translations.Power("Arissa Lavigny-Duval") + "."); //SpeechService.Say(ShipDefinitions.ShipFromEliteID(128049363), Translations.Power("Denton Patreus") + "."); //SpeechService.Say(ShipDefinitions.ShipFromEliteID(128049363), Translations.Power("Edmund Mahon") + "."); //SpeechService.Say(ShipDefinitions.ShipFromEliteID(128049363), Translations.Power("Felicia Winters") + "."); //SpeechService.Say(ShipDefinitions.ShipFromEliteID(128049363), Translations.Power("Pranav Antal") + "."); //SpeechService.Say(ShipDefinitions.ShipFromEliteID(128049363), Translations.Power("Zachary Hudson") + "."); //SpeechService.Say(ShipDefinitions.ShipFromEliteID(128049363), Translations.Power("Zemina Torval") + "."); SpeechService.Say(null, ShipDefinitions.ShipFromEliteID(128049363), Translations.Power("Li Yong-Rui") + "."); }
public async Task <ActionResult> PlayWav(string id, string spText) { string strPath = Server.MapPath("~\\MP4\\" + id + ".wav"); SpeechService.SaveMp3(strPath, spText); try { //FTP 直接返回Stream,需要自己实现 using (FileStream fileStream = new FileStream(strPath, FileMode.Open)) { byte[] fileByte = new byte[fileStream.Length]; fileStream.Seek(0, SeekOrigin.Begin); fileStream.Read(fileByte, 0, (int)fileStream.Length); long fSize = fileStream.Length; long startbyte = 0; long endbyte = fSize - 1; int statusCode = 200; if ((Request.Headers["Range"] != null)) { //Get the actual byte range from the range header string, and set the starting byte. string[] range = Request.Headers["Range"].Split(new char[] { '=', '-' }); startbyte = Convert.ToInt64(range[1]); if (range.Length > 2 && range[2] != "") { endbyte = Convert.ToInt64(range[2]); } //If the start byte is not equal to zero, that means the user is requesting partial content. if (startbyte != 0 || endbyte != fSize - 1 || range.Length > 2 && range[2] == "") { statusCode = 206; } //Set the status code of the response to 206 (Partial Content) and add a content range header. } long desSize = endbyte - startbyte + 1; //Headers Response.StatusCode = statusCode; Response.ContentType = "audio/mpeg"; Response.AddHeader("Content-Accept", Response.ContentType); Response.AddHeader("Content-Length", desSize.ToString()); Response.AddHeader("Content-Range", string.Format("bytes {0}-{1}/{2}", startbyte, endbyte, fSize)); return(File(fileByte, Response.ContentType)); //return new FileStreamResult(fileByte, Response.ContentType); 这个方法不行 } } catch (Exception ex) { throw; } }
/// <summary> /// Dispose the SDK instance, don't miss this after SDK usage. /// </summary> public void Dispose() { Subscriber?.Dispose(); Subscriber = null; Storage?.Dispose(); Storage = null; RuyiNetService?.Dispose(); RuyiNetService = null; SettingSys?.Dispose(); SettingSys = null; L10NService?.Dispose(); L10NService = null; UserService?.Dispose(); UserService = null; InputMgr?.Dispose(); InputMgr = null; SpeechService?.Dispose(); SpeechService = null; Media?.Dispose(); Media = null; OverlayService?.Dispose(); OverlayService = null; lowLatencyTransport?.Close(); LowLatencyProtocol?.Dispose(); lowLatencyTransport = null; LowLatencyProtocol = null; highLatencyTransport?.Close(); HighLatencyProtocol?.Dispose(); HighLatencyProtocol = null; highLatencyTransport = null; InstanceCount--; if (InstanceCount <= 0) { factory.SDKCleanup(); } }
private async void btnRecord_Click(object sender, RoutedEventArgs e) { if (!_isRecording) { _isRecording = true; btnRecord.Content = "Go"; _soundRecorder.StartRecording(); } else { btnSendSMS.IsEnabled = false; statusProgress.Visibility = Visibility.Visible; _isRecording = false; btnRecord.Content = "Converting..."; btnRecord.IsEnabled = false; txtSpeechOutput.IsReadOnly = true; _soundRecorder.StopRecording(); //clientId = "your client id here"; //clientSecret = "your client secret"; try { ContentInfo speechContentInfo = new ContentInfo(); speechContentInfo.Content = await _soundRecorder.GetBytes(); speechContentInfo.Name = _soundRecorder.FilePath; SpeechService speechService = new SpeechService(new SDK.Entities.AttServiceSettings(clientId, clientSecret, new Uri(uriString))); SpeechResponse speechResponse = await speechService.SpeechToText(speechContentInfo); txtSpeechOutput.IsReadOnly = false; if (null != speechResponse) { txtSpeechOutput.Text = speechResponse.GetTranscription(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } btnSendSMS.IsEnabled = true; statusProgress.Visibility = Visibility.Collapsed; btnRecord.Content = "Speak"; btnRecord.IsEnabled = true; } }
private async void btnRecord_Click(object sender, RoutedEventArgs e) { if (!_isRecording) { _isRecording = true; btnRecord.Content = "Stop"; _soundRecorder.StartRecording(); } else { statusProgress.Visibility = Visibility.Visible; _isRecording = false; btnRecord.Content = "Converting..."; btnRecord.IsEnabled = false; _soundRecorder.StopRecording(); clientId = "your_att_app_key"; clientSecret = "your_att_secret_key"; uriString = "https://api.att.com"; try { ContentInfo speechContentInfo = new ContentInfo(); speechContentInfo.Content = await _soundRecorder.GetBytes(); speechContentInfo.Name = _soundRecorder.FilePath; SpeechService speechService = new SpeechService(new SDK.Entities.AttServiceSettings(clientId, clientSecret, new Uri(uriString))); SpeechResponse speechResponse = await speechService.SpeechToText(speechContentInfo); if (null != speechResponse) { txtSpeechOutput.Text = speechResponse.GetTranscription(); } } catch (Exception ex) { txtSpeechOutput.Text = ex.Message; } statusProgress.Visibility = Visibility.Collapsed; btnRecord.Content = "Start"; btnRecord.IsEnabled = true; } }
// Check if the user has the language installed... private async Task<bool> CheckLanguageInstalled() { _language = new SpeechService(_targetLanguageCode); var languageFound = _language.IsLanguageFound(); if (!languageFound) { var errorMessage = string.Format( "Requested language code[{0}] is not installed. Please exit and install the [{1}] speech pack for Windows Phone 8.1.", _targetLanguageCode, _targetLanguageCode); var errorDialog = new MessageDialog(errorMessage); await errorDialog.ShowAsync(); return true; } return false; }