コード例 #1
0
 public void UpdateStoryInTree(StoryViewModel story)
 {
     if (story.Model.CategoryId == null)
     {
         var cat = Categories.SingleOrDefault(i => i.Stories.Contains(story));
         if (cat != null)
         {
             cat.Stories.Remove(story);
             cat.UpdateStorySortIndices();
         }
         if (!SubItems.Contains(story))
         {
             SubItems.Add(story);
         }
     }
     else
     {
         var cat = Categories.SingleOrDefault(i => i.Stories.Contains(story));
         if (cat != null && cat.Model.id != story.Model.CategoryId)
         {
             cat.Stories.Remove(story);
             cat.UpdateStorySortIndices();
         }
         else
         {
             cat = Categories.Single(i => i.Model.id == story.Model.CategoryId);
             if (!cat.Stories.Contains(story))
             {
                 cat.Stories.Add(story);
             }
         }
     }
 }
コード例 #2
0
ファイル: Item.cs プロジェクト: nbl852003/iudico
        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);
        }