Ejemplo n.º 1
0
        public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            // check lauch arguments
            var launchArgs = args as ILaunchActivatedEventArgs;

            if (launchArgs != null)
            {
                if (args.Kind == ActivationKind.Launch)
                {
                    Logger.WriteLine("Started with TILE and launch args: args->{0}; tileId->{1}", launchArgs.Arguments, launchArgs.TileId);
                }
                if (args.Kind == ActivationKind.ToastNotification)
                {
                    Logger.WriteLine("Started with TOAST and launch args: args->{0}; tileId->{1}", launchArgs.Arguments, launchArgs.TileId);
                }
            }

            // check voice commands
            var command = _speechService.GetVoiceCommand(args);

            if (command != null)
            {
                switch (command.CommandName)
                {
                case "showTripToDestination":
                    string destination = command.Interpretations["destination"];
                    Logger.WriteLine("Command: {0}, Text {1}, Interpretation: {2}", command.CommandName, command.Text, destination);
                    break;
                }
            }

            // start the user experience
            NavigationService.Navigate(DefaultPage);
            return(Task.FromResult <object>(null));
        }