Пример #1
0
        public async Task LoadTitleAsync()
        {
            _backendAlbum = await EntityRetrievalExtensions.GetAlbumByIdAsync(_itemId);

            if (_backendAlbum != null)
            {
                CoverImageTag = new ThumbnailTag
                {
                    Fallback      = "Album,AlbumPlaceholder",
                    ArtistName    = _backendAlbum.Artist,
                    AlbumName     = _backendAlbum.Title,
                    ThumbnailPath = _backendAlbum.FirstFileInAlbum,
                };

                // Get album detailed information
                Title  = _backendAlbum.Title;
                Artist = _backendAlbum.Artist;
                Year   = DateTimeHelper.GetItemDateYearString(_backendAlbum.Date);
                Intro  = _backendAlbum.Intro;
                Genre  = _backendAlbum.Genre;
                DesktopTitleViewConfiguration.SetTitleBarText(Title);
            }
        }
Пример #2
0
        /// <summary>
        /// Load data from database.
        /// </summary>
        /// <returns>An awaitable task.</returns>
        public async Task LoadDataAsync()
        {
            var elem = await EntityRetrievalExtensions.GetAlbumByIdAsync(_itemId);

            if (elem != null)
            {
                _backendAlbum = elem;

                CoverImageTag = new ThumbnailTag
                {
                    Fallback      = "Album,AlbumPlaceholder",
                    ArtistName    = _backendAlbum.Artist,
                    AlbumName     = _backendAlbum.Title,
                    ThumbnailPath = _backendAlbum.FirstFileInAlbum,
                };

                #region Basic Info
                // Get album detailed information
                Title  = elem.Title;
                Artist = elem.Artist;
                Year   = DateTimeHelper.GetItemDateYearString(elem.Date);
                Intro  = elem.Intro;
                Genre  = elem.Genre;
                DesktopTitleViewConfiguration.SetTitleBarText(Title);
                #endregion

                #region Items

                var tempOrderedItem       = new List <Tuple <int, int, DbMediaFile> >();
                var dbFileAsyncEnumerator = elem.MediaFiles.ToAsyncEnumerable().GetEnumerator();
                if (dbFileAsyncEnumerator != null)
                {
                    while (await dbFileAsyncEnumerator.MoveNext())
                    {
                        var item = dbFileAsyncEnumerator.Current;
                        int discNum = 0, trackNum = 0;
                        int.TryParse(item.DiscNumber, out discNum);
                        int.TryParse(item.TrackNumber, out trackNum);
                        tempOrderedItem.Add(new Tuple <int, int, DbMediaFile>(discNum, trackNum, item));
                    }
                }

                // Disk and Track
                var sortedItem = tempOrderedItem.OrderBy(i => i.Item1)
                                 .ThenBy(i => i.Item2);

                // Add subitems to the ListView data entity set
                foreach (var s in sortedItem)
                {
                    if (s == null)
                    {
                        continue;
                    }
                    ViewItems.Add(s.Item3);
                }
                #endregion
            }

            // Mark complete
            IsLoading = false;
        }
Пример #3
0
        private async void OnPlayIconClick(object sender, RoutedEventArgs e)
        {
            var elem = await EntityRetrievalExtensions.GetAlbumByIdAsync(_id);

            elem.Play(true, false);
        }