private void GamesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { _eventAggregator.GetEvent <GameListUpdated> ().Publish(Events.EmptyArg); switch (e.Action) { case NotifyCollectionChangedAction.Add: e.NewItems.OfType <Game> ().ToList().ForEach(g => { g.PropertyChanged += GameStateChanged; _storageService.AddObject(g); }); break; case NotifyCollectionChangedAction.Remove: e.OldItems.OfType <Game> ().ToList().ForEach(g => { g.PropertyChanged -= GameStateChanged; _storageService.RemoveObject(g); }); break; } _storageService.CommitAsync(); }
public string AddObject(string collectionName, object obj) { return(_service.AddObject(collectionName, obj)); }