internal void Set(SongModel currentSong)
        {
            var text = RootGrid.FindName("NowTitle") as TextBlock;
            text.Text = currentSong.Title;
            text = RootGrid.FindName("NowAlbum") as TextBlock;
            text.Text = currentSong.Album;
            text = RootGrid.FindName("NowArtists") as TextBlock;
            var converter = new ArtistsConverter();
            text.Text = (string)converter.Convert(currentSong.Artists, null, false, null);

        }
Exemple #2
0
 public ArtistsConverterTests()
 {
     _artistsConverter = new ArtistsConverter();
 }
 private void updateui()
 {
     Loved = CurrentSong.Loved;
     NowTitle.Text = CurrentSong.Title;
     NowAlbum.Text = CurrentSong.Album;
     GenresDetailsConverter converter = new GenresDetailsConverter();
     NowDetails.Text = (string)converter.Convert(CurrentSong, null, null, null);
     var con = new ArtistsConverter();
     NowArtist.Text = (string)con.Convert(CurrentSong.Artists, null, true, null);
     var c = PositionSlider.ThumbToolTipValueConverter as ThumbToolTipConveter;
     c.sParameter = CurrentSong.Duration.TotalSeconds;
     var d = new DurationValueConverter();
     TotalTimeBlock.Text = (string)d.Convert(CurrentSong.Duration, null, null, null);
     switch (CurrentSong.Rating)
     {
         case 0: NoStar.Begin(); break;
         case 1: OneStarSet.Begin(); break;
         case 2: TwoStarSet.Begin(); break;
         case 3: ThreeStarSet.Begin(); break;
         case 4: FourStarSet.Begin(); break;
         case 5: FiveStarSet.Begin(); break;
         default:
             break;
     }
     if (Loved)
     {
         LoveButtonLove.Begin();
     }
     else
     {
         LoveButtonNormal.Begin();
     }
 }
