2

I use Live SDK 5.6, Visual Studio 2013 Update 2

  1. BackgroundUploadAsync method result is returned to the normal progress.

Code :

var tOperation =
    await
        client.BackgroundUploadAsync(targetFolder.id, file.Name, file, OverwriteOption.Overwrite,
            new CancellationToken(), new Progress<LiveOperationProgress>(
                args => {
                    System.Diagnostics.Debug.WriteLine("Upload Progress : {0}/{1}/{2}/{3}", file.Name,
                        args.BytesTransferred, args.ProgressPercentage, args.TotalBytes);
                }));

Result : Upload Progress : avatar_upd_big_size_by_merychess-d30zufu.jpg/131072/2.56776045415382/5104526 Upload Progress : avatar_upd_big_size_by_merychess-d30zufu.jpg/262144/5.13552090830765/5104526 Upload Progress : avatar_upd_big_size_by_merychess-d30zufu.jpg/655360/12.8388022707691/5104526 Upload Progress : avatar_upd_big_size_by_merychess-d30zufu.jpg/3407872/66.7617718079994/5104526 Upload Progress : avatar_upd_big_size_by_merychess-d30zufu.jpg/5104526/100/5104526

But CreateBackgroundUploadAsync is do not return value

Code :

var uploadOperation =
    await
        client.CreateBackgroundUploadAsync(targetFolder.id, file.Name, file, OverwriteOption.Overwrite);

var cancel = new CancellationTokenSource();
_cencelTokens.Add(new KeyValuePair<Guid, CancellationTokenSource>(uploadOperation.Guid, cancel));

var progress = new Progress<LiveOperationProgress>(
    args =>
    {
        System.Diagnostics.Debug.WriteLine("Upload Progress : {0}/{1}/{2}/{3}", uploadOperation.Guid,
            args.BytesTransferred, args.ProgressPercentage, args.TotalBytes);
        if (args.ProgressPercentage > 0)
        {
        }
    });

//Operation생성 후 생성 이벤트 발생
_eventAggregator.GetEvent<ChangeEvent>().Publish(new KeyValuePair<string, object>("UploadOperationStart", uploadOperation.Guid));

//Upload실행
var uploadResult = await uploadOperation.StartAsync(cancel.Token, progress);

Result :

Upload Progress : 59de0ee3-9806-415f-814c-36a6b087c00f/0/0/0 Upload Progress : 59de0ee3-9806-415f-814c-36a6b087c00f/0/0/0 Upload Progress : 59de0ee3-9806-415f-814c-36a6b087c00f/0/0/0 Upload Progress : 59de0ee3-9806-415f-814c-36a6b087c00f/0/0/0 Upload Progress : 59de0ee3-9806-415f-814c-36a6b087c00f/0/0/0 Upload Progress : 59de0ee3-9806-415f-814c-36a6b087c00f/0/0/0 Upload Progress : 59de0ee3-9806-415f-814c-36a6b087c00f/348/100/348

How can I get the value of progress?

Connor Park
  • 279
  • 3
  • 6

0 Answers0