Exemple #1
0
        public DispatchingViewViewModel()
        {
            DeferTime = TimeSpan.FromSeconds(0.1);
            Add(3);
            ReadOnlyObservableCollection = new ReadOnlyObservableCollection <DummyItem>(_observableCollection);
            DispatchingView            = _observableCollection.AsDispatchingView();
            AddOneCommand              = new RelayCommand(AddOne, () => true);
            AddOneToViewCommand        = new RelayCommand(AddOneToView, () => true);
            AddTenCommand              = new RelayCommand(AddTen, () => true);
            AddOneOnOtherThreadCommand = new RelayCommand(() => Task.Run(() => AddOne()), () => true);
            ClearCommand = new RelayCommand(() => Clear(), () => true);
            ObservableCollection.ObserveCollectionChanged()
            .ObserveOnDispatcher()
            .Subscribe(x => _observableCollectionChanges.Add(x.EventArgs));

            DispatchingView.ObserveCollectionChanged()
            .ObserveOnDispatcher()
            .Subscribe(x => _dispatchingChanges.Add(x.EventArgs));
        }
Exemple #2
0
 private void AddOneToView()
 {
     DispatchingView.Add(new DummyItem(_observableCollection.Count + 1));
 }