public void Dispose() { if (disposed) { return; } if (MediaList != null) { MediaList.Dispose(); MediaList = null; // Setter triggers vector unsubscribe logic } PlaybackSession.Dispose(); disposed = true; }
public MediaItemViewModel(MediaListViewModel listViewModel, MediaItem mediaItem) { this.listViewModel = listViewModel; MediaItem = mediaItem; RaisePropertyChanged("Title"); // This app caches all images by loading the BitmapImage // when the item is created, but production apps would // use a more resource friendly paging mechanism or // just use PreviewImageUri directly. // // The reason we cache here is to avoid audio gaps // between tracks on transitions when changing artwork. PreviewImage = new BitmapImage(); PreviewImage.UriSource = mediaItem.PreviewImageUri; }