public DriveInfoViewModel(IEventAggregator ea) { _ea = ea; CollectDrives driveCollection = new CollectDrives(); DriveInfoCollection.AddRange(driveCollection.GetDrives()); _ea.GetEvent <CollectionChangedEvent>().Subscribe(CollectionReceived); }
private void CollectionReceived(ObservableCollection <DriveInfoModel> driveCollection) { ChangeCollection = new DelegateCommand(() => Task.Run(() => dispatcher.Invoke(() => { DriveInfoCollection?.Clear(); DriveInfoCollection?.AddRange(driveCollection); }))); ChangeCollection.Execute(); }