本文整理汇总了C#中IEventAggregator.AddSource方法的典型用法代码示例。如果您正苦于以下问题:C# IEventAggregator.AddSource方法的具体用法?C# IEventAggregator.AddSource怎么用?C# IEventAggregator.AddSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEventAggregator
的用法示例。
在下文中一共展示了IEventAggregator.AddSource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TaskBoardViewModel
public TaskBoardViewModel(IRepositoryProvider repositoryProvider, IEventAggregator bus, ICommandResolver commandResolver)
{
_repositoryProvider = repositoryProvider;
_bus = bus;
_commandResolver = commandResolver;
Tasks = new SortableReactiveCollection<TaskViewModel>();
Tasks.ItemChanged
.Throttle(TimeSpan.FromSeconds(5))
.Select(c => c.Sender)
.Where(c => _repository != null)
.Where(task => !task.IsEditing)
.SubscribeOn(RxApp.DeferredScheduler)
.Subscribe(_ => OnSaveAllTasks(null));
Tasks.ItemChanged
.Where(c => c.PropertyName == "IsSelected")
.SubscribeOn(RxApp.DeferredScheduler)
.Select(c => c.Sender)
.Subscribe(IsSelectedChanged);
Tasks.ItemChanged
.Where(c => c.PropertyName == "State")
.SubscribeOn(RxApp.DeferredScheduler)
.Select(c => c.Sender)
.Subscribe(StateChanged);
Tasks.ChangeTrackingEnabled = true;
_bus.ListenOnScheduler<DatabaseChanged>(OnDatabaseChanged);
_bus.ListenOnScheduler<CreateNewTask>(OnCreateNewTask);
_bus.ListenOnScheduler<CreateNewSubTask>(OnCreateNewSubTask);
_bus.ListenOnScheduler<SaveAllTasks>(OnSaveAllTasks);
_bus.ListenOnScheduler<ReloadAllTasks>(evt => Reload());
_bus.ListenOnScheduler<ReSort>(evt => Reorder());
_bus.ListenOnScheduler<CollapseAll>(evt => OnCollapseAll());
_bus.AddSource(Tasks.PropertyOnAnyChanged(vm => vm.State)
.Select(_ => new TaskStateChanged()));
DragCommand = new ReactiveCommand();
DragCommand.OfType<DragCommandArgs>().Subscribe(OnNext);
}