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


C# Xaml.XamlSchemaContext类代码示例

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


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

示例1: WpfKnownType

 public WpfKnownType(XamlSchemaContext schema,
     int bamlNumber, 
     string name,
     Type underlyingType)
     : this(schema, bamlNumber, name, underlyingType, true, true)
 { 
 }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:7,代码来源:WpfKnownType.cs

示例2: XamlObjectWriter

		public XamlObjectWriter (XamlSchemaContext schemaContext, XamlObjectWriterSettings settings)
		{
			if (schemaContext == null)
				throw new ArgumentNullException ("schemaContext");
			this.sctx = schemaContext;
			this.settings = settings ?? new XamlObjectWriterSettings ();
		}
开发者ID:stabbylambda,项目名称:mono,代码行数:7,代码来源:XamlObjectWriter.cs

示例3: ReadWriteListShouldRoundtrip

		public void ReadWriteListShouldRoundtrip()
		{
			var sc = new XamlSchemaContext();
			var list = new XamlNodeList(sc);

			var reader = new XamlObjectReader(new TestClass4 { Foo = "foo", Bar = "bar" }, sc);
			XamlServices.Transform(reader, list.Writer);

			var writer = new XamlObjectWriter(sc);
			var listReader = list.GetReader();
			XamlServices.Transform(listReader, writer);

			Assert.IsNotNull(writer.Result, "#1");
			Assert.IsInstanceOf<TestClass4>(writer.Result, "#2");

			Assert.AreEqual("foo", ((TestClass4)writer.Result).Foo, "#3");
			Assert.AreEqual("bar", ((TestClass4)writer.Result).Bar, "#4");

			// try reading a 2nd time, we should not get the same reader
			writer = new XamlObjectWriter(sc);
			var listReader2 = list.GetReader();
			Assert.AreNotSame(listReader, listReader2, "#5");
			XamlServices.Transform(listReader2, writer);

			Assert.IsNotNull(writer.Result, "#6");
			Assert.IsInstanceOf<TestClass4>(writer.Result, "#7");

			Assert.AreEqual("foo", ((TestClass4)writer.Result).Foo, "#8");
			Assert.AreEqual("bar", ((TestClass4)writer.Result).Bar, "#9");
		}
开发者ID:cwensley,项目名称:Portable.Xaml,代码行数:30,代码来源:XamlNodeListTest.cs

