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


C# INode.Get方法代码示例

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


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

示例1: BuildEntitySelector

        private static EntityListController BuildEntitySelector(INode rootNode, Func<IParentNode, IAccessor<string>> fnGetText, RootNode actualRootNode, IParentNode dynamicData)
        {
            var entityList = rootNode.Get<IEntityList<IUIEntityRow>>();
            var selector = new EntitySelector {Rows = entityList.Rows, SelectedRow = entityList.Rows.First()};
            var rowSelector = dynamicData.Nodes("rowSelector").First();
            rowSelector.Register(selector);

            var textOutput = dynamicData.Nodes("textOutput").First().Get<IAccessor<string>>();
            var nodeMessage = new NodeMessage
                                  {
                                      Target = textOutput,
                                      MessagePredicate = (message => message.Method.Name == "set_SelectedRow"),
                                      TargetDelegate = (Func<IInvocation, Action<IAccessor<string>>>)
                                                       (row => accessor => accessor.Value = fnGetText(((IEntityRow)row.Arguments.First()).Context).Value)
                                                       //TODO: 1. This seems a little complicated...
                                                       //Somebody, or something in the xml needs to clue the framework in to how to do this wiring.
                                  };
            actualRootNode.InstallHook(nodeMessage);

            var _entityListController = new EntityListController {EntityList = rowSelector.Get<IEntitySelector>()};
            _entityListController.Beginning();

            return _entityListController;
        }
开发者ID:mcwatt77,项目名称:vimcontrols,代码行数:24,代码来源:DynamicTemplate.cs

示例2: ProcessAttribute

        private void ProcessAttribute(IParentNode data, IParentNode parent, INode node, object newObj)
        {
            var propToSet = newObj.GetType().GetProperties().SingleOrDefault(prop => prop.Name.ToLower() == node.Name.ToLower());
            var get = node.Get<IAccessor<string>>();

            if (node.Name == "id")
            {
                _nodeLookups[get.Value] = parent;
                return;
            }
            if (get.Value[0] != '[' && get.Value[0] != '{')
            {
                if (propToSet != null)
                {
                    propToSet.SetValue(newObj, get.Value, null);
                }
                return;
            }

            var path = Decoder.FromPath(get.Value);
            //if both local and data are set, this means that each of the children in Local gets each instance of Data
            if (path.Local != null && path.Data != null)
            {
                //TODO: Get all of this expression processing into a separate class.
                //Might even wrap some of the functionality in a localized class
                var fnData = path.Data.Compile();
                var dataRows = fnData.DynamicInvoke(data);

                var fnLocal = path.Local.Compile();
                var localRows = ((IEnumerable)fnLocal.DynamicInvoke(parent)).Cast<IParentNode>();
                var localRow = localRows.Single();

                var isEnumerable = typeof (System.Collections.IEnumerable).IsAssignableFrom(dataRows.GetType());
                var propIsEnumerable = typeof (System.Collections.IEnumerable).IsAssignableFrom(propToSet.PropertyType);
                if (propIsEnumerable && isEnumerable)
                {
                    //I should cast here... cause I can
                    var innerType = propToSet.PropertyType.GetGenericArguments().First();
                    var e = ((System.Collections.IEnumerable) dataRows).Cast<IParentNode>();
                    foreach (var row in e)
                    {
                        ProcessTemplateElem(row, localRow);
                        //call back to ProcessTemplateElem?
                        //ultimately need to create an object of type innerType, with the context of row
                        int debug2 = 0;
                    }
                }
                if (!isEnumerable)
                {
                }

            }
            if (path.Local != null)
            {
                var fnLocal = path.Local.Compile();
                var localRows = ((IEnumerable)fnLocal.DynamicInvoke(parent)).Cast<IParentNode>();

                var dataRows = localRows.Select(localRow => ProcessTemplateElem(data, localRow)).ToList();

                var e = dataRows.Cast<IUIInitialize>().ToList();
                node.Register(e);

                var child = node.Get<IEnumerable<IUIInitialize>>();
                propToSet.SetValue(newObj, child, null);

                int debug = 0;
                //now set this to propToSet
            }
            return;
        }
开发者ID:mcwatt77,项目名称:vimcontrols,代码行数:70,代码来源:DynamicTemplate.cs


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