Add ScriptUI to support XAML file (#320)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / XamlBinding / Internals / ResourceLoader.cs
1 using System;
2 using System.IO;
3 using System.Reflection;
4 using Tizen.NUI.Xaml;
5
6 namespace Tizen.NUI.Binding.Internals
7 {
8     internal static class ResourceLoader
9     {
10         static Func<AssemblyName, string, string> resourceProvider = (asmName, path) =>
11         {
12             string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
13             path = resource + path;
14
15             string ret = File.ReadAllText(path);
16             return ret;
17         };
18
19         //takes a resource path, returns string content
20         public static Func<AssemblyName, string, string> ResourceProvider {
21             get => resourceProvider;
22             internal set {
23                 DesignMode.IsDesignModeEnabled = true;
24                 resourceProvider = value;
25             }
26         }
27
28         internal static Action<Exception> ExceptionHandler { get; set; }
29     }
30 }