//------------------------------------------------------------------------------
//
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using Windows.UI.Xaml.Markup;
using Windows.UI.Xaml;
using Application2.XamlTypeInfo;
namespace Application2
{
public partial class App : IXamlMetadataProvider
{
private XamlTypeInfoProvider _provider;
public IXamlType GetXamlType(String typeName)
{
if(_provider == null)
{
_provider = new XamlTypeInfoProvider();
}
return _provider.GetXamlTypeByName(typeName);
}
public XmlnsDefinition[] GetXmlnsDefinitions()
{
return new XmlnsDefinition[0];
}
}
}
namespace Application2.XamlTypeInfo
{
internal partial class XamlTypeInfoProvider
{
public IXamlType GetXamlTypeByName(string typeName)
{
if (String.IsNullOrEmpty(typeName))
{
return null;
}
IXamlType xamlType;
if (_xamlTypes.TryGetValue(typeName, out xamlType))
{
return xamlType;
}
xamlType = CreateXamlType(typeName);
if (xamlType != null)
{
_xamlTypes.Add(typeName, xamlType);
}
return xamlType;
}
public IXamlMember GetMemberByLongName(string longMemberName)
{
if (String.IsNullOrEmpty(longMemberName))
{
return null;
}
IXamlMember xamlMember;
if (_xamlMembers.TryGetValue(longMemberName, out xamlMember))
{
return xamlMember;
}
xamlMember = CreateXamlMember(longMemberName);
if (xamlMember != null)
{
_xamlMembers.Add(longMemberName, xamlMember);
}
return xamlMember;
}
Dictionary _xamlTypes = new Dictionary();
Dictionary _xamlMembers = new Dictionary();
private object Activate_0_MainPage() { return new Application2.MainPage(); }
private IXamlType CreateXamlType(string typeName)
{
XamlSystemBaseType xamlType = null;
XamlUserType userType;
switch (typeName)
{
case "Windows.UI.Xaml.Controls.UserControl":
xamlType = new XamlSystemBaseType(typeName, typeof(Windows.UI.Xaml.Controls.UserControl));
break;
case "Application2.MainPage":
userType = new XamlUserType(this, typeName, typeof(Application2.MainPage), GetXamlTypeByName("Windows.UI.Xaml.Controls.UserControl"));
userType.Activator = Activate_0_MainPage;
xamlType = userType;
break;
}
return xamlType;
}
private IXamlMember CreateXamlMember(string longMemberName)
{
XamlMember xamlMember = null;
// No Local Properties
return xamlMember;
}
}
internal class XamlSystemBaseType : IXamlType
{
string _fullName;
Type _underlyingType;
public XamlSystemBaseType(string fullName, Type underlyingType)
{
_fullName = fullName;
_underlyingType = underlyingType;
}
virtual public bool IsSystemType { get { return true; } }
public string FullName { get { return _fullName; } }
public string Name
{
get
{
int idx = _fullName.LastIndexOf('.');
if (idx == -1)
{
return _fullName;
}
return _fullName.Substring(idx + 1);
}
}
public Type UnderlyingType
{
get
{
return _underlyingType;
}
}
virtual public IXamlType BaseType { get { throw new NotImplementedException(); } }
virtual public IXamlMember ContentProperty { get { throw new NotImplementedException(); } }
virtual public IXamlMember GetMember(string name) { throw new NotImplementedException(); }
virtual public bool IsArray { get { throw new NotImplementedException(); } }
virtual public bool IsCollection { get { throw new NotImplementedException(); } }
virtual public bool IsConstructible { get { throw new NotImplementedException(); } }
virtual public bool IsDictionary { get { throw new NotImplementedException(); } }
virtual public bool IsMarkupExtension { get { throw new NotImplementedException(); } }
virtual public IXamlType ItemType { get { throw new NotImplementedException(); } }
virtual public IXamlType KeyType { get { throw new NotImplementedException(); } }
virtual public object ActivateInstance() { throw new NotImplementedException(); }
virtual public void AddToMap(object instance, object key, object item) { throw new NotImplementedException(); }
virtual public void AddToVector(object instance, object item) { throw new NotImplementedException(); }
virtual public void RunInitializer() { throw new NotImplementedException(); }
}
internal delegate object Activator();
internal delegate void AddToCollection(object instance, object item);
internal delegate void AddToDictionary(object instance, object key, object item);
internal class XamlUserType : XamlSystemBaseType
{
XamlTypeInfoProvider _provider;
IXamlType _baseType;
bool _isArray;
bool _isMarkupExtension;
string _contentPropertyName;
string _itemTypeName;
string _keyTypeName;
Dictionary _memberNames;
public XamlUserType(XamlTypeInfoProvider provider, string fullName, Type fullType, IXamlType baseType)
:base(fullName, fullType)
{
_provider = provider;
_baseType = baseType;
}
override public bool IsSystemType { get { return false; } }
override public IXamlType BaseType { get { return _baseType; } }
public Activator Activator { get; set; }
public AddToCollection CollectionAdd { get; set; }
public AddToDictionary DictionaryAdd { get; set; }
public void SetContentPropertyName(string contentPropertyName)
{
_contentPropertyName = contentPropertyName;
}
override public IXamlMember ContentProperty
{
get { return _provider.GetMemberByLongName(_contentPropertyName); }
}
public void SetIsArray() { _isArray = true; }
override public bool IsArray { get { return _isArray; } }
override public bool IsCollection { get { return (CollectionAdd != null); } }
override public bool IsConstructible { get { return (Activator != null); } }
override public bool IsDictionary { get { return (DictionaryAdd != null); } }
public void SetIsMarkupExtension() { _isMarkupExtension = true; }
override public bool IsMarkupExtension { get { return _isMarkupExtension; } }
public void SetItemTypeName(string itemTypeName)
{
_itemTypeName = itemTypeName;
}
override public IXamlType ItemType
{
get { return _provider.GetXamlTypeByName(_itemTypeName); }
}
public void SetKeyTypeName(string keyTypeName)
{
_keyTypeName = keyTypeName;
}
override public IXamlType KeyType
{
get { return _provider.GetXamlTypeByName(_keyTypeName); }
}
public void AddMemberName(string shortName, string longName)
{
if(_memberNames == null)
{
_memberNames = new Dictionary();
}
_memberNames.Add(shortName, longName);
}
override public IXamlMember GetMember(string name)
{
if (_memberNames == null)
{
return null;
}
string longName;
if (_memberNames.TryGetValue(name, out longName))
{
return _provider.GetMemberByLongName(longName);
}
return null;
}
override public object ActivateInstance()
{
return Activator();
}
override public void AddToMap(object instance, object key, object item)
{
DictionaryAdd(instance, key, item);
}
override public void AddToVector(object instance, object item)
{
CollectionAdd(instance, item);
}
override public void RunInitializer()
{
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(UnderlyingType.TypeHandle);
}
}
internal delegate object Getter(object instance);
internal delegate void Setter(object instance, object value);
internal class XamlMember : IXamlMember
{
XamlTypeInfoProvider _provider;
string _name;
bool _isAttachable;
bool _isDependencyProperty;
bool _isReadOnly;
string _typeName;
string _targetTypeName;
public XamlMember(XamlTypeInfoProvider provider, string name, string typeName)
{
_name = name;
_typeName = typeName;
_provider = provider;
}
public string Name { get { return _name; } }
public IXamlType Type
{
get { return _provider.GetXamlTypeByName(_typeName); }
}
public void SetTargetTypeName(String targetTypeName)
{
_targetTypeName = targetTypeName;
}
public IXamlType TargetType
{
get { return _provider.GetXamlTypeByName(_targetTypeName); }
}
public void SetIsAttachable() { _isAttachable = true; }
public bool IsAttachable { get { return _isAttachable; } }
public void SetIsDependencyProperty() { _isDependencyProperty = true; }
public bool IsDependencyProperty { get { return _isDependencyProperty; } }
public void SetIsReadOnly() { _isReadOnly = true; }
public bool IsReadOnly { get { return _isReadOnly; } }
public Getter Getter { get; set; }
public object GetValue(object instance)
{
if (Getter != null)
return Getter(instance);
else
throw new InvalidOperationException("GetValue");
}
public Setter Setter { get; set; }
public void SetValue(object instance, object value)
{
if (Setter != null)
Setter(instance, value);
else
throw new InvalidOperationException("SetValue");
}
}
}