Пример #1
0
        public static bool cutPaste(ToDoItem itemToBeCut, ToDoItem parentOfItemToBeCut, ToDoItem pasteParent)
        {
            if (!canBeCutPastedHere(itemToBeCut, pasteParent))
            {
                return(false);
            }

            parentOfItemToBeCut.deleteChild(itemToBeCut);
            pasteParent.addChild(itemToBeCut);
            return(true);
        }
Пример #2
0
 private void deleteItemToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(String.Format("Are you sure you want to delete '{0}'?", targetTreeNodeUserInteraction.Text), this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
         == DialogResult.Yes)
     {
         ToDoItem itemToDelete       = targetToDoItem;
         ToDoItem parent             = parentOfTargetToDoItem;
         bool     hasExtraPermission = itemToDelete.isEmpty ||
                                       MessageBox.Show(String.Format("This item has child items that would also be deleted.\nAre you really really sure you want to delete '{0}'?", targetTreeNodeUserInteraction.Text), this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
         if (hasExtraPermission)
         {
             parent.deleteChild(itemToDelete);
             syncViewFromModel();
         }
     }
 }