Ejemplo n.º 1
0
        public SearchResults(string input, User us, MainWindow main)
        {
            InitializeComponent();

            mainWindow = main;
            user       = us;
            Thickness       SongBlockThickness = new Thickness(5, 2, 0, 0);
            SolidColorBrush whiteText          = new SolidColorBrush(System.Windows.Media.Colors.White);
            Database        db = new Database();

            stackResults.Children.Clear();
            resultList = db.GetSearchResults(input);
            TextBlock tbMessage = new TextBlock();

            tbMessage.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);
            tbMessage.FontSize   = 20;

            if (resultList.Count > 0)
            {
                // trim search criteria
                if (input.Trim() != "" && !input.Trim().Contains("_"))
                {
                    // here it shows the search results, shown like the screen design in FO
                    TextBlock tbTitle = new TextBlock();
                    tbTitle.Text       = "Top results for " + input;
                    tbTitle.FontSize   = 18;
                    tbTitle.FontWeight = FontWeights.Bold;
                    tbTitle.Margin     = new Thickness(10, 5, 10, 10);
                    tbTitle.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);
                    stackResults.Children.Add(tbTitle);

                    bool artistMatched = resultList.Where(item => item.Artist == input).Count() > 0 ? true : false;

                    TextBlock tbArtists = new TextBlock();
                    tbArtists.Text       = "Artists";
                    tbArtists.FontSize   = 18;
                    tbArtists.FontWeight = FontWeights.Bold;
                    tbArtists.Margin     = new Thickness(10, 0, 10, 10);
                    tbArtists.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);
                    stackResults.Children.Add(tbArtists);

                    // display matched artist
                    if (artistMatched)
                    {
                        // show hardcoded metallica picture
                        if (input == "Metallica")
                        {
                            Image image = new Image();
                            image.Width  = 100;
                            image.Height = 100;
                            image.HorizontalAlignment = HorizontalAlignment.Left;
                            image.Stretch             = Stretch.UniformToFill;
                            image.Source = new BitmapImage(new Uri(@"https://upload.wikimedia.org/wikipedia/commons/0/07/Metallica_at_The_O2_Arena_London_2008.jpg"));

                            TextBlock label = new TextBlock();
                            label.Text                = input;
                            label.FontSize            = 15;
                            label.Foreground          = new SolidColorBrush(System.Windows.Media.Colors.White);
                            label.HorizontalAlignment = HorizontalAlignment.Left;

                            image.Margin = new Thickness(10, 5, 0, 0);
                            label.Margin = new Thickness(10, 5, 0, 0);
                            stackResults.Children.Add(image);
                            stackResults.Children.Add(label);
                            SearchScroller.Margin = new Thickness(-10, 200, 0, 0);
                            SearchScroller.Height = 400;
                        }
                        else
                        {
                            Rectangle image = new Rectangle();
                            image.Width  = 100;
                            image.Height = 100;
                            image.HorizontalAlignment = HorizontalAlignment.Left;
                            image.Fill = new SolidColorBrush(System.Windows.Media.Colors.ForestGreen);

                            TextBlock label = new TextBlock();
                            label.Text                = input;
                            label.FontSize            = 15;
                            label.Foreground          = new SolidColorBrush(System.Windows.Media.Colors.White);
                            label.HorizontalAlignment = HorizontalAlignment.Left;

                            image.Margin = new Thickness(10, 5, 0, 0);
                            label.Margin = new Thickness(10, 5, 0, 0);
                            stackResults.Children.Add(image);
                            stackResults.Children.Add(label);
                            SearchScroller.Margin = new Thickness(-10, 200, 0, 0);
                            SearchScroller.Height = 400;
                        }
                    }
                    else
                    {
                        TextBlock tbNoArtistsFound = new TextBlock();
                        tbNoArtistsFound.Text       = "No artists found";
                        tbNoArtistsFound.FontSize   = 14;
                        tbNoArtistsFound.FontWeight = FontWeights.Bold;
                        tbNoArtistsFound.Margin     = new Thickness(10, 0, 10, 10);
                        tbNoArtistsFound.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);
                        stackResults.Children.Add(tbNoArtistsFound);
                    }

                    // show search results
                    for (int i = 0; i < resultList.Count; i++)
                    {
                        Song          playlistSong = resultList[i];
                        RowDefinition rowDef       = new RowDefinition();
                        rowDef.Name = $"Row_{i}";
                        SearchList.RowDefinitions.Add(rowDef);
                        RowDefinitionCollection RowNames = SearchList.RowDefinitions;
                        Array RowArray = RowNames.ToArray();

                        // Add the play button to the Songlist grid
                        var PlayButton = new Button
                        {
                            Name     = $"__{playlistSong.SongID}",
                            Content  = "Play",
                            Margin   = new Thickness(5, 0, 0, 5),
                            FontSize = 15,
                            Tag      = playlistSong
                        };
                        Grid.SetRow(PlayButton, i);
                        Grid.SetColumn(PlayButton, 0);
                        PlayButton.Click += PlaySongFromSearch;

                        // Add the Songname text block to the Songlist grid
                        var SongBlockName = new TextBlock
                        {
                            Name       = $"_{playlistSong.SongID}",
                            Text       = $"{playlistSong.SongName}",
                            Foreground = whiteText,
                            Margin     = SongBlockThickness,
                            FontSize   = 15
                        };
                        Grid.SetRow(SongBlockName, i);
                        Grid.SetColumn(SongBlockName, 1);

                        // Add the artist text block to the Songlist grid
                        var SongBlockArtist = new TextBlock
                        {
                            Name       = $"_{playlistSong.SongID}",
                            Text       = $"{playlistSong.Artist}",
                            Foreground = whiteText,
                            Margin     = SongBlockThickness,
                            FontSize   = 15
                        };
                        Grid.SetRow(SongBlockArtist, i);
                        Grid.SetColumn(SongBlockArtist, 2);

                        // Add the album text block to the Songlist grid
                        var SongBlockAlbum = new TextBlock
                        {
                            Name       = $"_{playlistSong.SongID}",
                            Text       = $"{playlistSong.Album}",
                            Foreground = whiteText,
                            Margin     = SongBlockThickness,
                            FontSize   = 15
                        };
                        Grid.SetRow(SongBlockAlbum, i);
                        Grid.SetColumn(SongBlockAlbum, 3);

                        // Add the year text block to the Songlist grid
                        var SongBlockYear = new TextBlock
                        {
                            Name       = $"_{playlistSong.SongID}",
                            Text       = $"{playlistSong.Year}",
                            Foreground = whiteText,
                            Margin     = SongBlockThickness,
                            FontSize   = 15
                        };
                        Grid.SetRow(SongBlockYear, i);
                        Grid.SetColumn(SongBlockYear, 4);

                        // Add the elements to the Songlist grid Children collection
                        SearchList.Children.Add(PlayButton);
                        SearchList.Children.Add(SongBlockName);
                        SearchList.Children.Add(SongBlockArtist);
                        SearchList.Children.Add(SongBlockAlbum);
                        SearchList.Children.Add(SongBlockYear);

                        ContextMenu menu = new ContextMenu();
                        menu.Background = new SolidColorBrush(System.Windows.Media.Colors.Black);
                        menu.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);

                        SearchList.MouseRightButtonDown += new MouseButtonEventHandler(SongContextMenuOpening);
                    }
                }
                else
                {
                    tbMessage.Text = "Please type in search criteria";
                    stackResults.Children.Add(tbMessage);
                }
            }
            else
            {
                tbMessage.Text = "No results found";
                stackResults.Children.Add(tbMessage);
            }
        }
        public DailyPlaylistPage(User BaseUser, MainWindow main)
        {
            InitializeComponent();
            user       = BaseUser;
            mainWindow = main;
            Recommender recommender = new Recommender(db);

            playlist      = recommender.getDailyPlaylist(user.UserID, "Daily Playlist");
            _PlaylistID   = playlist.playlistID;
            _PlaylistName = playlist.playlistName;
            Console.WriteLine(_PlaylistName);
            SongsInPlaylist = playlist.GetSongsInPlaylist();
            Thickness       SongBlockThickness = new Thickness(5, 2, 0, 0);
            SolidColorBrush whiteText          = new SolidColorBrush(System.Windows.Media.Colors.White);
            StackPanel      sp = new StackPanel();

            sp.Orientation = Orientation.Horizontal;

            var PlaylistBlock = new TextBlock
            {
                Text       = $"{playlist.playlistName}",
                FontSize   = 25,
                Foreground = whiteText,
                Margin     = new Thickness(0, 10, 0, 5),
            };
            var PlayPlaylistButton = new Button
            {
                Name            = $"_{_PlaylistID}",
                Content         = "Play",
                FontSize        = 30,
                Margin          = new Thickness(0, 10, 25, 0),
                Padding         = new Thickness(5),
                BorderThickness = new Thickness(0),
                Height          = 50,
                Width           = 100
            };

            PlayPlaylistButton.Click += PlayPlaylist;

            sp.Children.Add(PlayPlaylistButton);
            sp.Children.Add(PlaylistBlock);

            DailyPlaylistName.Children.Add(sp);

            OrderList.RowDefinitions.Add(new RowDefinition());

            // Add the Songname text block to the Songlist grid
            var OrderName = new TextBlock
            {
                Name       = "Name",
                Text       = "Name",
                Foreground = whiteText,
                Margin     = SongBlockThickness,
                FontSize   = 15
            };

            Grid.SetRow(OrderName, 0);
            Grid.SetColumn(OrderName, 1);

            // Add the artist text block to the Songlist grid
            var OrderArtist = new TextBlock
            {
                Name       = $"Artist",
                Text       = $"Artist",
                Foreground = whiteText,
                Margin     = SongBlockThickness,
                FontSize   = 15
            };

            Grid.SetRow(OrderArtist, 0);
            Grid.SetColumn(OrderArtist, 2);

            // Add the album text block to the Songlist grid
            var OrderAlbum = new TextBlock
            {
                Name       = $"Album",
                Text       = $"Album",
                Foreground = whiteText,
                Margin     = SongBlockThickness,
                FontSize   = 15
            };

            Grid.SetRow(OrderAlbum, 0);
            Grid.SetColumn(OrderAlbum, 3);

            // Add the year text block to the Songlist grid
            var OrderYear = new TextBlock
            {
                Name       = $"Year",
                Text       = $"Year",
                Foreground = whiteText,
                Margin     = SongBlockThickness,
                FontSize   = 15
            };

            Grid.SetRow(OrderYear, 0);
            Grid.SetColumn(OrderYear, 4);

            // Add the elements to the Songlist grid Children collection
            OrderList.Children.Add(OrderName);
            OrderList.Children.Add(OrderArtist);
            OrderList.Children.Add(OrderAlbum);
            OrderList.Children.Add(OrderYear);

            //Adds the necessary amount of rows for the playlist
            for (int i = 0; i < playlist.songPlaylist.Count; i++)
            {
                Song          playlistSong = playlist.songPlaylist[i];
                RowDefinition rowDef       = new RowDefinition();
                rowDef.Name = $"Row_{i}";
                DailySongList.RowDefinitions.Add(rowDef);
                RowDefinitionCollection RowNames = DailySongList.RowDefinitions;
                Array RowArray = RowNames.ToArray();

                // Add the play button to the Songlist grid
                var PlayButton = new Button
                {
                    Name            = $"__{playlistSong.SongID}",
                    Content         = "Play",
                    Margin          = new Thickness(5, 0, 0, 5),
                    Padding         = new Thickness(5),
                    BorderThickness = new Thickness(0),
                    FontSize        = 15,
                    Tag             = playlistSong
                };
                Grid.SetRow(PlayButton, i);
                Grid.SetColumn(PlayButton, 0);
                PlayButton.Click += PlaySongFromPlaylist;

                // Add the Songname text block to the Songlist grid
                var SongBlockName = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.SongName}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockName, i);
                Grid.SetColumn(SongBlockName, 1);

                // Add the artist text block to the Songlist grid
                var SongBlockArtist = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.Artist}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockArtist, i);
                Grid.SetColumn(SongBlockArtist, 2);

                // Add the album text block to the Songlist grid
                var SongBlockAlbum = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.Album}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockAlbum, i);
                Grid.SetColumn(SongBlockAlbum, 3);

                // Add the year text block to the Songlist grid
                var SongBlockYear = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.Year}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockYear, i);
                Grid.SetColumn(SongBlockYear, 4);

                // Add the elements to the Songlist grid Children collection
                DailySongList.Children.Add(PlayButton);
                DailySongList.Children.Add(SongBlockName);
                DailySongList.Children.Add(SongBlockArtist);
                DailySongList.Children.Add(SongBlockAlbum);
                DailySongList.Children.Add(SongBlockYear);

                ContextMenu menu = new ContextMenu();
                menu.Background = new SolidColorBrush(System.Windows.Media.Colors.Black);
                menu.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);

                DailySongList.ContextMenu           = null;
                DailySongList.MouseRightButtonDown += new MouseButtonEventHandler(SongContextMenuOpening);
            }
        }
