示例#1
0
        private async Task ExecuteSmarthouseCommands(string command)
        {
            var smartHouse = new SmartHouseService();

            switch (command)
            {
            case "Turn on":
                await ShowProgressScreen($"Please wait");

                var result = await smartHouse.Run(UWPLib.Model.SmartHouseCommands.TurnOn);
                await CompleteMessage(result.Message);

                break;

            case "Turn off":
                await ShowProgressScreen($"Please wait");

                result = await smartHouse.Run(UWPLib.Model.SmartHouseCommands.TurnOff);
                await CompleteMessage(result.Message);

                break;

            case "Volume up":
                await VolumeUp();

                break;

            case "Volume down":
                await VolumeDown();

                break;

            default:
                LaunchAppInForeground();
                break;
            }
        }
示例#2
0
        private async Task ExecutePandoraCommands(string command)
        {
            var pandora    = new PandoraService();
            var smartHouse = new SmartHouseService();

            await ShowProgressScreen($"Starting to {command} song");

            switch (command)
            {
            case "Play":
                await smartHouse.Run(UWPLib.Model.SmartHouseCommands.Play);
                await CompleteMessage("");

                break;

            case "Stop":
                await pandora.Run(SmartHouse.UWPLib.Model.PandoraCommands.Play);
                await CompleteMessage("");

                break;

            case "Next":
                await smartHouse.Run(UWPLib.Model.SmartHouseCommands.Next);
                await CompleteMessage("");

                break;

            case "Love":
                await smartHouse.LoveSong();
                await CompleteMessage("");

                break;

            case "Hate":
                await pandora.Run(SmartHouse.UWPLib.Model.PandoraCommands.ThumbDown);
                await CompleteMessage("");

                break;

            case "Boring":
                await pandora.Run(SmartHouse.UWPLib.Model.PandoraCommands.Tired);
                await CompleteMessage("");

                break;

            case "Show":
                var info = await smartHouse.GetCurrentSong();
                await CortanaResponseShowSong(info);

                break;

            case "NextStation":
                var nextInfo = await pandora.Run(SmartHouse.UWPLib.Model.PandoraCommands.NextStation);
                await CompleteMessage(nextInfo?.Message);

                break;

            case "PrevStation":
                var prevInfo = await pandora.Run(SmartHouse.UWPLib.Model.PandoraCommands.PrevStation);
                await CompleteMessage(prevInfo?.Message);

                break;

            default:
                LaunchAppInForeground();
                break;
            }
        }