Beispiel #1
0
        /// <summary>
        /// Adds a an element vm to the children collection
        /// </summary>
        /// <param name="elementVM">Element vm.</param>
        public void AddChild(SerializationElementViewModel elementVM)
        {
            if (!HasLoadedChildren)
            {
                if (!HasDummyChild)
                {
                    this.childrenVMs.Add(DummyChild);
                }

                return;
            }

            // verify that node hasnt been added yet
            foreach (SerializationElementViewModel viewModel in this.childrenVMs)
            {
                if (viewModel.SerializationElement.Id == elementVM.SerializationElement.Id)
                {
                    return;
                }
            }

            this.childrenVMs.Add(elementVM);

            OnPropertyChanged("HasChildren");
        }
        private int GetChildIndex(SerializationClassViewModel viewModel, SerializationElementViewModel childVM)
        {
            // get index of childVM in the collection of children of viewModel
            for (int i = 0; i < viewModel.Children.Count; i++)
            {
                if (viewModel.Children[i] == childVM)
                {
                    return(i);
                }
            }

            return(-1);
        }
        /// <summary>
        /// Adds a an element vm to the children collection
        /// </summary>
        /// <param name="elementVM">Element vm.</param>
        public void AddChild(SerializationElementViewModel elementVM)
        {
            if (!HasLoadedChildren)
            {
                if (!HasDummyChild)
                    this.childrenVMs.Add(DummyChild);
                
                return;
            }

            // verify that node hasnt been added yet
            foreach (SerializationElementViewModel viewModel in this.childrenVMs)
                if (viewModel.SerializationElement.Id == elementVM.SerializationElement.Id)
                    return;

            this.childrenVMs.Add(elementVM);

            OnPropertyChanged("HasChildren");
        }
        private int GetChildIndex(SerializationClassViewModel viewModel, SerializationElementViewModel childVM)
        {
            // get index of childVM in the collection of children of viewModel
            for (int i = 0; i < viewModel.Children.Count; i++)
                if (viewModel.Children[i] == childVM)
                {
                    return i;
                }

            return -1;
        }