Пример #1
0
        public BaseGroupElement GetOrCreateGroup(string path)
        {
            if (path == "")
            {
                return(Root);
            }

            s_Separators[0] = config.Separator;
            var parts = path.Split(s_Separators, StringSplitOptions.None);
            BaseGroupElement groupElement = Root;

            string currentPath = "";

            for (int i = 0; i < parts.Length; i++)
            {
                var title = parts[i];
                currentPath += title;

                groupElement.OnBeforeContentNeeded(this);
                bool any = false;
                for (int j = 0; j < groupElement.Children.Count; j++)
                {
                    var child = groupElement.Children[j];
                    if (child.Title == title && child is BaseGroupElement)
                    {
                        groupElement = (BaseGroupElement)child;
                        any          = true;
                        break;
                    }
                }

                if (!any)
                {
                    var g = new GroupElement(title, null);
                    groupElement.Children.Add(g);
                    groupElement = g;
                }

                currentPath += config.Separator;
            }

            return(groupElement);
        }
Пример #2
0
 /// <summary> Создание окна </summary>
 public Popup(IPopupConfig config)
 {
     this.config = config;
     Root        = new GroupElement(config.RootName, null);
     Search      = new GroupElement("Search", null);
 }