• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IModelNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IModelNode的典型用法代码示例。如果您正苦于以下问题:C# IModelNode类的具体用法?C# IModelNode怎么用?C# IModelNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IModelNode类属于命名空间,在下文中一共展示了IModelNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TransformVertexRecursive

		private IModelNode TransformVertexRecursive(IModelNode vertex, TransformRule[] transforms)
		{
			var newName = transforms.Aggregate(
				vertex.DisplayName, 
				(name, rule) => GetTransform(rule.Pattern).Replace(name, rule.Name ?? string.Empty));
			var type = vertex.Type;
			var linesOfCode = vertex.LinesOfCode;
			var maintainabilityIndex = vertex.MaintainabilityIndex;
			var cyclomaticComplexity = vertex.CyclomaticComplexity;
			var quality = vertex.Quality;
			var children = vertex.Children.Select(x => TransformVertexRecursive(x, transforms));
			return vertex is StaticModelNode
					   ? new StaticModelNode(
							 newName, 
							 type, 
							 quality, 
							 linesOfCode, 
							 maintainabilityIndex, 
							 cyclomaticComplexity, 
							 children.ToList())
					   : new ModelNode(
							 newName, 
							 type, 
							 quality, 
							 linesOfCode, 
							 maintainabilityIndex, 
							 cyclomaticComplexity, 
							 children.ToList());
		}
开发者ID:henrylle,项目名称:ArchiMetrics,代码行数:29,代码来源:SyntaxTransformer.cs


