public IdeaNote GetChildlessCopy() { IdeaNote copy = GetCopy(); copy.Ideas = new ObservableCollection <IdeaNote>(); return(copy); }
private TreeViewItem GetTreeViewItemFromIdeaNote(ItemsControl items, Stack <IdeaNote> stack) { if (items == null || stack == null || stack.Count == 0) { return(null); } IdeaNote note = stack.Pop(); TreeViewItem item = items.ItemContainerGenerator.ContainerFromItem(note) as TreeViewItem; if (item == null) { return(null); } if (stack.Count == 0) { return(item); } else { item.IsExpanded = true; UpdateLayout(); return(GetTreeViewItemFromIdeaNote(item, stack)); } }
public IdeaNote GetCopy() { IdeaNote copy = (IdeaNote)Clone(); copy.IsSelected = false; copy.IsExpanded = false; return(copy); }
public void InsertChild(int index, IdeaNote idea) { if (idea.RootSaveFile != null) { idea.RootSaveFile.Ideas.Remove(idea); idea.RootSaveFile = null; } if (idea.Parent != null) { idea.Parent.Ideas.Remove(idea); } idea.Parent = this; Ideas.Insert(index, idea); }
public static IdeaNote FromFile(string path) { IdeaNote noteFile = null; using (Stream file = File.OpenRead(path)) { using (var gzip = new GZipStream(file, CompressionMode.Decompress, true)) { noteFile = Serializer.Deserialize <IdeaNote>(gzip); } } return(noteFile); }
public void AddIdea(IdeaNote idea) { if (idea.RootSaveFile != null) { idea.RootSaveFile.Ideas.Remove(idea); } if (idea.Parent != null) { idea.Parent.Ideas.Remove(idea); idea.Parent = null; } idea.RootSaveFile = this; Ideas.Add(idea); }
public void AddChild(IdeaNote idea) { if (idea == this) { throw new Exception("Cannot add an IdeaNote as its own child."); } if (idea.RootSaveFile != null) { idea.RootSaveFile.Ideas.Remove(idea); idea.RootSaveFile = null; } if (idea.Parent != null) { idea.Parent.Ideas.Remove(idea); } idea.Parent = this; Ideas.Add(idea); }