예제 #1
0
        /// <summary>
        /// Free up memory
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public async void Page_Unloaded(object sender, RoutedEventArgs e)
        {
            if (App.isInBackgroundMode)
            {
                featuredOffset    = 0;
                newReleasesOffset = 0;
                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    MainPivot.SelectionChanged -= MainPivot_SelectionChanged;

                    FeaturedPlaylists.ItemClick -= FeaturedPlaylist_ItemClick;
                    FeaturedPlaylists.ClearValue(XYFocusUpProperty);
                    while (FeaturedPlaylists.Items.Count > 0)
                    {
                        PlaylistHero playlistHero = FeaturedPlaylists.Items.ElementAt(0) as PlaylistHero;
                        FeaturedPlaylists.Items.Remove(playlistHero);
                        playlistHero.Unload();
                    }
                    FeaturedRefresh.Click -= FeaturedRefresh_Click;
                    FeaturedMore.Click    -= FeaturedMore_Click;

                    NewReleasesAlbums.ItemClick -= NewReleasesAlbums_ItemClick;
                    NewReleasesAlbums.ClearValue(XYFocusUpProperty);
                    while (NewReleasesAlbums.Items.Count > 0)
                    {
                        AlbumHero albumHero = NewReleasesAlbums.Items.ElementAt(0) as AlbumHero;
                        NewReleasesAlbums.Items.Remove(albumHero);
                        albumHero.Unload();
                    }
                    NewReleasesRefresh.Click -= NewReleasesRefresh_Click;
                    NewReleasesMore.Click    -= NewReleasesMore_Click;
                });
            }
        }
예제 #2
0
 /// <summary>
 /// Refreshes the list of new releases albums
 /// </summary>
 /// <param name="sender">The refresh button</param>
 /// <param name="e">The routed event arguments</param>
 private async void NewReleasesRefresh_Click(object sender, RoutedEventArgs e)
 {
     newReleasesOffset = 0;
     while (NewReleasesAlbums.Items.Count > 0)
     {
         AlbumHero albumHero = NewReleasesAlbums.Items.ElementAt(0) as AlbumHero;
         albumHero.Unload();
         NewReleasesAlbums.Items.Remove(albumHero);
     }
     await LoadNewReleases();
 }