2

Live SDK 5.6、Visual Studio 2013 Update 2 を使用しています

  1. BackgroundUploadAsync メソッドの結果は通常の進行状況に戻ります。

コード :

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アップロードの進行状況: avatar_upd_big_size_by_merychess-d30zufu.jpg/5104526/100/5104526

ただし、CreateBackgroundUploadAsync は値を返さない

コード :

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);

結果 :

アップロードの進行状況: 59de0ee3-9806-415f-814c-36a6b087c00f/0/0/0 アップロードの進行状況: 59de0ee3-9806-415f-814c-36a6b087c00f/0/0/0 アップロードの進行状況: 59de0ee3-9806-415f-8104c-36a6b/087c0 /0/0 アップロードの進行状況: 59de0ee3-9806-415f-814c-36a6b087c00f/0/0/0 アップロードの進行状況: 59de0ee3-9806-415f-814c-36a6b087c00f/0/0/0 アップロードの進行状況: 59de0ee3-9806-415f-814c -36a6b087c00f/0/0/0 アップロードの進行状況: 59de0ee3-9806-415f-814c-36a6b087c00f/348/100/348

進捗状況の値を取得するにはどうすればよいですか?

4

0 に答える 0