Esempio n. 1
0
        protected virtual int PopulateBrowseNodeImpl(TreeNode parentNode, int classId,
                                                     ContextMenuStrip menu,
                                                     string filter)
        {
            if (parentNode == null)
            {
                throw new ArgumentNullException(nameof(parentNode), Resources.NullParameterErrorMessage);
            }
            if (menu == null)
            {
                throw new ArgumentNullException(nameof(menu), Resources.NullParameterErrorMessage);
            }

            parentNode.RemoveNonFolderNodes();

            var systemType = RealmContext.GetSystemType(classId);

            var elementCount = 0;

            var objectList = RealmContext.GetPrimitives(systemType, classId);

            foreach (var obj in objectList)
            {
                if (!string.IsNullOrEmpty(filter) &&
                    obj.SystemName.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) == -1)
                {
                    continue;
                }

                var node = parentNode.Nodes.Add("node_" + obj.Id, obj.SystemName);
                node.Tag              = new EditorBrowseInfo(SystemType, obj.SystemName, classId, obj.Id);
                node.ImageKey         = obj.DisplayName;
                node.SelectedImageKey = obj.DisplayName;

                node.ContextMenuStrip = menu;
                ++elementCount;
            }

            return(elementCount);
        }