Esempio n. 1
0
        private void OnSaved()
        {
            string oldCategory   = this.Parent.Parent.Text.ToLower();
            string oldSubsection = this.Parent.Text.ToLower();

            string newCategory   = _design.Category.ToLower();
            string newSubsection = _design.Subsection.ToLower();

            if (oldCategory == newCategory)
            {
                if (oldSubsection == newSubsection)
                {
                    this.Text = _design.Name;
                }
                else
                {
                    CategoryNode category = (CategoryNode)this.Parent.Parent;
                    (this.Parent as SubsectionNode).RemoveNode(this.Index);
                    category.AddDesign(_design);
                }
            }
            else
            {
                int index = FindCategoryNode(_design.Category.ToLower());

                CategoryNode category = null;

                if (index != -1)
                {
                    category = (CategoryNode)this.TreeView.Nodes[index];
                }
                else
                {
                    category = new CategoryNode(_design.Category);
                    this.TreeView.Nodes.Add(category);
                }

                category.AddDesign(_design);
                (this.Parent as SubsectionNode).RemoveNode(this.Index);
            }
        }