DesignerMetadata.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / DesignerMetadata.cs / 1305376 / DesignerMetadata.cs

                            //---------------------------------------------------------------- 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//---------------------------------------------------------------

namespace System.Activities.Presentation 
{
    using System.ComponentModel; 
    using System.Activities.Presentation.PropertyEditing; 
    using System.Activities.Presentation.Metadata;
    using System.Activities.Presentation.View; 
    using System.Activities.Presentation.Xaml;
    using System.Xaml.Schema;
    using System.Reflection;
    using System.Xaml; 
    using System.Xml.Linq;
 
    class DesignerMetadata : IRegisterMetadata 
    {
        // Called by the designer to register  design-time metadata. 
        public void Register()
        {
            AttributeTableBuilder builder = new AttributeTableBuilder();
 
            // Register Designers.
            builder.AddCustomAttributes(typeof(Activity), new DesignerAttribute(typeof(ActivityDesigner))); 
            builder.AddCustomAttributes(typeof(ActivityBuilder), new DesignerAttribute(typeof(ActivityTypeDesigner))); 

            // Register PropertyValueEditors 
            builder.AddCustomAttributes(typeof(Argument), new EditorAttribute(typeof(ExpressionValueEditor), typeof(PropertyValueEditor)));
            builder.AddCustomAttributes(typeof(Type), PropertyValueEditor.CreateEditorAttribute(typeof(TypePropertyEditor)));

            builder.AddCustomAttributes(typeof(Activity<>), new EditorAttribute(typeof(ExpressionValueEditor), typeof(PropertyValueEditor))); 

            // Disable reuse of propertyvalueeditors for Arguments 
            builder.AddCustomAttributes(typeof(Argument), new EditorReuseAttribute(false)); 
            builder.AddCustomAttributes(typeof(Activity<>), new EditorReuseAttribute(false));
 
            //Removing all the properties except "Name" from property grid for the type SchemaType.
            foreach (MemberInfo mi in typeof(ActivityBuilder).GetMembers())
            {
                if (mi.MemberType == MemberTypes.Property && !mi.Name.Equals("Name")) 
                {
                    builder.AddCustomAttributes(typeof(ActivityBuilder), mi, new BrowsableAttribute(false)); 
                } 
            }
 
            builder.AddCustomAttributes(typeof(XName), new TypeConverterAttribute(typeof(XNameConverter)));

            builder.AddCustomAttributes(typeof(VBIdentifierName), new EditorAttribute(typeof(VBIdentifierNameEditor), typeof(PropertyValueEditor)));
            builder.AddCustomAttributes(typeof(VBIdentifierName), new EditorReuseAttribute(false)); 

            // Apply the metadata 
            MetadataStore.AddAttributeTable(builder.CreateTable()); 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//---------------------------------------------------------------- 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//---------------------------------------------------------------

namespace System.Activities.Presentation 
{
    using System.ComponentModel; 
    using System.Activities.Presentation.PropertyEditing; 
    using System.Activities.Presentation.Metadata;
    using System.Activities.Presentation.View; 
    using System.Activities.Presentation.Xaml;
    using System.Xaml.Schema;
    using System.Reflection;
    using System.Xaml; 
    using System.Xml.Linq;
 
    class DesignerMetadata : IRegisterMetadata 
    {
        // Called by the designer to register  design-time metadata. 
        public void Register()
        {
            AttributeTableBuilder builder = new AttributeTableBuilder();
 
            // Register Designers.
            builder.AddCustomAttributes(typeof(Activity), new DesignerAttribute(typeof(ActivityDesigner))); 
            builder.AddCustomAttributes(typeof(ActivityBuilder), new DesignerAttribute(typeof(ActivityTypeDesigner))); 

            // Register PropertyValueEditors 
            builder.AddCustomAttributes(typeof(Argument), new EditorAttribute(typeof(ExpressionValueEditor), typeof(PropertyValueEditor)));
            builder.AddCustomAttributes(typeof(Type), PropertyValueEditor.CreateEditorAttribute(typeof(TypePropertyEditor)));

            builder.AddCustomAttributes(typeof(Activity<>), new EditorAttribute(typeof(ExpressionValueEditor), typeof(PropertyValueEditor))); 

            // Disable reuse of propertyvalueeditors for Arguments 
            builder.AddCustomAttributes(typeof(Argument), new EditorReuseAttribute(false)); 
            builder.AddCustomAttributes(typeof(Activity<>), new EditorReuseAttribute(false));
 
            //Removing all the properties except "Name" from property grid for the type SchemaType.
            foreach (MemberInfo mi in typeof(ActivityBuilder).GetMembers())
            {
                if (mi.MemberType == MemberTypes.Property && !mi.Name.Equals("Name")) 
                {
                    builder.AddCustomAttributes(typeof(ActivityBuilder), mi, new BrowsableAttribute(false)); 
                } 
            }
 
            builder.AddCustomAttributes(typeof(XName), new TypeConverterAttribute(typeof(XNameConverter)));

            builder.AddCustomAttributes(typeof(VBIdentifierName), new EditorAttribute(typeof(VBIdentifierNameEditor), typeof(PropertyValueEditor)));
            builder.AddCustomAttributes(typeof(VBIdentifierName), new EditorReuseAttribute(false)); 

            // Apply the metadata 
            MetadataStore.AddAttributeTable(builder.CreateTable()); 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.

                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK