/// <summary> /// Whenever a trip is modified, we trigger an update of the voice command Phrase list. This allows /// voice commands such as "Adventure Works Show trip to {destination} to be up to date with saved /// Trips. /// </summary> public async Task UpdateDestinationPhraseList() { try { // Update the destination phrase list, so that Cortana voice commands can use destinations added by users. // When saving a trip, the UI navigates automatically back to this page, so the phrase list will be // updated automatically. VoiceCommandDefinition commandDefinitions; string countryCode = "zh-cn";//CultureInfo.CurrentCulture.Name.ToLower(); //if (countryCode.Length == 0) //{ // countryCode = "en-us"; //} if (VoiceCommandDefinitionManager.InstalledCommandDefinitions.TryGetValue("AdventureWorksCommandSet_" + countryCode, out commandDefinitions)) { await store.LoadTrips(); List <string> destinations = new List <string>(); foreach (Model.Trip t in store.Trips) { destinations.Add(t.Destination); } await commandDefinitions.SetPhraseListAsync("destination", destinations); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Updating Phrase list for VCDs: " + ex.ToString()); } }
/// <summary> /// Reload the trip store from data files. /// </summary> internal async Task LoadTrips() { await store.LoadTrips(); }
private async void InitializeStore(TripStore store) { await store.LoadTrips(); }