예제 #1
0
 public void RemoveTag(Tag tag, IList songs)
 {
     if (tag == null || songs.Count < 0)
     {
         return;
     }
     foreach (Song song in songs)
     {
         App.SongDb.UntagSong(song, tag);
     }
     OnPropertyChanged("Prediction");
     if (TagList.Any())
     {
         TagListIndex = 0;
     }
 }
예제 #2
0
        /// <summary>
        /// Dopo l'inizializzazione, dato un TAG recupera il suo indice per il contesto corrente.
        /// </summary>
        /// <param name="tag">Tag di cui identificare l'indice</param>
        /// <returns>L'indice del tag, inteso come identificativo del tag all'interno dell'oggetto corrente.</returns>
        public int GetTagIndex(string tag)
        {
            if (TagList == null || !TagList.Any())
            {
                HasValue = false;
                return(-1);
            }

            try
            {
                KeyValuePair <int, string> kvp = TagList.FirstOrDefault(k =>
                                                                        k.Value == tag);

                return(kvp.Key);
            }
            catch (Exception)
            {
            }

            return(-1);
        }