예제 #1
0
        public static void InsertItemInItemsControl(ItemsControl itemsControl, OutlinerNote itemToInsert, int insertionIndex)
        {
            OutlinerNote parent = itemsControl.DataContext as OutlinerNote;

            if (parent == null)
            {
                parent = (itemToInsert as OutlinerNote).GetRoot();
            }

            OutlinerNote newNote = new OutlinerNote(parent);

            newNote.Clone(itemToInsert);

            Window ownerWindow = TreeListView.FindParentWindow(itemsControl);

            if (ownerWindow == null)
            {
                throw new Exception("Window cannot be null");
            }

            DocumentHelpers.CopyNodesRecursively(newNote, itemToInsert);

            parent.SubNotes.Insert(insertionIndex, newNote);

            if (itemsControl is TreeListView)
            {
                ((TreeListView)itemsControl).MakeActive(newNote, -1, false);
            }
        }
예제 #2
0
        public override void Redo(OutlinerDocument document, TreeListView treeListView)
        {
            OutlinerNote newParent = document.FindOutlinerNoteById(__ParentNoteId);

            OutlinerNote newNote = new OutlinerNote(newParent);

            newNote.Clone(__SavedNote);
            DocumentHelpers.CopyNodesRecursively(newNote, __SavedNote);

            newParent.SubNotes.Insert(__Index, newNote);

            treeListView.MakeActive(newNote, __ColumnIndexBeforeUndo, false);
        }
예제 #3
0
        public override void Redo(OutlinerDocument document, TreeListView treeListView)
        {
            OutlinerNote note = document.FindOutlinerNoteById(__NoteId);

            OutlinerNote newParent = document.FindOutlinerNoteById(__ParentNoteIdAfter);

            Debug.Assert(newParent != null);
            note.Parent.SubNotes.Remove(note);

            OutlinerNote newNote = new OutlinerNote(newParent);

            newNote.Clone(note);
            DocumentHelpers.CopyNodesRecursively(newNote, note);
            newParent.SubNotes.Insert(__IndexAfter, newNote);
            treeListView.MakeActive(newNote, -1, false);
        }