Example #1
0
        private async void UpdateComments(CommentThreadsResource.ListRequest.OrderEnum option)
        {
            //Clear the current comments
            commentCollection.Clear();

            var methods = new YoutubeMethods();

            //Get the comments
            var service     = YoutubeMethodsStatic.GetServiceNoAuth();
            var getComments = service.CommentThreads.List("snippet,replies");

            getComments.VideoId    = Constants.activeVideoID;
            getComments.Order      = option;
            getComments.TextFormat = CommentThreadsResource.ListRequest.TextFormatEnum.PlainText;
            getComments.MaxResults = 10;
            var response = await getComments.ExecuteAsync();

            //Save the next page token
            commentNextPageToken = response.NextPageToken;

            //Add them to our collection so that they will be updated on the UI
            foreach (var commentThread in response.Items)
            {
                commentCollection.Add(new CommentContainerDataType(methods.CommentToDataType(commentThread)));
            }
        }
Example #2
0
        private async void AddComments(CommentThreadsResource.ListRequest.OrderEnum option)
        {
            if (isAdding)
            {
                return;
            }

            isAdding = true;

            //Check if there are more comments
            if (commentNextPageToken == null || commentNextPageToken == "")
            {
                return;
            }

            var methods = new YoutubeMethods();

            //Get the comments
            var service     = YoutubeMethodsStatic.GetServiceNoAuth();
            var getComments = service.CommentThreads.List("snippet,replies");

            getComments.VideoId    = Constants.activeVideoID;
            getComments.Order      = option;
            getComments.TextFormat = CommentThreadsResource.ListRequest.TextFormatEnum.PlainText;
            getComments.PageToken  = commentNextPageToken;
            getComments.MaxResults = 15;
            var response = await getComments.ExecuteAsync();

            //Save the next page token
            commentNextPageToken = response.NextPageToken;

            //Add them to our collection so that they will be updated on the UI
            foreach (var commentThread in response.Items)
            {
                commentCollection.Add(new CommentContainerDataType(methods.CommentToDataType(commentThread)));
            }

            isAdding = false;
        }