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>()) {
37 if (xria.Type == type)
38 return xria.ResourceId;
43 internal static string GetPathForType(Type type)
45 var assembly = type.GetTypeInfo().Assembly;
46 foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
47 if (xria.Type == type)
53 internal static string GetResourceIdForPath(Assembly assembly, string path)
55 foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
56 if (xria.Path == path)
57 return xria.ResourceId;
62 internal static Type GetTypeForResourceId(Assembly assembly, string resourceId)
64 foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
65 if (xria.ResourceId == resourceId)
71 internal static Type GetTypeForPath(Assembly assembly, string path)
73 foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
74 if (xria.Path == path)