public static T LoadFromEXamlByRelativePath<T>(this T view, string eXamlPath) { if (null == eXamlPath) { return view; } MainAssembly = view.GetType().Assembly; string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource; Tizen.Log.Fatal("NUI", "the resource path: " + resource); int windowWidth = NUIApplication.GetDefaultWindow().Size.Width; int windowHeight = NUIApplication.GetDefaultWindow().Size.Height; string likelyResourcePath = resource + eXamlPath; //Find the xaml file in the layout folder if (File.Exists(likelyResourcePath)) { StreamReader reader = new StreamReader(likelyResourcePath); var xaml = reader.ReadToEnd(); reader.Close(); reader.Dispose(); LoadEXaml.Load(view, xaml); } else { throw new Exception($"Can't find examl file {eXamlPath}"); } return view; }
public static TXaml LoadFromEXamlPath<TXaml>(this TXaml view, string path) { MainAssembly = view.GetType().Assembly; //This EXaml file will be converted by Tizen.NUI.XamlBuild from the .xaml string xamlScript = GetXamlFromPath(path); LoadEXaml.Load(view, xamlScript); return view; }
public static T LoadFromEXaml<T>(this T view, string eXamlStr) { if (null == eXamlStr) { return view; } MainAssembly = view.GetType().Assembly; LoadEXaml.Load(view, eXamlStr); return view; }
public static object CreateObjectFromEXaml(string eXamlStr) { if (null == eXamlStr) { return(null); } //MainAssembly = view.GetType().Assembly; object temp = null; GlobalDataList eXamlData = null; LoadEXaml.Load(temp, eXamlStr, out eXamlData); return(eXamlData.Root); }
public static object LoadFromEXamlByRelativePath <T>(this T view, string eXamlPath) { GlobalDataList eXamlData = null; if (null == eXamlPath) { return(eXamlData); } MainAssembly = view.GetType().Assembly; string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource; Tizen.Log.Fatal("NUI", "the resource path: " + resource); int windowWidth = NUIApplication.GetDefaultWindow().Size.Width; int windowHeight = NUIApplication.GetDefaultWindow().Size.Height; string likelyResourcePath = resource + eXamlPath; //Find the xaml file in the layout folder if (File.Exists(likelyResourcePath)) { StreamReader reader = new StreamReader(likelyResourcePath); var xaml = reader.ReadToEnd(); reader.Close(); reader.Dispose(); LoadEXaml.Load(view, xaml, out eXamlData); var filePath = likelyResourcePath.Replace("\\", "/"); if (filePath.Contains("/")) { var xamlName = filePath.Substring(filePath.LastIndexOf("/") + 1, filePath.LastIndexOf(".") - filePath.LastIndexOf("/") - 1); NUIApplication.CurrentLoadedXaml = xamlName; } } else { throw new Exception($"Can't find examl file {likelyResourcePath}"); } return(eXamlData); }
public static T LoadFromEXamlPath <T>(this T view, Type callingType) { if (null == callingType) { return(view); } MainAssembly = view.GetType().Assembly; string resourceName = callingType.Name + ".examl"; string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource; Tizen.Log.Fatal("NUI", "the resource path: " + resource); int windowWidth = NUIApplication.GetDefaultWindow().Size.Width; int windowHeight = NUIApplication.GetDefaultWindow().Size.Height; string likelyResourcePath = resource + "layout/" + windowWidth.ToString() + "x" + windowHeight.ToString() + "/" + resourceName; Tizen.Log.Fatal("NUI", "the resource path: " + likelyResourcePath); if (!File.Exists(likelyResourcePath)) { likelyResourcePath = resource + "layout/" + resourceName; } //Find the xaml file in the layout folder if (File.Exists(likelyResourcePath)) { StreamReader reader = new StreamReader(likelyResourcePath); var xaml = reader.ReadToEnd(); reader.Close(); reader.Dispose(); LoadEXaml.Load(view, xaml); } return(view); }