2 using System.ComponentModel;
3 using System.Reflection;
5 namespace Tizen.NUI.Xaml
7 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
8 [EditorBrowsable(EditorBrowsableState.Never)]
9 [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
10 public sealed class XamlResourceIdAttribute : Attribute
12 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
13 [EditorBrowsable(EditorBrowsableState.Never)]
14 public string ResourceId { get; set; }
16 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
17 [EditorBrowsable(EditorBrowsableState.Never)]
18 public string Path { get; set; }
20 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
21 [EditorBrowsable(EditorBrowsableState.Never)]
22 public Type Type { get; set; }
24 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
25 [EditorBrowsable(EditorBrowsableState.Never)]
26 public XamlResourceIdAttribute(string resourceId, string path, Type type)
28 ResourceId = resourceId;
33 internal static string GetResourceIdForType(Type type)
35 var assembly = type.GetTypeInfo().Assembly;
36 foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>())
38 if (xria.Type == type)
39 return xria.ResourceId;
44 internal static string GetPathForType(Type type)
46 var assembly = type.GetTypeInfo().Assembly;
47 foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>())
49 if (xria.Type == type)
55 internal static string GetResourceIdForPath(Assembly assembly, string path)
57 foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>())
59 if (xria.Path == path)
60 return xria.ResourceId;
65 internal static Type GetTypeForResourceId(Assembly assembly, string resourceId)
67 foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>())
69 if (xria.ResourceId == resourceId)
75 internal static Type GetTypeForPath(Assembly assembly, string path)
77 foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>())
79 if (xria.Path == path)