/// <summary> /// Ajoute un nouveau noeud fils au noeud passé en paramètre. /// </summary> /// <param name="parent">Le noeud auquel il fau ajouter un fils</param> /// <param name="name">le nom du noeud</param> /// <returns>Le nouveau noed créé</returns> public virtual PeriodName AddNode(PeriodName parent, string name = "") { PeriodName child = GetNewTreeViewModel(); if (name != "") { child.name = name; } if (parent != null) { parent.AddChild(child); parent.UpdateParents(); } else { if (this.Root != null) { this.Root.AddChild(child); this.Root.SwichtPosition(defaultValue, child); } else { return(null); } } SetSelectedPeriod(defaultValue); if (Changed != null) { Changed(); } return(child); }
/// <summary> /// Cette méthod ajoute les éléments du presse-papier à l'arbre. /// </summary> /// <param name="attribute"></param> /// <param name="parent"></param> private void AddToTreeCopiedElements(PeriodName period, PeriodName parent = null) { this.Root.ForgetChild(defaultValue); if (parent != null) { parent.AddChild(period); } else { this.Root.AddChild(period); } if (Changed != null) { Changed(); } this.Root.AddChild(defaultValue); }