C # .NET Youtube API: loading video and receiving events upon completion

This is the code to upload videos to Youtube using the C # .NET API from a working Windows Forms application:

YouTubeRequestSettings settings = new YouTubeRequestSettings("whatwill come here ?",
                "my api key",
                "my youtube login email", "my youtube login password");
YouTubeRequest request = new YouTubeRequest(settings);

Video newVideo = new Video();

newVideo.Title = "test 1";
newVideo.Tags.Add(new MediaCategory("Gaming", YouTubeNameTable.CategorySchema));
newVideo.Keywords = "test 1 , test 2";
newVideo.Description = "test 3 test 4";
newVideo.YouTubeEntry.Private = false;
newVideo.Tags.Add(new MediaCategory("tag 1, tag 2",
              YouTubeNameTable.DeveloperTagSchema));
newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
newVideo.YouTubeEntry.MediaSource = new MediaFileSource("C:\\test.avi", "video/quicktime");         
Video createdVideo = request.Upload(newVideo);

It works. What I'm looking for are events that return a download result to me, so I can show progress in the progress bar. Ich can log the following events:

                            request.Service.AsyncOperationProgress +=
                            new AsyncOperationProgressEventHandler(Service_AsyncOperationProgress);
                        request.Service.AsyncOperationCompleted +=
                            new AsyncOperationCompletedEventHandler(Service_AsyncOperationCompleted);

... but they do not work at boot. Also, I cannot find the .NET api documentation, which is much more than the example of downloading the small video above. So: Do ​​you need to look for these wrong events? For reference, I am apparently starting a synchronous download in the following code in the background thread:

            ThreadPool.QueueUserWorkItem(
            delegate
                {
                    try
                    {
                        createdVideo = request.Upload(newVideo);
                    } catch (Exception ex){
                      Invoke((ThreadStart) delegate{uploadingFailedWithException(ex);});
                    }
                });
            Invoke((ThreadStart)readyUploading);

This way, I know when the synchronous operation completed, but I want the user to have events for progress updates. Any ideas?

+5
1

, , .

, , . , , ResumableUploader AsyncOperationCompleted/AsyncOperationProgress, .NET http://code.google.com/p/google-gdata/source/browse/#svn%2Ftrunk%2Fclients%2Fcs%2Fsamples%2FYouTubeUploader%2FYouTubeUploader

+4

All Articles