Ejemplo n.º 3
0
        public void InitialiseQueuePage()
        {
            InitializeComponent();
            QueueList.Children.Clear();
            songs = new List <Song>(MusicQueue.songQueue);

            Thickness       SongBlockThickness = new Thickness(5, 2, 0, 0);
            SolidColorBrush whiteText          = new SolidColorBrush(System.Windows.Media.Colors.White);

            for (int i = 0; i < songs.Count; i++)
            {
                Song          song   = songs[i];
                RowDefinition rowDef = new RowDefinition();
                rowDef.Name = $"Row_{i}";
                QueueList.RowDefinitions.Add(rowDef);
                RowDefinitionCollection RowNames = QueueList.RowDefinitions;
                Array RowArray = RowNames.ToArray();

                // Add the play button to the Songlist grid
                var PlayButton = new Button
                {
                    Name     = $"__{song.SongID}",
                    Content  = "Play",
                    Margin   = new Thickness(5, 0, 0, 5),
                    FontSize = 15,
                    Tag      = song
                };
                Grid.SetRow(PlayButton, i);
                Grid.SetColumn(PlayButton, 0);
                PlayButton.Click += PlaySongFromQueue;

                // Add the Songname text block to the Songlist grid
                var SongBlockName = new TextBlock
                {
                    Name       = $"_{song.SongID}",
                    Text       = $"{song.SongName}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockName, i);
                Grid.SetColumn(SongBlockName, 1);

                // Add the artist text block to the Songlist grid
                var SongBlockArtist = new TextBlock
                {
                    Name       = $"_{song.SongID}",
                    Text       = $"{song.Artist}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockArtist, i);
                Grid.SetColumn(SongBlockArtist, 2);

                // Add the album text block to the Songlist grid
                var SongBlockAlbum = new TextBlock
                {
                    Name       = $"_{song.SongID}",
                    Text       = $"{song.Album}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockAlbum, i);
                Grid.SetColumn(SongBlockAlbum, 3);

                // Add the year text block to the Songlist grid
                var SongBlockYear = new TextBlock
                {
                    Name       = $"_{song.SongID}",
                    Text       = $"{song.Year}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockYear, i);
                Grid.SetColumn(SongBlockYear, 4);

                // Add the elements to the Songlist grid Children collection
                QueueList.Children.Add(PlayButton);
                QueueList.Children.Add(SongBlockName);
                QueueList.Children.Add(SongBlockArtist);
                QueueList.Children.Add(SongBlockAlbum);
                QueueList.Children.Add(SongBlockYear);
                QueueToPlaylist.MouseLeftButtonUp += AddQueueToPlaylist;
            }
        }
Ejemplo n.º 4
0
        public void reinitialize(Playlist playlist, MainWindow main, User BaseUser)
        {
            InitializeComponent();
            SongList.Children.Clear();
            PlaylistName.Children.Clear();
            DeletePlaylist.Children.Clear();
            RecommendedSongList.Children.Clear();

            Recommender recommender = new Recommender(db);

            RecommendedSongs = recommender.GetRecommendedSongsForPlaylist(playlist, 5);
            RecommendedAds   = recommender.GetRecommendedAdsFromPlaylist(playlist);
            playlistToUse    = playlist;
            mainWindow       = main;
            user             = BaseUser;
            _PlaylistName    = playlistToUse.playlistName;
            _PlaylistID      = playlistToUse.playlistID;
            switch (orderBy)
            {
            case "name":
                playlistToUse.songPlaylist = playlistToUse.songPlaylist.OrderBy(x => x.SongName).ToList();
                break;

            case "album":
                playlistToUse.songPlaylist = playlistToUse.songPlaylist.OrderBy(x => x.Album).ToList();
                break;

            case "year":
                playlistToUse.songPlaylist = playlistToUse.songPlaylist.OrderBy(x => x.Year).ToList();
                break;

            case "artist":
                playlistToUse.songPlaylist = playlistToUse.songPlaylist.OrderBy(x => x.Artist).ToList();
                break;

            default:
                playlistToUse.songPlaylist = playlistToUse.songPlaylist.OrderBy(x => x.SongID).ToList();
                break;
            }
            user            = BaseUser;
            SongsInPlaylist = playlist.GetSongsInPlaylist();
            Thickness       SongBlockThickness = new Thickness(5, 2, 0, 0);
            SolidColorBrush whiteText          = new SolidColorBrush(System.Windows.Media.Colors.White);
            StackPanel      sp = new StackPanel();

            sp.Orientation = Orientation.Horizontal;
            StackPanel sp1 = new StackPanel();

            sp1.Orientation = Orientation.Horizontal;
            var PlaylistBlock = new TextBlock
            {
                Text       = $"{playlistToUse.playlistName}",
                FontSize   = 25,
                Foreground = whiteText,
                Margin     = new Thickness(0, 10, 0, 5)
            };
            var PlayPlaylistButton = new Button
            {
                Name            = $"_{_PlaylistID}",
                Content         = "Play",
                FontSize        = 30,
                Margin          = new Thickness(10, 10, 25, 0),
                Padding         = new Thickness(5),
                BorderThickness = new Thickness(0),
                Height          = 50,
                Width           = 100
            };

            PlayPlaylistButton.Click += PlayPlaylist;
            var DeletePlaylistButton = new Button
            {
                Name     = $"Delete_{_PlaylistID}",
                Content  = "Delete",
                Tag      = playlistToUse,
                FontSize = 15,
                Margin   = new Thickness(10, 10, 0, 5)
            };

            DeletePlaylistButton.Click += DeletePlaylistClick;

            var RenamePlaylistButton = new Button
            {
                Name     = $"Rename_{_PlaylistID}",
                Content  = "Rename",
                Tag      = playlistToUse,
                FontSize = 15,
                Margin   = new Thickness(-50, 10, 0, 5)
            };

            RenamePlaylistButton.Click += RenamePlaylist;

            sp.Children.Add(PlayPlaylistButton);
            sp.Children.Add(PlaylistBlock);
            sp1.Children.Add(RenamePlaylistButton);
            sp1.Children.Add(DeletePlaylistButton);
            DeletePlaylist.Children.Add(sp1);
            PlaylistName.Children.Add(sp);

            OrderList.RowDefinitions.Add(new RowDefinition());

            // Add the Songname text block to the Songlist grid
            var OrderName = new TextBlock
            {
                Name       = "Name",
                Text       = "Name",
                Foreground = whiteText,
                Margin     = SongBlockThickness,
                FontSize   = 15
            };

            Grid.SetRow(OrderName, 0);
            Grid.SetColumn(OrderName, 1);
            OrderName.MouseLeftButtonUp += (sender, args) => { _orderBy = "name"; OnLabelClick(sender, args); };

            // Add the artist text block to the Songlist grid
            var OrderArtist = new TextBlock
            {
                Name       = $"Artist",
                Text       = $"Artist",
                Foreground = whiteText,
                Margin     = SongBlockThickness,
                FontSize   = 15
            };

            Grid.SetRow(OrderArtist, 0);
            Grid.SetColumn(OrderArtist, 2);
            OrderArtist.MouseLeftButtonUp += (sender, args) => { _orderBy = "artist"; OnLabelClick(sender, args); };

            // Add the album text block to the Songlist grid
            var OrderAlbum = new TextBlock
            {
                Name       = $"Album",
                Text       = $"Album",
                Foreground = whiteText,
                Margin     = SongBlockThickness,
                FontSize   = 15
            };

            Grid.SetRow(OrderAlbum, 0);
            Grid.SetColumn(OrderAlbum, 3);
            OrderAlbum.MouseLeftButtonUp += (sender, args) => { _orderBy = "album"; OnLabelClick(sender, args); };

            // Add the year text block to the Songlist grid
            var OrderYear = new TextBlock
            {
                Name       = $"Year",
                Text       = $"Year",
                Foreground = whiteText,
                Margin     = SongBlockThickness,
                FontSize   = 15
            };

            Grid.SetRow(OrderYear, 0);
            Grid.SetColumn(OrderYear, 4);
            OrderYear.MouseLeftButtonUp += (sender, args) => { _orderBy = "year"; OnLabelClick(sender, args); };

            // Add the elements to the Songlist grid Children collection
            OrderList.Children.Add(OrderName);
            OrderList.Children.Add(OrderArtist);
            OrderList.Children.Add(OrderAlbum);
            OrderList.Children.Add(OrderYear);

            //Adds the necessary amount of rows for the playlist
            for (int i = 0; i < SongsInPlaylist.Count; i++)
            {
                Song          playlistSong = SongsInPlaylist[i];
                RowDefinition rowDef       = new RowDefinition();
                rowDef.Name = $"Row_{i}";
                SongList.RowDefinitions.Add(rowDef);
                RowDefinitionCollection RowNames = SongList.RowDefinitions;
                Array RowArray = RowNames.ToArray();

                SolidColorBrush btnTextColor = new SolidColorBrush();
                btnTextColor.Color = Color.FromRgb(0, 0, 0);

                // Add the play button to the Songlist grid
                var PlayButton = new Button
                {
                    Name            = $"__{playlistSong.SongID}",
                    Content         = "Play",
                    Margin          = new Thickness(5, 0, 0, 5),
                    Padding         = new Thickness(5),
                    BorderThickness = new Thickness(0),
                    FontSize        = 15,

                    Tag = playlistSong
                };
                Grid.SetRow(PlayButton, i);
                Grid.SetColumn(PlayButton, 0);
                PlayButton.Click += PlaySongFromPlaylist;

                // Add the Songname text block to the Songlist grid
                var SongBlockName = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.SongName}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockName, i);
                Grid.SetColumn(SongBlockName, 1);

                // Add the artist text block to the Songlist grid
                var SongBlockArtist = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.Artist}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockArtist, i);
                Grid.SetColumn(SongBlockArtist, 2);

                // Add the album text block to the Songlist grid
                var SongBlockAlbum = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.Album}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockAlbum, i);
                Grid.SetColumn(SongBlockAlbum, 3);

                // Add the year text block to the Songlist grid
                var SongBlockYear = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.Year}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockYear, i);
                Grid.SetColumn(SongBlockYear, 4);

                // Add the elements to the Songlist grid Children collection
                SongList.Children.Add(PlayButton);
                SongList.Children.Add(SongBlockName);
                SongList.Children.Add(SongBlockArtist);
                SongList.Children.Add(SongBlockAlbum);
                SongList.Children.Add(SongBlockYear);

                SongList.MouseRightButtonDown -= SongContextMenuOpening;
                SongList.MouseRightButtonDown += new MouseButtonEventHandler(SongContextMenuOpening);
            }

            List <Song> RecommendedSongsAndAds = new List <Song>(RecommendedAds);

            foreach (Song song in RecommendedSongs)
            {
                RecommendedSongsAndAds.Add(song);
            }

            for (int i = 0; i < RecommendedSongsAndAds.Count(); i++)
            {
                int           amount       = RecommendedAds.Count;
                Song          playlistSong = RecommendedSongsAndAds[i];
                RowDefinition rowDef       = new RowDefinition();
                rowDef.Name = $"Row_{i}";
                RecommendedSongList.RowDefinitions.Add(rowDef);
                RowDefinitionCollection RowNames = RecommendedSongList.RowDefinitions;
                Array RowArray = RowNames.ToArray();

                // Add the play button to the Songlist grid
                var PlayButton = new Button
                {
                    Name            = $"__{playlistSong.SongID}",
                    Content         = "Play",
                    Margin          = new Thickness(5, 0, 0, 5),
                    Padding         = new Thickness(5),
                    BorderThickness = new Thickness(0),
                    FontSize        = 15,
                    Tag             = playlistSong
                };
                Grid.SetRow(PlayButton, i);
                Grid.SetColumn(PlayButton, 0);
                PlayButton.Click += (ob, s) => { db.AddCreditsFromSongClick(true, playlistSong.SongID); PlaySongFromPlaylist(ob, s); };

                var SongBlockName = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                // Add the Songname text block to the Songlist grid
                if (i < amount)
                {
                    SongBlockName.Text = $"(Ad) {playlistSong.SongName}";
                    db.UpdateTimesDisplayedAd(playlistSong.SongID);
                }
                else
                {
                    SongBlockName.Text = $"{playlistSong.SongName}";
                }
                Grid.SetRow(SongBlockName, i);
                Grid.SetColumn(SongBlockName, 1);

                // Add the artist text block to the Songlist grid
                var SongBlockArtist = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.Artist}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockArtist, i);
                Grid.SetColumn(SongBlockArtist, 2);

                // Add the album text block to the Songlist grid
                var SongBlockAlbum = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.Album}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockAlbum, i);
                Grid.SetColumn(SongBlockAlbum, 3);

                // Add the year text block to the Songlist grid
                var SongBlockYear = new TextBlock
                {
                    Name       = $"_{playlistSong.SongID}",
                    Text       = $"{playlistSong.Year}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockYear, i);
                Grid.SetColumn(SongBlockYear, 4);

                // Add the elements to the Songlist grid Children collection
                RecommendedSongList.Children.Add(PlayButton);
                RecommendedSongList.Children.Add(SongBlockName);
                RecommendedSongList.Children.Add(SongBlockArtist);
                RecommendedSongList.Children.Add(SongBlockAlbum);
                RecommendedSongList.Children.Add(SongBlockYear);

                ContextMenu menu = new ContextMenu();
                menu.Background = new SolidColorBrush(System.Windows.Media.Colors.Black);
                menu.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);

                RecommendedSongList.ContextMenu           = null;
                RecommendedSongList.MouseRightButtonDown += new MouseButtonEventHandler(SongContextMenuFromRecommended);
            }
        }