当前位置: 首页>>代码示例>>C#>>正文


C# IData.GetIcon方法代码示例

本文整理汇总了C#中IData.GetIcon方法的典型用法代码示例。如果您正苦于以下问题:C# IData.GetIcon方法的具体用法?C# IData.GetIcon怎么用?C# IData.GetIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IData的用法示例。


在下文中一共展示了IData.GetIcon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildElement

        private Element BuildElement(IData data, 
            DynamicValuesHelperReplaceContext replaceContext,
            TreeNodeDynamicContext dynamicContext,
            bool localizationEnabled,
            List<object> itemKeys,
            ref IEnumerable<object> keysJoinedByParentFilters,
            EntityToken parentEntityToken
            )
        {
            replaceContext.CurrentDataItem = data;
            
            object keyValue = this.KeyPropertyInfo.GetValue(data, null);

            bool itemLocalizationEnabledAndForeign = localizationEnabled && !data.DataSourceId.LocaleScope.Equals(UserSettings.ActiveLocaleCultureInfo);

            if (itemLocalizationEnabledAndForeign && itemKeys.Contains(keyValue)) return null;

            var currentEntityToken = data.GetDataEntityToken();

            var element = new Element(new ElementHandle
            (
                dynamicContext.ElementProviderName,
                currentEntityToken,
                dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken)
            ));


            bool hasChildren;
            bool isDisabled = false;
            ResourceHandle icon, openedIcon;

            if (itemLocalizationEnabledAndForeign)
            {
                hasChildren = false;
                isDisabled = !data.IsTranslatable();

                if (this.Icon != null)
                {
                    icon = this.Icon;
                    openedIcon = this.OpenedIcon;
                }
                else
                {
                    icon = data.GetForeignIcon();
                    openedIcon = icon;
                }
            }
            else
            {
                if (this.Display != LeafDisplayMode.Auto)
                {
                    hasChildren = ChildNodes.Any();
                }
                else
                {
                    hasChildren = ChildNodes.OfType<SimpleElementTreeNode>().Any();

                    if (!hasChildren)
                    {
                        if (keysJoinedByParentFilters != null)
                        {
                            keysJoinedByParentFilters = keysJoinedByParentFilters.Evaluate();

                            hasChildren = keysJoinedByParentFilters.Contains(keyValue);
                        }
                    }

                    // Checking children filtered by FunctionFilters
                    if (!hasChildren)
                    {
                        foreach (var childNode in this.ChildNodes.OfType<DataElementsTreeNode>()
                            .Where(n => n.FilterNodes.OfType<FunctionFilterNode>().Any()))
                        {
                            var newDynamicContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down)
                            {
                                ElementProviderName = dynamicContext.ElementProviderName,
                                Piggybag = dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken),
                                CurrentEntityToken = currentEntityToken
                            };

                            if (childNode.GetDataset(newDynamicContext, false).DataItems.Any())
                            {
                                hasChildren = true;
                                break;
                            }
                        }
                    }
                }

                if (this.Icon != null)
                {
                    icon = this.Icon;
                    openedIcon = this.OpenedIcon;
                }
                else
                {
                    openedIcon = icon = data.GetIcon();
                }
            }

//.........这里部分代码省略.........
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:101,代码来源:DataElementsTreeNode.cs


注:本文中的IData.GetIcon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。