private void RegisterCurrentTriggers() { var updateProperty = new Action(() => { if (_queue?.LastOrDefault() == Current) { QueueEnded?.Invoke(this, new QueueEndedEventArgs()); } IMediaFile current = null; if (Count - 1 >= Index && Index >= 0) { current = _queue[Index]; } if (_current != current) { _current = current; OnPropertyChanged(nameof(Current)); QueueMediaChanged?.Invoke(this, new QueueMediaChangedEventArgs(Current)); } }); PropertyChanged += (sender, e) => { if (e.PropertyName == nameof(Index)) { updateProperty(); } }; _queue.CollectionChanged += (sender, e) => { updateProperty(); }; if (Count - 1 >= Index && Index >= 0) { _current = _queue[Index]; } }