Universal Windows Program XMAL Services (Type System) Internal - Part 1

Introduction

Universal Windows Program XAML Services explain about how XAML Page is working like loading & showing on GUI, how the application object is storing the page object in memory & response to the GUI, once user has requested to the page, and how the application object  react & load the page and datatype.

This XAML Services file created by the XamlTypeInvoker.

In this article I have two parts, first part explains about the class, what are classes & interface. Next part explains about the internal working of the class.

Windows Runtime is not a NET Framework, it’s completely based on the native COM based API system. You can use the NET Framework or any other language like JavaScript or native C++ to create Windows Runtime application.

Type System

In .NET Framework all languages has target to the CLR type system and how windows runtime type system handled?
Answer: In Windows runtime type systems are handled via XMAL Services.

IXmalMember & IXmalType interfaces are the contract partners used extensively in the .NET Framework XAML Services API to get the XAML type information.

XamlTypeInvoker:
Creating schema classes ( like XamlType , XamlSystemBaseType).

Application Object Job

Application (GUI) running on top of the application object, application object interacts XAML Services to get the runtime information.

In GUI request to the application object to load the page, once request has received from the GUI, application object internally check the XAML provider to load the page which is requested by GUI.

Application Object Job

Upcoming information about the classes which handle XMAL Services & its working we will see in the next article.

XamlTypeInfoProvider

Once Application object has received request from GUI, how application object response? Where the information is available?
Answer: XamlTypeInfoProvider class, Application object maintains the XamlTypeInfoProvider object and store all the information like Page, datatype information

XamlTypeInfoProvider in details

XamlTypeInfoProvider

Note:
In this article all are sample code, based on the application which is created by the user may differ.

All the page information & types has maintained in the string & type array.

Page: In Windows store development consider all XAML file as page only.

Windows store development

string

_typeNameTable string array maintains all the page, control, datatype names:

  1. Above string array: App6.MainPage, App6.MainPage1 (xaml pages) & String datatype added by developer.
  2. Windows.UI.Xmal.Controls.Page and Windows.UI.Xmal.Controls.Usercontrol added by the application.

_typeTable maintains the type of each page and datatype.

maintains the type

Note: All the items in the _typeTable and _typeNameTable array are unique.

Ex: If you define two string datatype this class internally consider as only one string datatype.

The above array is like blue print of the application, that means, it just contains only the information about the Page and datatype, not the create object. (Consider as if you add new page in the project, this page name & data type added into the above array table).

Note: If I add the page in my application, automatically add into array, NO: it’s just an example about the array, once you compile the application above array get fill.

Application object, create object for the Page, this created object maintained in the separate cache dictionary.

cache dictionary

_xamlTypeCacheByName

Maintains the IXmalType object.

Example:

Key:
App6.MainPage, Value: IXmalType object

_xamlTypeCacheByType

MainPage

_xamlTypeCachebyType dictionary maintains the UnderlyingType and the IXamlType object.

_xamlMembers

dictionary

Maintains all the datatypes.

So far, we understood how the page & page object maitained in the XamlTypeInfoProvider class.

LookUp functions

This function is used to check the blue print array whether requested page or data type is available or not.

Based on the Page string (ex: App6.MainPage is available or not).

LookUpTypeIndexByName function check the typeName in the _typeNameTable string array and return the Index of string position.

LookUpTypeIndexByName

LookupTypeIndexByType function check the _typeTable based on the type passed as the argument and return the Index of the _typeTable array.
LookupTypeIndexByType

Page Object

Initial time page object is NULL, creating the Page Object take care by the CreateXmalType function

Page Object

Note: Creating the Page object return as IXmalType, Mainly XAML Services system playing major role here, all the Page object maintained in the IXmalType (next article we will see in details).

So far details about the Handling of the XamlTypeInfoProvider class, below class information about the remaining part of the XMAL Services,

Here I just mentioned only the class information. The details will be covered in the next part of the article.

IXmalMember:

Datatype handling in the IXamlMember & XamlMember class,

IXmalMember

Handling the custom datatype (ex: String datatype also consider as custom datatype).

Set and Get defined in the delegate.

delegate

Attachable, Dependency Property & Read-only handling inside XamlMembers

XamlMembers

XamlSystemBaseType

Base Page object, XMAL Services maintained as the XamlSystemBaseType inherits from IXmalType

XamlSystemBaseType

XamlUserType

App6.MainPage object, XMAL Services maintained in the XamlUserType class and inherits from the XamlSystemBasetype

XamlUserType

Conclusion

All the information about the XMAL Services class. In the next article we will see how is class working.


Similar Articles