public void SayQuote(GreatQuote quote)
        {
            if (quote == null)
            {
                throw new ArgumentNullException("quote");
            }

            ITextToSpeech tts = ServiceLocator.Instance.Resolve <ITextToSpeech>();

            var text = quote.QuoteText;

            if (!string.IsNullOrWhiteSpace(quote.Author))
            {
                text += $" by {quote.Author}";
            }

            tts.Speak(text);
        }
        public void SayQuote(GreatQuote quote)
        {
            // var textToSpeech = ServiceLocator.Instance.Resolve<ITextToSpeech>();

            if (_textToSpeech == null)
            {
                throw new ArgumentNullException(nameof(quote));
            }

            string message = quote.QuoteText;

            if (!string.IsNullOrWhiteSpace(quote.Author))
            {
                message = $"{message} by {quote.Author}";
            }

            _textToSpeech.Speak(message);
        }
        public void SayQuote(GreatQuote quote)
        {
            if (quote == null)
            {
                throw  new ArgumentNullException(nameof(quote));
            }

            var textToSpeech = ServiceLocator.Instance.Resolve <ITextToSpeech>();

            if (textToSpeech != null)
            {
                string text = quote.QuoteText;

                if (!string.IsNullOrWhiteSpace(quote.Author))
                {
                    text = $"{text} by {quote.Author}";
                }

                textToSpeech.Speak(text);
            }
        }
Esempio n. 4
0
        public void SayQuote(GreatQuote quote)
        {
            if (quote == null)
            {
                throw new ArgumentException("Quote is Null (TextToSpeech)");
            }

            var textToSpeechService = ServiceLocator.Instance.Resolve <ITextToSpeech>();

            if (textToSpeechService != null)
            {
                string text = quote.QuoteText;

                if (!string.IsNullOrEmpty(quote.Author))
                {
                    text += $" by {quote.Author}";
                }

                textToSpeechService.Speak(text);
            }
        }
Esempio n. 5
0
 public GreatQuote(GreatQuote copy)
 {
     this.QuoteText = copy.QuoteText;
     this.Author    = copy.Author;
 }