Пример #1
0
        public void RemoveColumn(IColumn column)
        {
            _columns.Remove(column);

            RaisePropertyChanged("Columns");
            ColumnsChanged.RaiseEvent(this,
                                      new CollectionChangeEvent <IColumn>(CollectionChangeAction.Deletion, column));
        }
        public MainViewModel(IDiagnosticsViewModel diagnosticsViewModel,
                             ITabularDataService tabularDataService,
                             IColumnsService columnsService,
                             IOverlayService overlayService,
                             IDateTimeService dateTimeService,
                             ISchedulerService schedulerService)
        {
            _tabularDataService = tabularDataService;
            _schedulerService   = schedulerService;
            _columnsService     = columnsService;
            _overlayService     = overlayService;
            _dateTimeService    = dateTimeService;
            Diagnostics         = diagnosticsViewModel;

            _dataIds        = new Dictionary <object, DynamicDataViewModel>(1000);
            _data           = new CustomTypeRangeObservableCollection <DynamicDataViewModel>();
            _collectionView = new ListCollectionView(_data)
            {
                Filter = FilterData
            };

            _updateStats = new Dictionary <long, int>();

            RefreshCommand = ReactiveCommand.Create()
                             .DisposeWith(this);

            ClearCommand = ReactiveCommand.Create()
                           .DisposeWith(this);

            ColumnPickerCommand = ReactiveCommand.Create(HasDataChanged)
                                  .DisposeWith(this);

            _dataStream = InitialiseAndProcessDataAsync()
                          .DisposeWith(this);

            RefreshCommand.Subscribe(x => Refresh())
            .DisposeWith(this);

            ClearCommand.Subscribe(x => Clear())
            .DisposeWith(this);

            ColumnPickerCommand.Subscribe(x => ShowColumnPicker())
            .DisposeWith(this);

            _suspendNotifications = new SerialDisposable()
                                    .DisposeWith(this);

            FilterChanged.Subscribe(x => _collectionView.Refresh())
            .DisposeWith(this);

            ColumnsChanged.ObserveOn(schedulerService.Dispatcher)
            .Subscribe(x => OnPropertyChanged(nameof(VisibleColumns)))
            .DisposeWith(this);

            Disposable.Create(() => Clear())
            .DisposeWith(this);
        }
Пример #3
0
        public void AddColumn(IColumn column)
        {
            _columns.Add(column);
            column.Parent = this;

            column.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(column_PropertyChanged);
            RaisePropertyChanged("Columns");
            ColumnsChanged.RaiseEvent(this,
                                      new CollectionChangeEvent <IColumn>(CollectionChangeAction.Addition, column));
        }
Пример #4
0
 public void RaiseChanged()
 {
     ColumnsChanged?.Invoke(this, EventArgs.Empty);
 }