當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。