private void MediaCollectionView_NrItemsInStateChanged(object sender, MediaStateCollectionViewChangedEventArgs e) { switch (e.Action) { case MediaViewer.Model.Media.Base.State.MediaStateChangedAction.Add: foreach (SelectableMediaItem item in e.NewItems) { App.Current.Dispatcher.BeginInvoke(new Action(() => mapAddItem(item))); } break; case MediaViewer.Model.Media.Base.State.MediaStateChangedAction.Remove: foreach (SelectableMediaItem item in e.OldItems) { App.Current.Dispatcher.BeginInvoke(new Action(() => mapRemoveItem(item))); } break; case MediaViewer.Model.Media.Base.State.MediaStateChangedAction.Clear: App.Current.Dispatcher.BeginInvoke(new Action(() => mapClearItems())); break; case MediaViewer.Model.Media.Base.State.MediaStateChangedAction.Modified: break; case MediaViewer.Model.Media.Base.State.MediaStateChangedAction.Replace: break; default: break; } }
private void mediaCollection_NrItemsInStateChanged(object sender, MediaStateCollectionViewChangedEventArgs e) { if (e.Action == MediaStateChangedAction.Clear) { App.Current.Dispatcher.BeginInvoke(new Action(tagsList.Clear)); } if (timer.Enabled) { extendTimer = true; } else { timer.Enabled = true; } }