Example #1
0
 public void DeleteSubItem(IUniverseSubItem subItem)
 {
     if (subItem is StoryViewModel)
     {
         StoryViewModel story = (StoryViewModel)subItem;
         Stories.Remove(story);
         if (story.Model.CategoryId != null)
         {
             CategoryViewModel cat = Categories.Single(i => i.Model.id == story.Model.CategoryId);
             cat.Stories.Remove(story);
             cat.UpdateStorySortIndices();
         }
         UpdateSubItemSortIndices();
     }
     else if (subItem is CategoryViewModel)
     {
         CategoryViewModel     cat     = (CategoryViewModel)subItem;
         List <StoryViewModel> stories = cat.Stories.ToList();
         foreach (var story in stories)
         {
             story.Model.CategoryId = null;
             story.SortIndex        = SubItems.Max(i => i.SortIndex) + 1;
             story.Save();
             SubItems.Add(story);
         }
         Categories.Remove(cat);
         SubItems.Remove(cat);
         UpdateSubItemSortIndices();
     }
 }
Example #2
0
        public void RemoveChild(IManifestNode child)
        {
            switch (child.GetType().Name)
            {
            case "ItemType":
            {
                var item = child as ItemType;
                if (SubItems.Contains(item))
                {
                    SubItems.Remove(item);
                    return;
                }
                break;
            }

            case "SequencingType":
            {
                if (Sequencing != null)
                {
                    Sequencing = null;
                    return;
                }
                break;
            }

            case "PresentationType":
            {
                if (presentation != null)
                {
                    presentation = null;
                    return;
                }
                break;
            }
            }
            throw new FireFlyException("Manifest item '{0}' not found", child);
        }
Example #3
0
 public virtual void OnObjectLeft(IItem obj)
 {
     SubItems.Remove(obj);
     ObjectLeft?.Invoke(this, obj);
 }