Exemplo n.º 1
0
        private IFavorite UpdateInPersistence()
        {
            IFavorite source = this.CreatePrimaryFavorite();
            IFavorite copy   = this.CreateTestFavorite();

            this.PrimaryFavorites.Add(copy);
            copy.UpdateFrom(source);
            this.PrimaryFavorites.Update(copy);
            return(source);
        }
 private void OverwriteByConflictingName(string newName, IFavorite oldFavorite, IFavorite editedFavorite)
 {
     this.persistence.StartDelayedUpdate();
     // remember the edited favorite groups, because delete may also delete its groups,
     // if it is the last favorite in the group
     List<IGroup> groups = editedFavorite.Groups;
     editedFavorite.Name = newName;
     oldFavorite.UpdateFrom(editedFavorite);
     this.favorites.Update(oldFavorite);
     this.favorites.UpdateFavorite(oldFavorite, groups);
     this.favorites.Delete(editedFavorite);
     this.persistence.SaveAndFinishDelayedUpdate();
 }
Exemplo n.º 3
0
        private void OverwriteByConflictingName(string newName, IFavorite oldFavorite, IFavorite editedFavorite)
        {
            this.persistence.StartDelayedUpdate();
            // remember the edited favorite groups, because delete may also delete its groups,
            // if it is the last favorite in the group
            var groups = editedFavorite.Groups;

            editedFavorite.Name = newName;
            oldFavorite.UpdateFrom(editedFavorite);
            this.favorites.Update(oldFavorite);
            this.favorites.UpdateFavorite(oldFavorite, groups);
            this.favorites.Delete(editedFavorite);
            this.persistence.SaveAndFinishDelayedUpdate();
        }
Exemplo n.º 4
0
        private void ImportToPersistence(IFavorite favorite)
        {
            IFavorite oldFavorite = this.PersistedFavorites[favorite.Name];

            if (oldFavorite != null) // force to override old favorite
            {
                oldFavorite.UpdateFrom(favorite);
                this.PersistedFavorites.Update(oldFavorite);
            }
            else
            {
                this.PersistedFavorites.Add(favorite);
            }
        }