本文整理汇总了C#中ReactiveList.EnableCollectionSynchronization方法的典型用法代码示例。如果您正苦于以下问题:C# ReactiveList.EnableCollectionSynchronization方法的具体用法?C# ReactiveList.EnableCollectionSynchronization怎么用?C# ReactiveList.EnableCollectionSynchronization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReactiveList
的用法示例。
在下文中一共展示了ReactiveList.EnableCollectionSynchronization方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LibraryGroupViewModel
protected LibraryGroupViewModel(string header, string addHeader = null, string icon = null) {
Header = header;
AddHeader = addHeader;
Icon = icon;
if (!Execute.InDesignMode)
this.SetCommand(x => x.AddCommand);
Children = new ReactiveList<IHierarchicalLibraryItem>();
IsExpanded = true;
this.WhenAnyValue(x => x.SelectedItemsInternal)
.Select(x => x == null ? null : x.CreateDerivedCollection(i => (IHierarchicalLibraryItem) i))
.BindTo(this, x => x.SelectedItems);
UiHelper.TryOnUiThread(() => {
Children.EnableCollectionSynchronization(_childrenLock);
_childrenView =
Children.CreateCollectionView(
new[] {
new SortDescription("SortOrder", ListSortDirection.Ascending),
new SortDescription("Model.IsFavorite", ListSortDirection.Descending),
new SortDescription("Model.Name", ListSortDirection.Ascending)
}, null,
null, null, true);
_itemsView = _childrenView;
});
}
示例2: PickCollectionViewModel
public PickCollectionViewModel(IMediator mediator) {
_mediator = mediator;
Items = new ReactiveList<PickCollectionDataModel>();
UiHelper.TryOnUiThread(() => {
Items.EnableCollectionSynchronization(_itemsLock);
ItemsView =
Items.CreateCollectionView(new List<SortDescription> {
new SortDescription("Name", ListSortDirection.Ascending)
}, null, new List<string> {"Name"}, OnFilter, true);
});
SelectedItems = new ReactiveList<PickCollectionDataModel>();
this.WhenAnyValue(x => x.FilterText)
.Throttle(Common.AppCommon.DefaultFilterDelay)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x => ItemsView.TryRefreshIfHasView());
this.SetCommand(x => x.OkCommand,
this.WhenAnyValue(x => x.SelectedItems.Count).Select(x => x > 0), false)
.RegisterAsyncTask(Process)
.Subscribe();
OkCommand.IsExecuting.Subscribe(x => IsExecuting = x);
DisplayName = "Add mod to Collections";
}