示例#1
0
        /// <summary>
        /// Supprime un noeud et ses fils.
        /// </summary>
        /// <param name="model">Le noeud à supprimer</param>
        public void DeleteNode(IHierarchyObject item)
        {
            if (item != null && item.GetParent() != null)
            {
                MessageBoxResult result = Util.MessageDisplayer.DisplayYesNoQuestion("Delete Item", "Do you want to delete node : " + item.ToString() + "?");
                if (result == MessageBoxResult.Yes)
                {
                    int index = item.GetPosition();
                    item.GetParent().RemoveChild(item);
                    item.GetParent().UpdateParents();

                    if (Change != null)
                    {
                        Change();
                    }
                    if (this.Root.GetItems().Count > 1)
                    {
                        selectNodeAfterDelete(item, index);
                    }
                }
            }
        }