Exemple #1
0
        /// <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);
        }