示例#1
0
        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();
        }
示例#2
0
 public string AddObject(string collectionName, object obj)
 {
     return(_service.AddObject(collectionName, obj));
 }