Example #1
0
 protected void addComment(VideoInfo video, string comment)
 {
     if (CheckUsernameAndPassword())
     {
         Login();
         YouTubeEntry entry = ((MyYouTubeEntry)video.Other).YouTubeEntry;
         Comment      c     = new Comment()
         {
             Content = comment
         };
         request.AddComment(new Video()
         {
             AtomEntry = entry
         }, c);
     }
 }
Example #2
0
        private void postComment(object sender, RoutedEventArgs e)
        {
            YouTubeRequest req = new YouTubeRequest(new YouTubeRequestSettings(MainWindow.APP_NAME, MainWindow.DEV_KEY, MainWindow.mProgramProperties.Username, MainWindow.mProgramProperties.Password));

            Uri videoEntryUrl = new Uri(string.Format("{0}/{1}", Google.GData.YouTube.YouTubeQuery.DefaultVideoUri, videoId));
            Google.YouTube.Video newVideo = req.Retrieve<Google.YouTube.Video>(videoEntryUrl);

            Comment c = new Comment();
            c.Content = commentTxtBox.Text.ToString();
            try
            {
                req.AddComment(newVideo, c);
            }
            catch (Google.GData.Client.GDataRequestException ex)
            {
                MessageBox.Show("You have post too many comments! Try again later!");
                return;
            }

            this.commentTxtBox.Text = "";
        }