示例4: DynamicActivityXamlReader

        public DynamicActivityXamlReader(bool isBuilder, XamlReader innerReader, XamlSchemaContext schemaContext)
            : base()
        {
            this.isBuilder = isBuilder;
            this.innerReader = innerReader;
            this.schemaContext = schemaContext ?? innerReader.SchemaContext;

            this.xamlTypeXamlType = this.schemaContext.GetXamlType(typeof(XamlType));
            this.typeXamlType = this.schemaContext.GetXamlType(typeof(Type));

            this.baseActivityXamlType = this.schemaContext.GetXamlType(typeof(Activity));
            this.activityPropertyXamlType = this.schemaContext.GetXamlType(typeof(DynamicActivityProperty));
            this.activityPropertyType = this.activityPropertyXamlType.GetMember("Type");
            this.activityPropertyName = this.activityPropertyXamlType.GetMember("Name");
            this.activityPropertyValue = this.activityPropertyXamlType.GetMember("Value");
            this.activityPropertyAttributes = this.activityPropertyXamlType.GetMember("Attributes");

            this.namespaceTable = new NamespaceTable();
            this.frontLoadedDirectives = true;

            // we pump items through this node-list when rewriting
            this.nodeQueue = new XamlNodeQueue(this.schemaContext);
            this.nodeReader = this.nodeQueue.Reader;
            IXamlLineInfo lineInfo = innerReader as IXamlLineInfo;
            if (lineInfo != null && lineInfo.HasLineInfo)
            {
                this.innerReaderLineInfo = lineInfo;
                this.nodeReaderLineInfo = (IXamlLineInfo)nodeQueue.Reader;
                this.hasLineInfo = true;
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:31,代码来源:DynamicActivityXamlReader.cs

示例5: XamlWriterInternalBase

		public XamlWriterInternalBase (XamlSchemaContext schemaContext, XamlWriterStateManager manager)
		{
			this.sctx = schemaContext;
			this.manager = manager;
			var p = new PrefixLookup (sctx) { IsCollectingNamespaces = true }; // it does not raise unknown namespace error.
			service_provider = new ValueSerializerContext (p, schemaContext, AmbientProvider);
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:XamlWriterInternalBase.cs

示例6: ReaderDelegate

 public ReaderDelegate(XamlSchemaContext schemaContext, XamlNodeNextDelegate next, bool hasLineInfo) : base(schemaContext)
 {
     this._nextDelegate = next;
     base._currentNode = new XamlNode(XamlNode.InternalNodeType.StartOfStream);
     base._currentLineInfo = null;
     base._hasLineInfo = hasLineInfo;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ReaderDelegate.cs

示例7: XamlNsReplacingType

 public XamlNsReplacingType(Type underlyingType, XamlSchemaContext context, string localAssemblyName, string realAssemblyName)
     : base(underlyingType, context)
 {
     this.localAssemblyName = localAssemblyName;
     this.realAssemblyName = realAssemblyName;
     namespaces = null;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:WrappingXamlSchemaContext.cs

示例8: XamlObjectReader

		public XamlObjectReader (object instance, XamlSchemaContext schemaContext, XamlObjectReaderSettings settings)
		{
			if (schemaContext == null)
				throw new ArgumentNullException ("schemaContext");
			// FIXME: special case? or can it be generalized? In .NET, For Type instance Instance returns TypeExtension at root StartObject, while for Array it remains to return Array.
			if (instance is Type)
				instance = new TypeExtension ((Type) instance);

			// See also Instance property for this weirdness.
			this.root_raw = instance;
			instance = TypeExtensionMethods.GetExtensionWrapped (instance);
			this.root = instance;

			sctx = schemaContext;
//			this.settings = settings;

			// check type validity. Note that some checks also needs done at Read() phase. (it is likely FIXME:)
			if (instance != null) {
				var type = new InstanceContext (instance).GetRawValue ().GetType ();
				if (!type.IsPublic)
					throw new XamlObjectReaderException (String.Format ("instance type '{0}' must be public and non-nested.", type));
				var xt = SchemaContext.GetXamlType (type);
				if (xt.ConstructionRequiresArguments && !xt.GetConstructorArguments ().Any () && xt.TypeConverter == null)
					throw new XamlObjectReaderException (String.Format ("instance type '{0}' has no default constructor.", type));
			}

			value_serializer_context = new ValueSerializerContext (new PrefixLookup (sctx), sctx, null);
			new XamlObjectNodeIterator (instance, sctx, value_serializer_context).PrepareReading ();
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:29,代码来源:XamlObjectReader.cs

示例9: GetFirstAmbientValue

 public AmbientPropertyValue GetFirstAmbientValue(IEnumerable<XamlType> ceilingTypes, params XamlMember[] properties)
 {
     var context = new XamlSchemaContext();
     var type = context.GetXamlType(typeof (Setter));
     var member = type.GetMember("TargetType");
     return new AmbientPropertyValue(member, typeof (Button));
 }
开发者ID:modulexcite,项目名称:OmniXAML,代码行数:7,代码来源:TypeDescriptorContext.cs

示例10: DynamicActivityXamlReader

 public DynamicActivityXamlReader(bool isBuilder, XamlReader innerReader, XamlSchemaContext schemaContext)
 {
     this.isBuilder = isBuilder;
     this.innerReader = innerReader;
     this.schemaContext = schemaContext ?? innerReader.SchemaContext;
     this.xamlTypeXamlType = this.schemaContext.GetXamlType(typeof(XamlType));
     this.typeXamlType = this.schemaContext.GetXamlType(typeof(System.Type));
     this.baseActivityXamlType = this.schemaContext.GetXamlType(typeof(Activity));
     this.activityPropertyXamlType = this.schemaContext.GetXamlType(typeof(DynamicActivityProperty));
     this.activityPropertyType = this.activityPropertyXamlType.GetMember("Type");
     this.activityPropertyName = this.activityPropertyXamlType.GetMember("Name");
     this.activityPropertyValue = this.activityPropertyXamlType.GetMember("Value");
     this.activityPropertyAttributes = this.activityPropertyXamlType.GetMember("Attributes");
     this.namespaceTable = new NamespaceTable();
     this.frontLoadedDirectives = true;
     this.nodeQueue = new XamlNodeQueue(this.schemaContext);
     this.nodeReader = this.nodeQueue.Reader;
     IXamlLineInfo info = innerReader as IXamlLineInfo;
     if ((info != null) && info.HasLineInfo)
     {
         this.innerReaderLineInfo = info;
         this.nodeReaderLineInfo = (IXamlLineInfo) this.nodeQueue.Reader;
         this.hasLineInfo = true;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:DynamicActivityXamlReader.cs

示例11: XamlObjectReader

		public XamlObjectReader (object instance, XamlSchemaContext schemaContext, XamlObjectReaderSettings settings)
		{
			if (schemaContext == null)
				throw new ArgumentNullException ("schemaContext");
			// FIXME: special case? or can it be generalized? In .NET, For Type instance Instance returns TypeExtension at root StartObject, while for Array it remains to return Array.
			if (instance is Type)
				instance = new TypeExtension ((Type) instance);

			this.root = instance;
			sctx = schemaContext;
			this.settings = settings;

			prefix_lookup = new PrefixLookup (sctx);

			// check type validity. Note that some checks also needs done at Read() phase. (it is likely FIXME:)
			if (instance != null) {
				var type = new InstanceContext (instance).GetWrappedValue ().GetType ();
				if (!type.IsPublic)
					throw new XamlObjectReaderException (String.Format ("instance type '{0}' must be public and non-nested.", type));
				var xt = SchemaContext.GetXamlType (type);
				if (xt.ConstructionRequiresArguments && !xt.GetConstructorArguments ().Any () && xt.TypeConverter == null)
					throw new XamlObjectReaderException (String.Format ("instance type '{0}' has no default constructor.", type));
			}

			new XamlObjectNodeIterator (instance, sctx, prefix_lookup).CollectNamespaces ();
		}
开发者ID:davidwaters,项目名称:mono,代码行数:26,代码来源:XamlObjectReader.cs

示例12: XamlNodeQueue

		public XamlNodeQueue (XamlSchemaContext schemaContext)
		{
			if (schemaContext == null)
				throw new ArgumentNullException ("schemaContext");
			this.ctx = schemaContext;
			reader = new XamlNodeQueueReader (this);
			writer = new XamlNodeQueueWriter (this);
		}
开发者ID:nagyist,项目名称:XamlForIphone,代码行数:8,代码来源:XamlNodeQueue.cs

示例13: XamlObjectWriter

 public XamlObjectWriter(XamlSchemaContext schemaContext, XamlObjectWriterSettings settings)
 {
     if (schemaContext == null)
     {
         throw new ArgumentNullException("schemaContext");
     }
     this.Initialize(schemaContext, null, settings);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XamlObjectWriter.cs

示例14: WriterShouldThrowExceptionIfNotClosed

		public void WriterShouldThrowExceptionIfNotClosed()
		{
			var sc = new XamlSchemaContext();
			var list = new XamlNodeList(sc);
			list.Writer.WriteStartObject(sc.GetXamlType(typeof(TestClass4)));
			list.Writer.WriteEndObject();
			Assert.Throws<XamlException> (() => list.GetReader());
		}
开发者ID:cwensley,项目名称:Portable.Xaml,代码行数:8,代码来源:XamlNodeListTest.cs

示例15: ReaderBaseDelegate

 protected ReaderBaseDelegate(XamlSchemaContext schemaContext)
 {
     if (schemaContext == null)
     {
         throw new ArgumentNullException("schemaContext");
     }
     this._schemaContext = schemaContext;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ReaderBaseDelegate.cs


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