/// <summary> /// Change the name of this playlist /// </summary> /// <param name="newName"></param> public void Rename( string newName ) { Name = newName; // Update the item in the model. No need to wait for this. DbAccess.UpdateAsync( this ); }
/// <summary> /// Update the existing tag with new properties /// </summary> /// <param name="newTagDetails"></param> public void UpdateTagDetails(Tag newTagDetails) { // Update the details for the existing Tag and save it // Save the old names to send in the message string oldName = Name; string oldShortName = ShortName; Name = newTagDetails.Name; ShortName = newTagDetails.ShortName; TagOrder = newTagDetails.TagOrder; Synchronise = newTagDetails.Synchronise; if (PersistTag == true) { // No need to wait for this DbAccess.UpdateAsync(this); } // The Tags class maintains lookup tables using the tag details so inform it of the change Tags.TagDetailsChanged(this, oldName, oldShortName); // Let everyone know about this new TagDetailsChangedMessage() { ChangedTag = this }.Send(); }
/// <summary> /// Add a collection of genre string to this population /// </summary> /// <param name="genresToAdd"></param> public void AddGenres(IEnumerable <string> genresToAdd) { Genres.AddRange(genresToAdd); // Reform the delimited string and save it to storage GenreString = string.Join(';', Genres); // No need to wait for this DbAccess.UpdateAsync(this); }
/// <summary> /// Update the source and save it to storaage /// </summary> /// <param name="newSource"></param> public void UpdateSource(Source newSource) { Name = newSource.Name; FolderName = newSource.FolderName; IPAddress = newSource.IPAddress; PortNo = newSource.PortNo; AccessMethod = newSource.AccessMethod; // Make sure that member variable that depend on this data are also updated InitialiseAccess(); // No need to wait for this to be written to storage DbAccess.UpdateAsync(this); }
/// <summary> /// Adjust the tag index numbers to match the indexes in the collection /// </summary> /// <param name="thePlaylist"></param> public void AdjustTagIndexes() { // The track numbers in the PlaylistItems must be updated to match their index in the collection for (int index = 0; index < TaggedAlbums.Count; ++index) { TaggedAlbum itemToCheck = TaggedAlbums[index]; if (itemToCheck.TagIndex != index) { itemToCheck.TagIndex = index; // Update the item in the model. No need to wait for this. DbAccess.UpdateAsync(itemToCheck); } } }
/// <summary> /// Update this Autoplay's options with those in the new Autoplay /// </summary> /// <param name="newAutoplay"></param> public void UpdateOptions(Autoplay newAutoplay) { bool optionsChanged = (newAutoplay.Spread != Spread) || (newAutoplay.Target != Target) || (newAutoplay.Weight != Weight) || (newAutoplay.FastSpreadLimit != FastSpreadLimit); Spread = newAutoplay.Spread; Target = newAutoplay.Target; Weight = newAutoplay.Weight; FastSpreadLimit = newAutoplay.FastSpreadLimit; if (optionsChanged == true) { // Update the record. No need to wait. DbAccess.UpdateAsync(this); } }