Exemple #1
0
        void INavigationAware.OnNavigatedFrom(NavigationContext navigationContext)
        {
            Microsoft.Practices.Prism.UriQuery q = new Microsoft.Practices.Prism.UriQuery();

            var selectedMoods = SelectedMoods.Select(t => WebUtility.HtmlEncode(t.Name)).ToArray();

            if (selectedMoods.Any())
            {
                q.Add("Moods", string.Join(",", selectedMoods));
            }

            var selectedStyles = SelectedStyles.Select(t => WebUtility.HtmlEncode(t.Name)).ToArray();

            if (selectedStyles.Any())
            {
                q.Add("Styles", string.Join(",", selectedStyles));
            }

            SetParameterValue("Tempo", q, Tempo.Minimum);
            SetParameterValue("Loudness", q, Loudness.Minimum);
            SetParameterValue("Danceability", q, Danceability.Minimum);
            SetParameterValue("Energy", q, Energy.Minimum);
            SetParameterValue("ArtistHotness", q, ArtistHotness.Minimum);
            SetParameterValue("ArtistFamiliarity", q, ArtistFamiliarity.Minimum);
            SetParameterValue("SongHotness", q, SongHotness.Minimum);

            var newUri = typeof(MainStationView).FullName + q;

            navigationContext.NavigationService.Journal.CurrentEntry.Uri = new Uri(newUri, UriKind.RelativeOrAbsolute);
        }
Exemple #2
0
        private void ExecuteGoToAlbum(TrackContainer album)
        {
            UriQuery q = new UriQuery();

            q.Add("artistName", album.Owner.Name);
            q.Add("albumName", album.Name);
            RegionManager.RequestNavigate(AppRegions.ViewRegion, typeof(AlbumView).FullName + q);
        }
Exemple #3
0
 private void SetParameterValue(string parameterName, Microsoft.Practices.Prism.UriQuery query, double?value)
 {
     if (value.HasValue)
     {
         query.Add(parameterName, value.Value.ToString(CultureInfo.InvariantCulture));
     }
 }
        private void ExecuteGoToArtist(SimilarArtistModel artist)
        {
            UriQuery query = new UriQuery();

            query.Add("artistName", artist.Name);
            RegionManager.RequestNavigate(AppRegions.ViewRegion, typeof(ArtistView).FullName + query);
        }
        public static Uri ToPrismNavigationUriType(Type type, UriQuery uriQuery)
        {
            var prismQuery = new Microsoft.Practices.Prism.UriQuery();

            if (uriQuery != null)
            {
                foreach (var arg in uriQuery.Arguments)
                {
                    prismQuery.Add(arg.Key, arg.Value);
                }
            }
            var uri = new Uri(type.FullName + prismQuery, UriKind.Relative);

            return(uri);
        }
 private void ExecuteGoToAlbum(TrackContainer album)
 {
     UriQuery q = new UriQuery();
     q.Add("artistName", album.Owner.Name);
     q.Add("albumName", album.Name);
     RegionManager.RequestNavigate(AppRegions.ViewRegion, typeof(AlbumView).FullName + q);
 }
        void INavigationAware.OnNavigatedFrom(NavigationContext navigationContext)
        {
            Microsoft.Practices.Prism.UriQuery q = new Microsoft.Practices.Prism.UriQuery();

            var selectedMoods = SelectedMoods.Select(t => WebUtility.HtmlEncode(t.Name)).ToArray();
            if (selectedMoods.Any())
            {
                q.Add("Moods", string.Join(",", selectedMoods));
            }

            var selectedStyles = SelectedStyles.Select(t => WebUtility.HtmlEncode(t.Name)).ToArray();
            if (selectedStyles.Any())
            {
                q.Add("Styles", string.Join(",", selectedStyles));
            }

            SetParameterValue("Tempo", q, Tempo.Minimum);
            SetParameterValue("Loudness", q, Loudness.Minimum);
            SetParameterValue("Danceability", q, Danceability.Minimum);
            SetParameterValue("Energy", q, Energy.Minimum);
            SetParameterValue("ArtistHotness", q, ArtistHotness.Minimum);
            SetParameterValue("ArtistFamiliarity", q, ArtistFamiliarity.Minimum);
            SetParameterValue("SongHotness", q, SongHotness.Minimum);

            var newUri = typeof(MainStationView).FullName + q;
            navigationContext.NavigationService.Journal.CurrentEntry.Uri = new Uri(newUri, UriKind.RelativeOrAbsolute);
        }