Example #1
0
        public string BuildAnswer(string question)
        {
            if (question.Contains(resources.search))
            {
                question = question.Replace(resources.search, "");
            }
            if (question.Contains(resources.character))
            {
                question = question.Replace(resources.character, "");
            }
            VideoRetrieve data            = new VideoRetrieve();
            List <Video>  listvideos      = data.SearchVideos(question);
            string        responseMessage = string.Empty;

            if (listvideos.Count != 0)
            {
                responseMessage = string.Format(resources.SearchResponse, question.Trim()) + ":";
                for (var i = 0; i < 5; i++)
                {
                    responseMessage += " Video num " + (i + 1) + ": " + listvideos[i].Title + " " + listvideos[0].Link + " | ";
                }
            }
            else
            {
                responseMessage = string.Format(resources.SearchResponseFail, question);
            }
            return(responseMessage);
        }
        public string BuildAnswer(string question)
        {
            VideoRetrieve data            = new VideoRetrieve();
            Video         video           = data.LatestFeaturedVideo;
            string        responseMessage = string.Empty;

            if (video != null)
            {
                responseMessage = string.Format(resources.featuredVideoResponse, video.Title, video.Link);
            }
            return(responseMessage);
        }
Example #3
0
        public string BuildAnswer(string question)
        {
            var    data            = new VideoRetrieve();
            string responseMessage = string.Empty;
            Event  ch9event        = data.LatestEvent;

            if (ch9event.Title != null)
            {
                responseMessage = string.Format(resources.latestEventResponse, ch9event.Title, ch9event.Link);
            }
            return(responseMessage);
        }
Example #4
0
        public string BuildAnswer(string question)
        {
            var    data            = new VideoRetrieve();
            Event  ch9event        = data.LiveEvent;
            string responseMessage = string.Empty;

            if (ch9event.Title.Equals(string.Empty))
            {
                responseMessage = resources.noLiveEventResponse;
            }
            else
            {
                responseMessage = string.Format(resources.liveEventResponse, ch9event.Title, ch9event.Link);
            }
            return(responseMessage);
        }
        private Video getVideo(TimeOption option)
        {
            var   data  = new VideoRetrieve();
            Video video = new Video();

            switch (option)
            {
            case TimeOption.ThisWeek:
                video = data.MostViewedThisWeek;
                break;

            case TimeOption.ThisMonth:
                video = data.MostViewedThisMonth;
                break;
            }
            return(video);
        }