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


C# WorkflowMarkupSerializationManager.GetXmlQualifiedName方法代码示例

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


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

示例1: OnBeforeSerializeContents

        internal override void OnBeforeSerializeContents(WorkflowMarkupSerializationManager serializationManager, object obj)
        {
            base.OnBeforeSerializeContents(serializationManager, obj);

            //For root activity we will go through all the nested activities and put the namespaces at the top level
            CompositeActivity compositeActivity = obj as CompositeActivity;
            XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter;
            if (compositeActivity.Parent == null && writer != null)
            {
                Dictionary<string, Activity> writtenMappings = new Dictionary<string, Activity>();

                string prefix = String.Empty;
                XmlQualifiedName xmlQualifiedName = serializationManager.GetXmlQualifiedName(compositeActivity.GetType(), out prefix);
                writtenMappings.Add(xmlQualifiedName.Namespace, compositeActivity);

                foreach (Activity containedActivity in Helpers.GetNestedActivities(compositeActivity))
                {
                    prefix = String.Empty;
                    xmlQualifiedName = serializationManager.GetXmlQualifiedName(containedActivity.GetType(), out prefix);
                    if (!writtenMappings.ContainsKey(xmlQualifiedName.Namespace))
                    {
                        writer.WriteAttributeString("xmlns", prefix, null, xmlQualifiedName.Namespace);
                        writtenMappings.Add(xmlQualifiedName.Namespace, containedActivity);
                    }
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:27,代码来源:CompositeActivityMarkupSerializer.cs

示例2: OnBeforeSerializeContents

 internal override void OnBeforeSerializeContents(WorkflowMarkupSerializationManager serializationManager, object obj)
 {
     base.OnBeforeSerializeContents(serializationManager, obj);
     CompositeActivity activity = obj as CompositeActivity;
     XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter;
     if ((activity.Parent == null) && (writer != null))
     {
         Dictionary<string, Activity> dictionary = new Dictionary<string, Activity>();
         string prefix = string.Empty;
         XmlQualifiedName xmlQualifiedName = serializationManager.GetXmlQualifiedName(activity.GetType(), out prefix);
         dictionary.Add(xmlQualifiedName.Namespace, activity);
         foreach (Activity activity2 in Helpers.GetNestedActivities(activity))
         {
             prefix = string.Empty;
             xmlQualifiedName = serializationManager.GetXmlQualifiedName(activity2.GetType(), out prefix);
             if (!dictionary.ContainsKey(xmlQualifiedName.Namespace))
             {
                 writer.WriteAttributeString("xmlns", prefix, null, xmlQualifiedName.Namespace);
                 dictionary.Add(xmlQualifiedName.Namespace, activity2);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:CompositeActivityMarkupSerializer.cs

示例3: OnBeforeSerialize

        protected override void OnBeforeSerialize(WorkflowMarkupSerializationManager serializationManager, object obj)
        {
            base.OnBeforeSerialize(serializationManager, obj);

            //For root activity we will go through all the nested activities and put the namespaces at the top level
            ActivityDesigner activityDesigner = obj as ActivityDesigner;
            XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter;
            if (activityDesigner.Activity != null && activityDesigner.Activity.Parent == null && writer != null)
            {
                string prefix = String.Empty;
                XmlQualifiedName xmlQualifiedName = serializationManager.GetXmlQualifiedName(typeof(Point), out prefix);
                writer.WriteAttributeString("xmlns", prefix, null, xmlQualifiedName.Namespace);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:ActivityDesignerLayoutSerializers.cs

示例4: SerializeToString

 protected internal sealed override string SerializeToString(WorkflowMarkupSerializationManager serializationManager, object value)
 {
     if (serializationManager == null)
     {
         throw new ArgumentNullException("serializationManager");
     }
     XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter;
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     writer.WriteString("{");
     string prefix = string.Empty;
     XmlQualifiedName xmlQualifiedName = serializationManager.GetXmlQualifiedName(value.GetType(), out prefix);
     writer.WriteQualifiedName(xmlQualifiedName.Name, xmlQualifiedName.Namespace);
     int num = 0;
     Dictionary<string, string> dictionary = null;
     InstanceDescriptor instanceDescriptor = this.GetInstanceDescriptor(serializationManager, value);
     if (instanceDescriptor != null)
     {
         ConstructorInfo memberInfo = instanceDescriptor.MemberInfo as ConstructorInfo;
         if (memberInfo != null)
         {
             ParameterInfo[] parameters = memberInfo.GetParameters();
             if ((parameters != null) && (parameters.Length == instanceDescriptor.Arguments.Count))
             {
                 int index = 0;
                 foreach (object obj2 in instanceDescriptor.Arguments)
                 {
                     if (dictionary == null)
                     {
                         dictionary = new Dictionary<string, string>();
                     }
                     if (obj2 != null)
                     {
                         dictionary.Add(parameters[index].Name, parameters[index++].Name);
                         if (num++ > 0)
                         {
                             writer.WriteString(",");
                         }
                         else
                         {
                             writer.WriteString(" ");
                         }
                         if (obj2.GetType() == typeof(string))
                         {
                             writer.WriteString(this.CreateEscapedValue(obj2 as string));
                         }
                         else if (obj2 is Type)
                         {
                             Type type = obj2 as Type;
                             if (type.Assembly != null)
                             {
                                 string str2 = string.Empty;
                                 XmlQualifiedName name2 = serializationManager.GetXmlQualifiedName(type, out str2);
                                 writer.WriteQualifiedName(XmlConvert.EncodeName(name2.Name), name2.Namespace);
                             }
                             else
                             {
                                 writer.WriteString(type.FullName);
                             }
                         }
                         else
                         {
                             string text = base.SerializeToString(serializationManager, obj2);
                             if (text != null)
                             {
                                 writer.WriteString(text);
                             }
                         }
                     }
                 }
             }
         }
     }
     List<PropertyInfo> list = new List<PropertyInfo>();
     list.AddRange(this.GetProperties(serializationManager, value));
     list.AddRange(serializationManager.GetExtendedProperties(value));
     foreach (PropertyInfo info2 in list)
     {
         if (((Helpers.GetSerializationVisibility(info2) != DesignerSerializationVisibility.Hidden) && info2.CanRead) && (info2.GetValue(value, null) != null))
         {
             WorkflowMarkupSerializer serializer = serializationManager.GetSerializer(info2.PropertyType, typeof(WorkflowMarkupSerializer)) as WorkflowMarkupSerializer;
             if (serializer == null)
             {
                 serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString("Error_SerializerNotAvailable", new object[] { info2.PropertyType.FullName })));
             }
             else
             {
                 if (dictionary != null)
                 {
                     object[] customAttributes = info2.GetCustomAttributes(typeof(ConstructorArgumentAttribute), false);
                     if ((customAttributes.Length > 0) && dictionary.ContainsKey((customAttributes[0] as ConstructorArgumentAttribute).ArgumentName))
                     {
                         continue;
                     }
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:MarkupExtensionSerializer.cs

示例5: OnBeforeSerialize

 protected override void OnBeforeSerialize(WorkflowMarkupSerializationManager serializationManager, object obj)
 {
     base.OnBeforeSerialize(serializationManager, obj);
     ActivityDesigner designer = obj as ActivityDesigner;
     XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter;
     if (((designer.Activity != null) && (designer.Activity.Parent == null)) && (writer != null))
     {
         string prefix = string.Empty;
         XmlQualifiedName xmlQualifiedName = serializationManager.GetXmlQualifiedName(typeof(Point), out prefix);
         writer.WriteAttributeString("xmlns", prefix, null, xmlQualifiedName.Namespace);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:ActivityDesignerLayoutSerializer.cs

示例6: SerializeContents


//.........这里部分代码省略.........
                    // For Key properties, we don;t want to get the extended properties
                    if (!dictionaryKey)
                        properties.AddRange(serializationManager.GetExtendedProperties(obj));
                    events.AddRange(serializer.GetEvents(serializationManager, obj));
                }
                catch (Exception e)
                {
                    serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                    return;
                }
            }
            if (dependencyProperties != null)
            {
                // For attached properties that does not have a corresponding real property on the object, if the value is a design time
                // type, it may not be set through dependency property SetValue, therefore will not be present in the dependencyProperties
                // collection, we'll have to get the dependency property object ourselves.
                if (designTimeTypeNames != null)
                {
                    foreach (object key in designTimeTypeNames.Keys)
                    {
                        DependencyProperty dependencyProperty = key as DependencyProperty;
                        if (dependencyProperty != null && !dependencyProperties.ContainsKey(dependencyProperty))
                            dependencyProperties.Add(dependencyProperty, designTimeTypeNames[dependencyProperty]);
                    }
                }

                // Add all dependency properties to the master collection.
                foreach (DependencyProperty dependencyProperty in dependencyProperties.Keys)
                {
                    string propertyName = String.Empty;
                    if (dependencyProperty.IsAttached)
                    {
                        string prefix = String.Empty;
                        XmlQualifiedName qualifiedName = serializationManager.GetXmlQualifiedName(dependencyProperty.OwnerType, out prefix);
                        propertyName = qualifiedName.Name + "." + dependencyProperty.Name;
                    }
                    else
                    {
                        propertyName = dependencyProperty.Name;
                    }

                    if (dependencyProperty.IsAttached || !dependencyProperty.DefaultMetadata.IsMetaProperty)
                        allProperties.Add(propertyName, dependencyProperty);
                }
            }

            if (properties != null)
            {
                foreach (PropertyInfo propInfo in properties)
                {
                    // Do not serialize properties that have corresponding dynamic properties.
                    if (propInfo != null && !allProperties.ContainsKey(propInfo.Name))
                        allProperties.Add(propInfo.Name, propInfo);
                }
            }

            if (events != null)
            {
                foreach (EventInfo eventInfo in events)
                {
                    // Do not serialize events that have corresponding dynamic properties.
                    if (eventInfo != null && !allProperties.ContainsKey(eventInfo.Name))
                        allProperties.Add(eventInfo.Name, eventInfo);
                }
            }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:66,代码来源:WorkflowMarkupSerializer.cs

示例7: SerializeToString

        protected internal sealed override string SerializeToString(WorkflowMarkupSerializationManager serializationManager, object value)
        {
            if (serializationManager == null)
                throw new ArgumentNullException("serializationManager");
            XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter;
            if (writer == null)
                throw new ArgumentNullException("writer");
            if (value == null)
                throw new ArgumentNullException("value");

            writer.WriteString(MarkupExtensionSerializer.CompactFormatStart);

            string prefix = String.Empty;
            XmlQualifiedName qualifiedName = serializationManager.GetXmlQualifiedName(value.GetType(), out prefix);
            writer.WriteQualifiedName(qualifiedName.Name, qualifiedName.Namespace);

            int index = 0;

            Dictionary<string, string> constructorArguments = null;
            InstanceDescriptor instanceDescriptor = this.GetInstanceDescriptor(serializationManager, value);
            if (instanceDescriptor != null)
            {
                ConstructorInfo ctorInfo = instanceDescriptor.MemberInfo as ConstructorInfo;
                if (ctorInfo != null)
                {
                    ParameterInfo[] parameters = ctorInfo.GetParameters();
                    if (parameters != null && parameters.Length == instanceDescriptor.Arguments.Count)
                    {
                        int i = 0;
                        foreach (object argValue in instanceDescriptor.Arguments)
                        {
                            if (constructorArguments == null)
                                constructorArguments = new Dictionary<string, string>();
                            // 
                            if (argValue == null)
                                continue;
                            constructorArguments.Add(parameters[i].Name, parameters[i++].Name);
                            if (index++ > 0)
                                writer.WriteString(MarkupExtensionSerializer.CompactFormatPropertySeperator);
                            else
                                writer.WriteString(MarkupExtensionSerializer.CompactFormatTypeSeperator);
                            if (argValue.GetType() == typeof(string))
                            {
                                writer.WriteString(CreateEscapedValue(argValue as string));
                            }
                            else if (argValue is System.Type)
                            {
                                Type argType = argValue as Type;
                                if (argType.Assembly != null)
                                {
                                    string typePrefix = String.Empty;
                                    XmlQualifiedName typeQualifiedName = serializationManager.GetXmlQualifiedName(argType, out typePrefix);
                                    writer.WriteQualifiedName(XmlConvert.EncodeName(typeQualifiedName.Name), typeQualifiedName.Namespace);
                                }
                                else
                                {
                                    writer.WriteString(argType.FullName);
                                }
                            }
                            else
                            {
                                string stringValue = base.SerializeToString(serializationManager, argValue);
                                if (stringValue != null)
                                    writer.WriteString(stringValue);
                            }
                        }
                    }
                }
            }

            List<PropertyInfo> properties = new List<PropertyInfo>();
            properties.AddRange(GetProperties(serializationManager, value));
            properties.AddRange(serializationManager.GetExtendedProperties(value));
            foreach (PropertyInfo serializableProperty in properties)
            {
                if (Helpers.GetSerializationVisibility(serializableProperty) != DesignerSerializationVisibility.Hidden && serializableProperty.CanRead && serializableProperty.GetValue(value, null) != null)
                {
                    WorkflowMarkupSerializer propSerializer = serializationManager.GetSerializer(serializableProperty.PropertyType, typeof(WorkflowMarkupSerializer)) as WorkflowMarkupSerializer;
                    if (propSerializer == null)
                    {
                        serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerNotAvailable, serializableProperty.PropertyType.FullName)));
                        continue;
                    }

                    if (constructorArguments != null)
                    {
                        object[] attributes = serializableProperty.GetCustomAttributes(typeof(ConstructorArgumentAttribute), false);
                        if (attributes.Length > 0 && constructorArguments.ContainsKey((attributes[0] as ConstructorArgumentAttribute).ArgumentName))
                            // Skip this property, it has already been represented by a constructor parameter
                            continue;
                    }

                    //Get the property serializer so that we can convert the bind object to string
                    serializationManager.Context.Push(serializableProperty);
                    try
                    {
                        object propValue = serializableProperty.GetValue(value, null);
                        if (propSerializer.ShouldSerializeValue(serializationManager, propValue))
                        {
                            //We do not allow nested bind syntax
//.........这里部分代码省略.........
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:101,代码来源:MarkupExtensionSerializer.cs


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