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

C# ElementAddedEventArgs类代码示例

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

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



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

示例1: ElementAdded

        /// <summary>
        ///     Do the following when a new EntityType shape is created:
        ///     - Add the new EntityType to the model
        /// </summary>
        /// <param name="e"></param>
        public override void ElementAdded(ElementAddedEventArgs e)
        {
            base.ElementAdded(e);

            var addedEntity = e.ModelElement as EntityType;
            Debug.Assert(addedEntity != null);
            Debug.Assert(addedEntity.EntityDesignerViewModel != null);

            if ((addedEntity != null)
                && (addedEntity.EntityDesignerViewModel != null))
            {
                var viewModel = addedEntity.EntityDesignerViewModel;
                Debug.Assert(viewModel != null);

                var tx = ModelUtils.GetCurrentTx(e.ModelElement.Store);
                Debug.Assert(tx != null, "Make sure we have a Current Active Tx");
                if (tx != null
                    && !tx.IsSerializing)
                {
                    // Remove the added DSL EntityType.
                    // When Escher model is updated, there will be a code that will create the EntityType back
                    viewModel.EntityTypes.Remove(addedEntity);
                    addedEntity.Delete();

                    // create the model change and add it to the current transaction changelist
                    ViewModelChangeContext.GetNewOrExistingContext(tx).ViewModelChanges.Add(new EntityTypeAdd());
                }
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:34,代码来源:EntityType_AddRule.cs


示例2: ElementAdded

        /// <summary>
        ///     Do the following when a new Association is created:
        ///     - Initialize the "End1" and "End2" properties (displayed on the connector decorators)
        ///     - Set the "Name" property to a sensible default
        ///     - Update the navigation property of the Source and Target entities
        /// </summary>
        public override void ElementAdded(ElementAddedEventArgs e)
        {
            base.ElementAdded(e);

            var addedAssociation = e.ModelElement as Association;

            Debug.Assert(addedAssociation != null);
            Debug.Assert(addedAssociation.SourceEntityType != null);
            Debug.Assert(addedAssociation.TargetEntityType != null);
            Debug.Assert(addedAssociation.SourceEntityType.EntityDesignerViewModel != null);

            if (addedAssociation != null
                && addedAssociation.SourceEntityType != null
                && addedAssociation.TargetEntityType != null
                && addedAssociation.SourceEntityType.EntityDesignerViewModel != null)
            {
                var tx = ModelUtils.GetCurrentTx(e.ModelElement.Store);
                Debug.Assert(tx != null);
                if (tx != null
                    && !tx.IsSerializing)
                {
                    // create the new association
                    ViewModelChangeContext.GetNewOrExistingContext(tx).ViewModelChanges.Add(new AssociationAdd(addedAssociation));
                }
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:32,代码来源:Association_AddRule.cs


示例3: ElementAdded

        public override void ElementAdded(ElementAddedEventArgs e)
        {
            if (e.ModelElement != null)
                if (e.ModelElement.Store.TransactionManager.CurrentTransaction != null)
                    if (e.ModelElement.Store.TransactionManager.CurrentTransaction.IsSerializing)
                        return;

            if (e.ModelElement == null)
                return;

            if (ImmutabilityExtensionMethods.GetLocks(e.ModelElement) != Locks.None)
                return;

            DomainProperty domainProperty = e.ModelElement as DomainProperty;
            if (domainProperty != null)
            {
                if (domainProperty.Type == null)
                    foreach (DomainType type in domainProperty.Element.ParentModelContext.MetaModel.DomainTypes)
                        if (type.Name == "String")
                        {
                            domainProperty.Type = type;
                            break;
                        }

                if (domainProperty.SerializationName == "")
                {
                    domainProperty.SerializationName = domainProperty.Name;
                    domainProperty.IsSerializationNameTracking = TrackingEnum.IgnoreOnce;
                }
            }
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:31,代码来源:DomainPropertyAddRule.cs


示例4: ElementAdded

        public override void ElementAdded(ElementAddedEventArgs e)
        {
            ShapeElementContainsChildShapes con = e.ModelElement as ShapeElementContainsChildShapes;
            if (con != null)
            {
                NodeShape childShape = con.ChildShape;
                NodeShape parentShape = con.ParentShape;

                if (childShape != null && parentShape != null)
                {
                    if (childShape.IsDeleted)
                        return;
                    if (parentShape.IsDeleted)
                        return;

                    parentShape.AddToShapeMapping(childShape);
                    childShape.UpdateAbsoluteLocation();

                    if (childShape.Location == PointD.Empty)
                        childShape.SetAtFreePositionOnParent();
                }
                else 
                    con.Delete();
            }
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:25,代码来源:ShapeElementContainsChildShapesAddRule.cs


示例5: ElementAdded

        public override void ElementAdded(ElementAddedEventArgs e)
        {
            if (e.ModelElement != null)
                if (e.ModelElement.Store.TransactionManager.CurrentTransaction != null)
                    if (e.ModelElement.Store.TransactionManager.CurrentTransaction.IsSerializing)
                        return;

            if (e.ModelElement == null)
                return;

            if (ImmutabilityExtensionMethods.GetLocks(e.ModelElement) != Locks.None)
                return;

            GeneratedDomainElement generatedDomainElement = e.ModelElement as GeneratedDomainElement;
            if (generatedDomainElement != null)
            {
                System.Collections.ObjectModel.ReadOnlyCollection<ModelElement> elements = generatedDomainElement.Store.ElementDirectory.FindElements(DomainClass.DomainClassId);
                foreach (ModelElement m in elements)
                    if (m is DomainClass)
                        if ((m as DomainClass).IsDomainModel)
                        {
                            generatedDomainElement.Namespace = (m as DomainClass).Namespace;

                            return;
                        }
            }
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:27,代码来源:GeneratedDomainElementAddRule.cs


示例6: ElementAdded

        public override void ElementAdded(ElementAddedEventArgs e)
        {
            if (e.ModelElement != null)
                if (e.ModelElement.Store.TransactionManager.CurrentTransaction != null)
                    if (e.ModelElement.Store.TransactionManager.CurrentTransaction.IsSerializing)
                        return;

            if (e.ModelElement == null)
                return;

            if (ImmutabilityExtensionMethods.GetLocks(e.ModelElement) != Locks.None)
                return;

            DomainClass domainClass = e.ModelElement as DomainClass;
            if (domainClass != null)
            {
                if (domainClass.DomainModelTreeNodes.Count == 0)
                {
                    RootNode node = new RootNode(domainClass.Store);
                    node.DomainElement = domainClass;
                    node.IsElementHolder = true;

                    // add to the domain model diagram tree
                    domainClass.ModelContext.ViewContext.DomainModelTreeView.ModelTreeNodes.Add(node);
                    domainClass.ModelContext.ViewContext.DomainModelTreeView.RootNodes.Add(node);
                }
            }
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:28,代码来源:DomainClassAddRule.cs


示例7: OnElementAdded

        /// <summary>
        /// Called whenever a model element is added to the store.
        /// </summary>
        /// <param name="sender">ViewModelStore</param>
        /// <param name="args">Event Arguments for notification of the creation of new model element.</param>
        protected virtual void OnElementAdded(object sender, ElementAddedEventArgs args)
        {
            EventManager.GetEvent<ModelElementAddedEvent>().Publish(args);

            if( args.ModelElement is ElementLink )
                EventManager.GetEvent<ModelElementLinkAddedEvent>().Publish(args);            
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:12,代码来源:ViewModelStore.cs


示例8: ElementAdded

        public override void ElementAdded(ElementAddedEventArgs e)
        {
             if (e.ModelElement != null)
                if (e.ModelElement.Store.TransactionManager.CurrentTransaction != null)
                    if (e.ModelElement.Store.TransactionManager.CurrentTransaction.IsSerializing)
                        return;

            if (e.ModelElement == null)
                return;

            if (ImmutabilityExtensionMethods.GetLocks(e.ModelElement) != Locks.None)
                return;

            EnumerationLiteral enumerationLiteral = e.ModelElement as EnumerationLiteral;
            if (enumerationLiteral != null)
            {
                if (enumerationLiteral.DisplayName == "")
                {
                    enumerationLiteral.DisplayName = StringHelper.BreakUpper(enumerationLiteral.Name);
                    enumerationLiteral.IsDisplayNameTracking = TrackingEnum.IgnoreOnce;
                }

                if (enumerationLiteral.SerializationName == "")
                {
                    enumerationLiteral.SerializationName = enumerationLiteral.Name;
                    enumerationLiteral.IsSerializationNameTracking = TrackingEnum.IgnoreOnce;
                }
            }
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:29,代码来源:EnumerationLiteralAddRule.cs


示例9: ElementAdded

        public override void ElementAdded(ElementAddedEventArgs e)
        {
            // if aren't adding a shape, just return
            var addedShape = e.ModelElement as ShapeElement;
            if (addedShape == null)
            {
                return;
            }

            // only layout classes and links
            if (!(addedShape is EntityTypeShape ||
                  addedShape is AssociationConnector ||
                  addedShape is InheritanceConnector))
            {
                return;
            }

            // layout this new shape
            var diagram = addedShape.Diagram as EntityDesignerDiagram;
            if (diagram != null
                && diagram.Arranger != null)
            {
                diagram.Arranger.Add(addedShape, false);
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:25,代码来源:EntityDesignerDiagram_AddRule.cs


示例10: OnElementAdded

        private void OnElementAdded(ElementAddedEventArgs args)
        {
            SpecificDependenciesItemViewModel vm = this.CreateSpecificViewModel(this.ViewModelStore, args.ModelElement);
            this.itemViewModels.Add(vm);

            UpdateIndices();
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:7,代码来源:SpecificDependenciesViewModel.cs


示例11: ElementAdded

		public override void ElementAdded(ElementAddedEventArgs e)
		{
			PrimitiveDataTypeCollection dataContractPrimitiveCollection = e.ModelElement as PrimitiveDataTypeCollection;
			if (dataContractPrimitiveCollection == null)
			{
				return;
			} 

			DataContractModel root = dataContractPrimitiveCollection.DataContractModel;
			if(root != null &&
			   root.ImplementationTechnology != null)
			{
				ExtensionProviderHelper.AttachObjectExtender(dataContractPrimitiveCollection, root.ImplementationTechnology);
			}

			if(string.IsNullOrEmpty(dataContractPrimitiveCollection.ItemType))
			{
				dataContractPrimitiveCollection.ItemType = typeof(string).FullName;
			}

			if (String.IsNullOrEmpty(dataContractPrimitiveCollection.Namespace))
			{
				dataContractPrimitiveCollection.Namespace = ArtifactLinkHelper.DefaultNamespace(e.ModelElement);
			}

			UpdateDataContractCollectionType(dataContractPrimitiveCollection, CollectionTypes.Values[CollectionTypes.ListKey]);
		}
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:27,代码来源:PrimitiveDataTypeCollectionAddRule.cs


示例12: ElementAdded

        /// <summary>
        /// Triggers this notification rule whether a <see cref="ElementSchema"/> is added.
        /// </summary>
        /// <param name="e">The provided data for this event.</param>
        public override void ElementAdded(ElementAddedEventArgs e)
        {
            Guard.NotNull(() => e, e);

            var element = (ExtensionPointSchema)e.ModelElement;

            if (!element.Store.TransactionManager.CurrentTransaction.IsSerializing)
            {
                if (element.Owner == null)
                {
                    var relationship = (ViewHasExtensionPoints)DomainRelationshipInfo.FindEmbeddingElementLink(element);

                    if (relationship != null)
                    {
                        relationship.WithTransaction(r =>
                        {
                            r.Cardinality = Runtime.Cardinality.ZeroToMany;
                        });
                    }
                }
                else
                {
                    var relationship = (ElementHasExtensionPoints)DomainRelationshipInfo.FindEmbeddingElementLink(element);

                    if (relationship != null)
                    {
                        relationship.WithTransaction(r =>
                        {
                            r.Cardinality = Runtime.Cardinality.ZeroToMany;
                        });
                    }
                }
            }
        }
开发者ID:StevenVanDijk,项目名称:NuPattern,代码行数:38,代码来源:ExtensionPointSchemaAddRule.cs


示例13: ElementAdded

        /// <summary>
        /// Triggers this notification rule whether a <see cref="AbstractElement"/> is added.
        /// </summary>
        /// <param name="e">The provided data for this event.</param>
        public override void ElementAdded(ElementAddedEventArgs e)
        {
            Guard.NotNull(() => e, e);

            var element = (AbstractElement)e.ModelElement;

            var info = FindInfo(element);
            if (info != null)
            {
                element.Info = info;

                if (string.IsNullOrEmpty(element.InstanceName))
                {
                    element.InstanceName = info.DisplayName;
                }

                element.SyncPropertiesFrom(info.Properties);
                element.SyncElementsFrom(info.Elements);

                var patternManager = element.Store.GetService<IPatternManager>();
                if (patternManager != null)
                {
                    element.SyncExtensionPointsFrom(info.ExtensionPoints, patternManager);
                }
            }
            else
            {
                tracer.Warn(Resources.TracerWarning_ElementInfoNotFound, element.Id);
            }
        }
开发者ID:StevenVanDijk,项目名称:NuPattern,代码行数:34,代码来源:AbstractElementAddRule.cs


示例14: ElementAdded

        /// <summary>
        /// This method is called when the rule is fired, that is when a new connection is added to the model.
        /// </summary>
        /// <param name="e">the ElementAddedEventArgs</param>
        public override void ElementAdded(ElementAddedEventArgs e)
        {
            BinaryLinkShape c = e.ModelElement as BinaryLinkShape;
            if (c == null)
                return;

            CompartmentMappingUtil.RerouteCompartmentMappings(c);
        }
开发者ID:thabart,项目名称:SimpleOrm,代码行数:12,代码来源:CompartmentMappingAddRuleBase.cs


示例15: ElementAdded

 public override void ElementAdded(ElementAddedEventArgs e)
 {
     NodeShape nodeShape = e.ModelElement as NodeShape;
     if (nodeShape != null)
     {
         //nodeShape.FixUpMissingLinkShapes();
     }
 }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:8,代码来源:NodeShapeAddedRule.cs


示例16: AssimilationMappingAddedRule

			/// <summary>
			/// AddRule: typeof(AssimilationMappingCustomizesFactType)
			/// </summary>
			private static void AssimilationMappingAddedRule(ElementAddedEventArgs e)
			{
				ORMCore.ORMModel ormModel = ((AssimilationMappingCustomizesFactType)e.ModelElement).FactType.Model;
				if (ormModel != null)
				{
					RebuildAbstractionModel(AbstractionModelIsForORMModel.GetAbstractionModel(ormModel));
				}
			}
开发者ID:cjheath,项目名称:NORMA,代码行数:11,代码来源:ModificationTracker.cs


示例17: OnReferenceAdded

 /// <summary>
 /// Called whenever a relationship of type ModalDiagramReferencesDomainClass is added and
 /// the element hosted by this model is the source.
 /// </summary>
 /// <param name="args"></param>
 private void OnReferenceAdded(ElementAddedEventArgs args)
 {
     ModalDiagramReferencesDomainClass con = args.ModelElement as ModalDiagramReferencesDomainClass;
     if (con != null)
     {
         SetReference(con.DomainClass);
     }
 }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:13,代码来源:ModalDiagramViewModel.cs


示例18: ElementAdded

		public override void ElementAdded(ElementAddedEventArgs e)
		{
			Endpoint endpoint = e.ModelElement as Endpoint;
			IExtensibleObject extensibleObject = endpoint as IExtensibleObject;

			if(extensibleObject.ExtensionProvider != null)
			{
				ExtensionProviderHelper.AttachObjectExtender(endpoint, extensibleObject.ExtensionProvider);
			}
		}
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:10,代码来源:EndpointAddRule.cs


示例19: ElementAdded

		public override void ElementAdded(ElementAddedEventArgs e)
		{
			ServiceDescription service = e.ModelElement as ServiceDescription;
			IExtensibleObject extensibleObject = service as IExtensibleObject;

			if(extensibleObject.ExtensionProvider != null)
			{
				ExtensionProviderHelper.AttachObjectExtender(service, extensibleObject.ExtensionProvider);
			}
		}
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:10,代码来源:ServiceDescriptionAddRule.cs


示例20: ElementAdded

		public override void ElementAdded(ElementAddedEventArgs e)
		{
			FaultContract faultContract = e.ModelElement as FaultContract;
			DataContractModel root = faultContract.DataContractModel;

			if(root != null &&
			   root.ImplementationTechnology != null)
			{
				ExtensionProviderHelper.AttachObjectExtender(faultContract, root.ImplementationTechnology);
			}
		}
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:11,代码来源:FaultContractAddRule.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ElementChangedEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# Element类代码示例发布时间: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