Exemple #4
0
 public ArtistsUtils(ArtistsConverter artistsConverter, AlbumsConverter albumsConverter, SpotifyApi spotifyApi)
 {
     _artistsConverter = artistsConverter;
     _albumsConverter  = albumsConverter;
     _spotifyApi       = spotifyApi;
 }
        private static TileContent CreateTile(SongModel item)
        {
            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
            var conver = new ArtistsConverter();
            var artists = (string)conver.Convert(item.Artists, null, true, null);
            TileContent c = new TileContent()
            {
                Visual = new TileVisual()
                {
                    Branding = TileBranding.NameAndLogo,
                    DisplayName = loader.GetString("TileNowDisplayName"),
                    TileWide = new TileBinding()
                    {
                        Branding = TileBranding.Name,

                        Content = new TileBindingContentAdaptive()
                        {
                            TextStacking = TileTextStacking.Center,
                            PeekImage = new TilePeekImage()
                            {
                                Source = new TileImageSource(item.AlbumArtwork)
                            },

                            Children =
                            {
                                  new TileText()
                                  {
                                       Text = item.Title,
                                       Style = TileTextStyle.Body
                                  },

                                  new TileText()
                                  {
                                        Text = artists,
                                        Style = TileTextStyle.CaptionSubtle
                                   },
                                  new TileText()
                                  {
                                      Text = item.Album,
                                      Style = TileTextStyle.Body
                                  }
                            }
                        }
                    },

                    TileLarge = new TileBinding()
                    {
                        Content = new TileBindingContentAdaptive()
                        {
                            TextStacking = TileTextStacking.Center,

                            Children =
                            {
                                new TileGroup()
                                {
                                    Children =
                                    {
                                        new TileSubgroup()
                                        {
                                            Weight = 1
                                        },
                                        new TileSubgroup()
                                        {
                                            Weight = 2,
                                            Children =
                                            {
                                                new TileImage()
                                                {
                                                    Source = new TileImageSource(item.AlbumArtwork)
                                                }
                                            }
                                        },
                                        new TileSubgroup()
                                        {
                                            Weight = 1
                                        }
                                    }
                                },


                                      new TileText()
                                      {
                                          Text = item.Title,
                                          Style = TileTextStyle.Body,
                                          Align = TileTextAlign.Center
                                      },

                                      new TileText()
                                      {
                                           Text = artists,
                                           Style = TileTextStyle.CaptionSubtle,
                                           Align = TileTextAlign.Center
                                      },
                                      new TileText()
                                      {
                                          Text = item.Album,
                                          Style = TileTextStyle.BodySubtle,
                                          Align = TileTextAlign.Center
                                      }
                                  }
                        }
                    },
                    TileMedium = new TileBinding()
                    {
                        Branding = TileBranding.Name,

                        Content = new TileBindingContentAdaptive()
                        {
                            TextStacking = TileTextStacking.Center,
                            PeekImage = new TilePeekImage()
                            {
                                Source = new TileImageSource(item.AlbumArtwork)
                            },
                            Children =
                            {
                                new TileText()
                                {
                                    Text = item.Title,
                                    Style = TileTextStyle.Body,
                                    Align = TileTextAlign.Center
                                },

                                new TileText()
                                {
                                    Text = artists,
                                    Style = TileTextStyle.CaptionSubtle,
                                    Align = TileTextAlign.Center
                                },
                                
                            }
                        }
                    }
                }
            };
            return c;
        }
        private void SemanticZoom_ViewChangeStarted(object sender, SemanticZoomViewChangedEventArgs e)
        {
            if (SemanticZoom.IsZoomedInViewActive)
            {
                SystemNavigationManager.GetForCurrentView().BackRequested += Zoom_BackRequested;
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                var list = AlbumSongsGroup.CreateGroup(e.SourceItem.Item as ArtistsKeyGroup<AlbumItem>, true);
                if (list == null)
                    SemanticZoom.IsZoomedInViewActive = false;
                ArtistDetailsSource.Source = list;
                ArtistDetailedView.ItemsSource = ArtistDetailsSource.View;
                SemanticZoom.CanChangeViews = false;
                var ArtistArtworkGroups = ArtistDetailedView.FindChildControl<RelativePanel>("ArtistArtworkGroups") as RelativePanel;
                var ArtistArtworkGroup0 = ArtistDetailedView.FindChildControl<RelativePanel>("ArtistArtworkGroup0") as RelativePanel;
                var ArtistArtworkGroup1 = ArtistDetailedView.FindChildControl<RelativePanel>("ArtistArtworkGroup1") as RelativePanel;
                var ArtistArtworkGroup2 = ArtistDetailedView.FindChildControl<RelativePanel>("ArtistArtworkGroup2") as RelativePanel;

                var ArtistName = ArtistDetailedView.FindChildControl<TextBlock>("ArtistName") as TextBlock;
                var ArtistDetails = ArtistDetailedView.FindChildControl<TextBlock>("ArtistDetails") as TextBlock;

                var artistsconverter = new ArtistsConverter();
                var artistdetailsconverter = new ArtistDetailsConverter();
                var artistdetails = artistdetailsconverter.Convert(list, null, null, null);
                var artists = artistsconverter.Convert(list[0].AlbumArtists, null, true, null);
                ArtistDetails.Text = (string)artistdetails;
                ArtistName.Text = (string)artists;
                var imagelist = ArtistArtworkGroups.GetImages();
                foreach (var image in imagelist)
                {
                    image.Source = null;
                }
                

                if (list.Count < 5)
                {
                    ArtistArtworkGroup0.Height = 400;
                    ArtistArtworkGroup1.Height = 400;
                    ArtistArtworkGroup2.Height = 400;
                }
                else if (list.Count < 9)
                {
                    ArtistArtworkGroup0.Height = 320;
                    ArtistArtworkGroup1.Height = 320;
                    ArtistArtworkGroup2.Height = 320;
                }
                else
                {
                    ArtistArtworkGroup0.Height = 240;
                    ArtistArtworkGroup1.Height = 240;
                    ArtistArtworkGroup2.Height = 240;
                }
                int i = 0;
                var placeholder = new BitmapImage();
                foreach (var image in imagelist)
                {
                    if (list.Count < i + 1)
                        image.Source = placeholder;
                    else
                        image.Source = new BitmapImage(new Uri(list[i].AlbumArtWork));
                    i++;
                }
            }
        }