Exemplo n.º 1
0
        public async Task SelectFlightAsync(FlightViewModel flight, bool speak)
        {
            var statusValue = random.Next(0, 3);
            var status      = String.Empty;

            switch (statusValue)
            {
            case 0:
                status = "on time";
                break;

            case 1:
                status = "delayed";
                break;

            case 2:
                status = "cancelled";
                break;
            }

            var message = String.Format("Flight {0} is {1}", flight.Name, status);

            if (speak)
            {
                var speech = new SpeechSynthesizer();

                await speech.SpeakTextAsync(message);
            }
            else
            {
                MessageBox.Show(message, "Flight Status", MessageBoxButton.OK);
            }
        }
Exemplo n.º 2
0
        public async void SelectFlight(FlightViewModel flight)
        {
            var flights = await bookedFlightsService.GetFlightsAsync();

            flights.Add(flight);

            await bookedFlightsService.SetFlightsAsync(flights);

            MessageBox.Show(String.Format("Flight {0} has been booked", flight.Name), "Flight Booked", MessageBoxButton.OK);

            var commandSet = VoiceCommandService.InstalledCommandSets["en-GB"];

            await commandSet.UpdatePhraseListAsync("Booking", flights.Select(f => f.Name));

            navigationService.GoBack();
        }
Exemplo n.º 3
0
 public void SelectFlight(FlightViewModel flight)
 {
     SelectFlightAsync(flight, false);
 }