示例2: PrintHierarchyInternal

 private static void PrintHierarchyInternal(IModelNode node, int indentation, StringBuilder builder)
 {
     PrintIndentation(indentation, builder);
     builder.Append(node.Guid + " ");
     PrintIndentation(indentation, builder);
     builder.Append(node.Name ?? "<untitled>");
     builder.Append(": [");
     builder.Append(node.Content.GetType().Name);
     builder.Append("] = ");
     if (node.Content.IsReference)
     {
         if (node.Content.Value != null)
         {
             builder.Append(node.Content.Value.ToString().Replace(Environment.NewLine, " "));
             builder.Append(" > ");
         }
         builder.Append("Reference -> ");
         builder.Append(node.Content.Reference);
     }
     else if (node.Content.Value == null)
     {
         builder.Append("(null)");
     }
     else
     {
         builder.Append(node.Content.Value.ToString().Replace(Environment.NewLine, " "));
     }
     builder.AppendLine();
     foreach (var child in node.Children)
     {
         PrintHierarchyInternal(child, indentation + 4, builder);
     }
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:33,代码来源:DebugExtensions.cs


示例3: Compare

		private static ComparisonResult Compare(IModelNode vertex, IModelNode pattern)
		{
			if (vertex.QualifiedName.EndsWith(pattern.QualifiedName))
			{
				var node = (IModelNode)vertex;
				var patternNode = (IModelNode)pattern;
				if (!node.Children.Any() && !patternNode.Children.Any())
				{
					return new ComparisonResult(ComparisonResultKind.Same, pattern, vertex);
				}

				if (!patternNode.Children.Any())
				{
					return new ComparisonResult(ComparisonResultKind.Partial, pattern, vertex);
				}

				var childComparisons = node.Children.Zip(patternNode.Children, Compare).AsArray();
				return childComparisons.All(x => x.Kind == ComparisonResultKind.Same)
						   ? new ComparisonResult(ComparisonResultKind.Same, pattern, vertex)
						   : childComparisons.All(x => x.Kind != ComparisonResultKind.Different)
								 ? new ComparisonResult(ComparisonResultKind.Partial, pattern, vertex)
								 : new ComparisonResult(ComparisonResultKind.Different, pattern, null);
			}

			return new ComparisonResult(ComparisonResultKind.Different, pattern, null);
		}
开发者ID:henrylle,项目名称:ArchiMetrics,代码行数:26,代码来源:BranchModelRule.cs


示例4: ObservableModelNode

        /// <summary>
        /// Initializes a new instance of the <see cref="ObservableModelNode"/> class.
        /// </summary>
        /// <param name="ownerViewModel">The <see cref="ObservableViewModel"/> that owns the new <see cref="ObservableModelNode"/>.</param>
        /// <param name="baseName">The base name of this node. Can be null if <see cref="index"/> is not. If so a name will be automatically generated from the index.</param>
        /// <param name="isPrimitive">Indicate whether this node should be considered as a primitive node.</param>
        /// <param name="modelNode">The model node bound to the new <see cref="ObservableModelNode"/>.</param>
        /// <param name="modelNodePath">The <see cref="ModelNodePath"/> corresponding to the given <see cref="modelNode"/>.</param>
        /// <param name="index">The index of this content in the model node, when this node represent an item of a collection. <c>null</c> must be passed otherwise</param>
        protected ObservableModelNode(ObservableViewModel ownerViewModel, string baseName, bool isPrimitive, IModelNode modelNode, ModelNodePath modelNodePath, object index = null)
            : base(ownerViewModel, baseName, index)
        {
            if (modelNode == null) throw new ArgumentNullException(nameof(modelNode));
            if (baseName == null && index == null)
                throw new ArgumentException("baseName and index can't be both null.");

            this.isPrimitive = isPrimitive;
            SourceNode = modelNode;
            // By default we will always combine items of list of primitive items.
            CombineMode = index != null && isPrimitive ? CombineMode.AlwaysCombine : CombineMode.CombineOnlyForAll;
            targetNode = GetTargetNode(modelNode, index);
            SourceNodePath = modelNodePath;

            // Override display name if available
            var memberDescriptor = GetMemberDescriptor() as MemberDescriptorBase;
            if (memberDescriptor != null)
            {
                if (index == null)
                {
                    var displayAttribute = TypeDescriptorFactory.Default.AttributeRegistry.GetAttribute<DisplayAttribute>(memberDescriptor.MemberInfo);
                    if (!string.IsNullOrEmpty(displayAttribute?.Name))
                    {
                        DisplayName = displayAttribute.Name;
                    }
                    IsReadOnly = !memberDescriptor.HasSet;
                }
            }
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:38,代码来源:ObservableModelNode.cs


示例5: IsVisible

 public override bool IsVisible(IModelNode node, string propertyName) {
     var typesInfo = node.Application.GetTypesInfo();
     var typeToTypeInfo = typesInfo.FindTypeInfo(typeof(GridListEditorVisibilityCalculatorHelper));
     var typeInfo = ReflectionHelper.FindTypeDescendants(typeToTypeInfo).Single();
     var calculatorHelper = (GridListEditorVisibilityCalculatorHelper)Activator.CreateInstance(typeInfo.Type);
     return calculatorHelper.IsVisible(node, propertyName);
 }
开发者ID:paulute,项目名称:eXpand,代码行数:7,代码来源:Interfaces.cs


示例6: LayoutControls

        public override object LayoutControls(IModelNode layoutInfo, ViewItemsCollection detailViewItems) {
            var splitLayout = layoutInfo as IModelSplitLayout;
            if (IsMasterDetail(layoutInfo, detailViewItems, splitLayout)) {
                _detailViewItems = detailViewItems;

                var gridView = (Control)detailViewItems[0].Control as ASPxGridView;
                if (gridView != null) {
                    var detailControl = (Control)detailViewItems[1].Control;
                    SetupViewItems(gridView);
                    ASPxSplitter splitter = LayoutMasterDetail(detailControl, gridView, splitLayout);
                    var viewItem = detailViewItems[0] as ListEditorViewItem;

                    if (viewItem != null) {
                        var listEditor = viewItem.ListEditor as XpandASPxGridListEditor;
                        if (listEditor != null) {
                            listEditor.ViewControlsCreated += (s, e) => SetSplitterInitClientEvent(splitter, e.IsRoot);
                        }
                    }

                    RaiseMasterDetailLayout(new MasterDetailLayoutEventArgs {
                        MasterViewItem = detailViewItems[0],
                        DetailViewItem = detailViewItems[1],
                        SplitterControl = splitter
                    });

                    return splitter;
                }
                throw new NotImplementedException(detailViewItems[0].Control.ToString());
            }
            return base.LayoutControls(layoutInfo, detailViewItems);
        }
开发者ID:paulute,项目名称:eXpand,代码行数:31,代码来源:XpandLayoutManager.cs


示例7: QuantumConsistencyException

 /// <summary>
 /// Initializes a new instance of the QuantumConsistencyException class.
 /// </summary>
 /// <param name="expected">A string representing the expected result.</param>
 /// <param name="observed">A string representing the observed result.</param>
 /// <param name="node">The node that is related to this error.</param>
 public QuantumConsistencyException(string expected, string observed, IModelNode node)
     : base(GetMessage(expected, observed))
 {
     Expected = expected ?? "(NullMessage)";
     Observed = observed ?? "(NullMessage)";
     Node = node;
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:13,代码来源:QuantumConsistencyException.cs


示例8: IsVisible

 public override bool IsVisible(IModelNode node, string propertyName) {
     Type editorType = EditorType(node);
     if (editorType == typeof(GridListEditor))
         return true;
     if (typeof(XpandGridListEditor).IsAssignableFrom(editorType) && !typeof(AdvBandedListEditor).IsAssignableFrom(editorType))
         return true;
     return false;
 }
开发者ID:dimajanzen,项目名称:eXpand,代码行数:8,代码来源:Interfaces.cs


示例9: IsVisible

 public bool IsVisible(IModelNode node, string propertyName){
     var modelLogicRule = (IModelLogicRule)node;
     if (modelLogicRule.ModelClass != null){
         var names = modelLogicRule.ModelClass.TypeInfo.Members.Select(info => info.Name);
         return modelLogicRule.ModelLogicWrapper.ObjectChangedExecutionContextGroup.SelectMany(contexts => contexts).Any(context => context.PropertyNames.Split(';').Any(names.Contains));
     }
     return false;
 }
开发者ID:kamchung322,项目名称:eXpand,代码行数:8,代码来源:IContextLogicRule.cs


示例10: Validate

		public Task<IEnumerable<IValidationResult>> Validate(IModelNode modelTree)
		{
			return Task.Factory.StartNew(
				() =>
				{
					var result = Contains(modelTree, _pattern);
					return new IValidationResult[] { new BranchResult(result.Kind == ComparisonResultKind.Same, _pattern) }.AsEnumerable();
				});
		}
开发者ID:henrylle,项目名称:ArchiMetrics,代码行数:9,代码来源:BranchModelRule.cs


示例11: Build

        /// <inheritdoc/>
        // TODO: Remove the type argument here
        public IModelNode Build(IModelNode referencer, object obj, Type type, Guid guid)
        {
            Reset();
            rootGuid = guid;
            var typeDescriptor = TypeDescriptorFactory.Find(obj != null ? obj.GetType() : type);
            VisitObject(obj, typeDescriptor as ObjectDescriptor, true);

            return rootNode;
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:11,代码来源:DefaultModelBuilder.cs


示例12: EditorType

 protected Type EditorType(IModelNode node) {
     var modelListView = node as IModelListView;
     if (modelListView != null)
         return modelListView.EditorType;
     var modelColumn = node as IModelColumn;
     if (modelColumn != null)
         return ((IModelListView)modelColumn.ParentView).EditorType;
     throw new NotImplementedException(node.GetType().ToString());
 }
开发者ID:dimajanzen,项目名称:eXpand,代码行数:9,代码来源:EditorTypeVisibilityCalculator.cs


示例13: ReadFromModel

 public static void ReadFromModel(this ModelXmlReader modelXmlReader, IModelNode modelNode,
                                   IModelNode readFrom, Func<string, bool> aspectNamePredicate) {
     var modelApplication = ((ModelApplicationBase) readFrom.Application);
     for (int i = 0; i < modelApplication.AspectCount; i++) {
         string aspect = modelApplication.GetAspect(i);
         string xml = new ModelXmlWriter().WriteToString(readFrom, i);
         if (!(string.IsNullOrEmpty(xml)))
             new ModelXmlReader().ReadFromString(modelNode, aspect, xml);
     }
 }
开发者ID:aries544,项目名称:eXpand,代码行数:10,代码来源:ModelXmlReaderExtensions.cs


示例14: ObservableViewModel

 /// <summary>
 /// Initializes a new instance of the <see cref="ObservableViewModel"/> class.
 /// </summary>
 /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param>
 /// <param name="modelContainer">A <see cref="ModelContainer"/> to use to build view model nodes.</param>
 /// <param name="modelNode">The root model node of the view model to generate.</param>
 /// <param name="dirtiables">The list of <see cref="IDirtiableViewModel"/> objects linked to this view model.</param>
 public ObservableViewModel(IViewModelServiceProvider serviceProvider, ModelContainer modelContainer, IModelNode modelNode, IEnumerable<IDirtiableViewModel> dirtiables)
     : this(serviceProvider, modelContainer, dirtiables.SafeArgument("dirtiables").ToList())
 {
     if (modelNode == null) throw new ArgumentNullException("modelNode");
     var node = observableViewModelService.ObservableNodeFactory(this, "Root", modelNode.Content.IsPrimitive, modelNode, new ModelNodePath(modelNode), modelNode.Content.Type, null);
     Identifier = new ObservableViewModelIdentifier(node.ModelGuid);
     node.Initialize();
     RootNode = node;
     node.CheckConsistency();
 }
开发者ID:Powerino73,项目名称:paradox,代码行数:17,代码来源:ObservableViewModel.cs


示例15: Validate

		public Task<IEnumerable<IValidationResult>> Validate(IModelNode modelTree)
		{
			return
				Task.Factory.StartNew(
					() => modelTree.Children.SelectMany(x => x.Flatten())
							  .Where(x => x.Type == NodeKind.Class)
							  .Where(x => x.CyclomaticComplexity > _cyclomaticComplexity || x.MaintainabilityIndex < _maintainabilityIndex || x.LinesOfCode > _linesOfCode)
							  .Select(x => new KpiResult(false, x))
							  .Cast<IValidationResult>()
							  .AsArray()
							  .AsEnumerable());
		}
开发者ID:henrylle,项目名称:ArchiMetrics,代码行数:12,代码来源:KpiModelRule.cs


示例16: LayoutControls

 public override object LayoutControls(IModelNode layoutInfo, ViewItemsCollection detailViewItems) {
     var splitLayout = layoutInfo as IModelSplitLayout;
     if (IsMasterDetail(layoutInfo, detailViewItems, splitLayout)) {
         _detailViewItems = detailViewItems;
         var gridView = (Control)detailViewItems[0].Control as ASPxGridView;
         if (gridView != null) {
             var detailControl = (Control)detailViewItems[1].Control;
             SetupViewItems(detailControl, gridView);
             return LayoutControls(detailControl, gridView, splitLayout);
         }
         throw new NotImplementedException(detailViewItems[0].Control.ToString());
     }
     return base.LayoutControls(layoutInfo, detailViewItems);
 }
开发者ID:Raoulwe,项目名称:eXpand,代码行数:14,代码来源:XpandLayoutManager.cs


示例17: Contains

		private static ComparisonResult Contains(IModelNode tree, IModelNode pattern)
		{
			var deepComparison = tree.Flatten().Select(x => Compare(x, pattern)).AsArray();
			if (deepComparison.Any(x => x.Kind == ComparisonResultKind.Same))
			{
				return new ComparisonResult(ComparisonResultKind.Same, pattern, deepComparison.Where(x => x.Kind == ComparisonResultKind.Same).SelectMany(x => x.Matches).Distinct());
			}

			if (deepComparison.Any(x => x.Kind == ComparisonResultKind.Partial))
			{
				return new ComparisonResult(ComparisonResultKind.Partial, pattern, deepComparison.Where(x => x.Kind == ComparisonResultKind.Partial).SelectMany(x => x.Matches).Distinct());
			}

			return new ComparisonResult(ComparisonResultKind.Different, pattern, null);
		}
开发者ID:henrylle,项目名称:ArchiMetrics,代码行数:15,代码来源:BranchModelRule.cs


示例18: PrintModelContainerContent

        public static void PrintModelContainerContent(ModelContainer container, IModelNode rootNode = null)
        {
            Console.WriteLine(@"Container content:");
            Console.WriteLine(@"------------------");
            // Print the root node first, if specified
            if (rootNode != null)
                Console.WriteLine(rootNode.PrintHierarchy());

            // Print other nodes next
            // TODO: FIXME
            //foreach (var node in container.Guids.Select(container.GetModelNode).Where(x => x != rootNode))
            //{
            //    Console.WriteLine(node.PrintHierarchy());
            //}
            Console.WriteLine(@"------------------");
        }
开发者ID:dejavvu,项目名称:paradox,代码行数:16,代码来源:Helper.cs


示例19: IsVisible

 public bool IsVisible(IModelNode node, string propertyName){
     return ((IModelOptionsWin) node.Application.Options).FormStyle == RibbonFormStyle.Standard;
 }
开发者ID:derjabkin,项目名称:eXpand,代码行数:3,代码来源:StandardFormStyleVisibilityCalculator.cs


示例20: IsVisible

 public bool IsVisible(IModelNode node, string propertyName) {
     return !(node is IModelRuntimeOrphanedColection) || propertyName != "Type";
 }
开发者ID:kevin3274,项目名称:eXpand,代码行数:3,代码来源:IModelMemberEx.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IModelObject类代码示例发布时间:2022-05-24
下一篇:
C# IModelMemberViewItem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap