Beispiel #1
0
        private async void addToBlacklist(string search)
        {
            //Check if the string is empty
            if (string.IsNullOrEmpty(search))
            {
                return;
            }

            switch (cbx_Type.SelectedIndex)
            {
            case 0:
                // Spotify Artist Blacklist
                // If the API is not connected just don't do anything?
                if (APIHandler.spotify == null)
                {
                    MessageDialogResult msgResult = await this.ShowMessageAsync("Notification", "Spotify is not connected. You need to connect to Spotify in order to fill the blacklist.", MessageDialogStyle.Affirmative);

                    return;
                }


                // Perform a search via the spotify API
                SpotifyAPI.Web.Models.SearchItem searchItem = APIHandler.GetArtist(search);
                if (searchItem.Artists.Items.Count <= 0)
                {
                    return;
                }

                SpotifyAPI.Web.Models.FullArtist fullartist = searchItem.Artists.Items[0];

                foreach (object item in ListView_Blacklist.Items)
                {
                    if (item.ToString() == fullartist.Name)
                    {
                        return;
                    }
                }
                ListView_Blacklist.Items.Add(fullartist.Name);
                break;

            case 1:
                ListView_UserBlacklist.Items.Add(search);
                break;
            }

            SaveBlacklist();
        }
Beispiel #2
0
 public ArtistModel(string name, string id, SpotifyAPI.Web.Models.FullArtist artist)
 {
     Name   = name;
     Id     = id;
     Artist = artist;
 }