Пример #1
0
        private void addDynamicParameterGroupNodeTo(ITreeNode node, string subGroupName, IEnumerable <IParameter> allParameters, Func <IParameter, string> keySelector, Func <string, bool> keyAvailableFunc)
        {
            var group = node.TagAsObject.DowncastTo <IGroup>();
            var allGroupParameters = _parameterGroupTask.ParametersInTopGroup(group.Name, allParameters);

            foreach (var parametersForNewGroup in allGroupParameters.GroupBy(keySelector).OrderBy(x => x.Key))
            {
                if (!keyAvailableFunc(parametersForNewGroup.Key))
                {
                    continue;
                }

                var compositeKey       = CoreConstants.CompositeNameFor(subGroupName, parametersForNewGroup.Key);
                var parameterContainer = parametersForNewGroup.First().ParentContainer;
                var dynamicNode        = _treeNodeFactory.CreateDynamicGroup(compositeKey, parametersForNewGroup.Key, parametersForNewGroup);
                dynamicNode.Icon = ApplicationIcons.IconByNameOrDefault(parameterContainer.Icon, node.Icon);
                node.AddChild(dynamicNode);
            }
        }