コード例 #1
0
        private async Task DoActions(Model.Messages.Message action)
        {
            switch (action.MessageIntent)
            {
            case Model.Messages.IntentEnum.Weather:
                var weatherAction = action as Model.Messages.MessageWeather;

                var weatherString = await _weatherApi.GetForecastAsync(weatherAction.Location, weatherAction.When);

                logger.Info(weatherString);
                if (!string.IsNullOrEmpty(weatherString))
                {
                    logger.Debug("");
                }
                // _microsoftSpeech.Speak(weatherString);
                return;

            case Model.Messages.IntentEnum.Time:
                return;

            case Model.Messages.IntentEnum.Alarm:
                return;

            case Model.Messages.IntentEnum.Note:
                return;

            case Model.Messages.IntentEnum.Translate:
                var translation = await _googleTranslator.TranslateAsync("jak sie masz", "pl", "en");

                logger.Debug(translation);
                TextToSpeech.Speak(translation);
                return;

            default:
                return;
            }
        }