本文整理汇总了C#中TrackingCollection.CreateListenerCollection方法的典型用法代码示例。如果您正苦于以下问题:C# TrackingCollection.CreateListenerCollection方法的具体用法?C# TrackingCollection.CreateListenerCollection怎么用?C# TrackingCollection.CreateListenerCollection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackingCollection
的用法示例。
在下文中一共展示了TrackingCollection.CreateListenerCollection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PullRequestListViewModel
public PullRequestListViewModel(
IRepositoryHost repositoryHost,
ILocalRepositoryModel repository,
IPackageSettings settings)
{
this.repositoryHost = repositoryHost;
this.repository = repository;
this.settings = settings;
Title = Resources.PullRequestsNavigationItemText;
this.listSettings = settings.UIState
.GetOrCreateRepositoryState(repository.CloneUrl)
.PullRequests;
openPullRequestCommand = ReactiveCommand.Create();
openPullRequestCommand.Subscribe(_ =>
{
VisualStudio.Services.DefaultExportProvider.GetExportedValue<IVisualStudioBrowser>().OpenUrl(repositoryHost.Address.WebUri);
});
States = new List<PullRequestState> {
new PullRequestState { IsOpen = true, Name = "Open" },
new PullRequestState { IsOpen = false, Name = "Closed" },
new PullRequestState { Name = "All" }
};
trackingAuthors = new TrackingCollection<IAccount>(Observable.Empty<IAccount>(),
OrderedComparer<IAccount>.OrderByDescending(x => x.Login).Compare);
trackingAssignees = new TrackingCollection<IAccount>(Observable.Empty<IAccount>(),
OrderedComparer<IAccount>.OrderByDescending(x => x.Login).Compare);
trackingAuthors.Subscribe();
trackingAssignees.Subscribe();
Authors = trackingAuthors.CreateListenerCollection(EmptyUser, this.WhenAnyValue(x => x.SelectedAuthor));
Assignees = trackingAssignees.CreateListenerCollection(EmptyUser, this.WhenAnyValue(x => x.SelectedAssignee));
PullRequests = new TrackingCollection<IPullRequestModel>();
pullRequests.Comparer = OrderedComparer<IPullRequestModel>.OrderByDescending(x => x.UpdatedAt).Compare;
pullRequests.NewerComparer = OrderedComparer<IPullRequestModel>.OrderByDescending(x => x.UpdatedAt).Compare;
this.WhenAny(x => x.SelectedState, x => x.Value)
.Where(x => PullRequests != null)
.Subscribe(s => UpdateFilter(s, SelectedAssignee, SelectedAuthor));
this.WhenAny(x => x.SelectedAssignee, x => x.Value)
.Where(x => PullRequests != null && x != EmptyUser && IsLoaded)
.Subscribe(a => UpdateFilter(SelectedState, a, SelectedAuthor));
this.WhenAny(x => x.SelectedAuthor, x => x.Value)
.Where(x => PullRequests != null && x != EmptyUser && IsLoaded)
.Subscribe(a => UpdateFilter(SelectedState, SelectedAssignee, a));
SelectedState = States.FirstOrDefault(x => x.Name == listSettings.SelectedState) ?? States[0];
}