示例#1
0
 public void Start()
 {
     disposable = new CompositeDisposable(
         orchestration.ProcessActions().Subscribe(
             onNext: _ =>
     {
     },
             onCompleted: () =>
     {
         Console.WriteLine("COMPLETED - This shouldn't happen!");
     },
             onError: _ =>
     {
         Console.WriteLine("ERROR'D - This shouldn't happen!");
         Console.WriteLine(_);
     }
             ),
         repositoryState
         .RemoteBranches()
         .Where(branches => branches.Count > 0)
         .Subscribe(allBranches =>
                    // TODO - only push to branches that changed
                    branchSettings.GetAllDownstreamBranches()
                    .SelectMany(all => all.Select(each => each.GroupName).ToObservable())
                    .SelectMany(downstreamBranch => orchestrationActions.CheckDownstreamMerges(downstreamBranch))
                    .Subscribe(
                        onNext: _ => { },
                        onError: (ex) =>
     {
         Console.WriteLine(ex);
     }
                        )
                    )
         );
 }
 public IObservable <ImmutableList <BranchGroupCompleteData> > AllBranchesHierarchy()
 {
     return((
                // TODO - should be more efficient with SQL here.
                branchSettings.GetAllDownstreamBranches()
                .SelectMany(allBranches =>
                            allBranches.ToObservable().SelectMany(async branch => new BranchGroupCompleteData(branch)
     {
         DownstreamBranchGroups = (await branchSettings.GetDownstreamBranches(branch.GroupName).FirstOrDefaultAsync()).Select(b => b.GroupName).ToImmutableList()
     }).ToArray()
                            )
                .Select(branches => branches.ToImmutableList())
                .CombineLatest(
                    repositoryState.RemoteBranches(),
                    (first, second) => new { first, second }
                    )
                .SelectMany(async param =>
                            (await GroupBranches(param.first, param.second, ToDefaultBranchGroup))
                            .OrderBy(a => a.GroupName)
                            .Select(a => new BranchGroupCompleteData(a)
     {
         DownstreamBranchGroups = a.DownstreamBranchGroups ?? ImmutableList <string> .Empty,
     })
                            .ToImmutableList()
                            )
                ).FirstAsync());
 }