コード例 #1
0
ファイル: Tree.cs プロジェクト: Kuzq/gitter
        public static Task<Tree> GetAsync(Repository repository, string treeHash, IProgress<OperationProgress> progress, CancellationToken cancellationToken)
        {
            Verify.Argument.IsNotNull(repository, "repository");

            if(progress != null)
            {
                progress.Report(new OperationProgress(Resources.StrsFetchingTree.AddEllipsis()));
            }
            var parameters = new QueryTreeContentParameters(treeHash, true, false);
            return repository.Accessor.QueryTreeContent.InvokeAsync(parameters, progress, cancellationToken)
                .ContinueWith(
                t =>
                {
                    var treeData = TaskUtility.UnwrapResult(t);
                    var tree = new Tree(repository, treeHash, false);
                    tree.SetContent(treeData);
                    return tree;
                },
                cancellationToken,
                TaskContinuationOptions.ExecuteSynchronously,
                TaskScheduler.Default);
        }