示例#1
0
        public override void ElementAdded(ElementAddedEventArgs e)
        {
            ReferenceDataType rdt = e.ModelElement as ReferenceDataType;

            if (rdt != null && rdt.DataContract != null)
            {
                DataContractCompartmentShape shape = DomainModelHelper.GetShapeFromElement <DataContractCompartmentShape>(rdt.DataContract);
                if (shape != null)
                {
                    shape.OutlineDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                    shape.OutlineThickness = 0.0165F;
                }
            }
        }
        public override void ElementDeleting(ElementDeletingEventArgs e)
        {
            ReferenceDataType rdt = e.ModelElement as ReferenceDataType;

            if (rdt != null && rdt.DataContract != null)
            {
                // If this is the last element in DataMembers, restore the dash style to solid
                if (rdt.DataContract.DataMembers.FindAll(m => { return(m is ReferenceDataType); }).Count == 1)
                {
                    DataContractCompartmentShape shape = DomainModelHelper.GetShapeFromElement <DataContractCompartmentShape>(rdt.DataContract);
                    if (shape != null)
                    {
                        shape.OutlineDashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
                        shape.OutlineThickness = 0.0125f;
                    }
                }
            }
        }