From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Wed, 21 Oct 2020 01:13:30 +0000 (+0900) Subject: [NUI] Add FrameComponent dll sample (#2106) X-Git-Tag: accepted/tizen/unified/20210219.040944~339 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e33975222a34e9973d0dc073113216bcc11ff0a0;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add FrameComponent dll sample (#2106) - copy FrameComponentDll to '/opt/usr/' path. - launch app_launcher -s org.tizen.example.NUIComponentApplication __AUL_COMPONENT_ID__ csharp_frame3 Signed-off-by: huiyu.eun --- diff --git a/test/Tizen.NUI.ComponentApplication/FrameComponentDll/FrameComponentDll.cs b/test/Tizen.NUI.ComponentApplication/FrameComponentDll/FrameComponentDll.cs new file mode 100755 index 0000000..64dd3b4 --- /dev/null +++ b/test/Tizen.NUI.ComponentApplication/FrameComponentDll/FrameComponentDll.cs @@ -0,0 +1,65 @@ +using System; +using Tizen.Applications; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; + +namespace FrameComponentDll +{ + + public class MyFrameComponent3 : NUIFrameComponent + { + private TextLabel text; + + public override bool OnCreate() + { + Tizen.Log.Error("MYLOG", "MyFrameComponent OnCreate"); + + Window.BackgroundColor = Color.Yellow; + text = new TextLabel("dll Frame"); + text.HorizontalAlignment = HorizontalAlignment.Center; + text.VerticalAlignment = VerticalAlignment.Bottom; + text.TextColor = Color.Red; + text.PointSize = 30.0f; + text.HeightResizePolicy = ResizePolicyType.FillToParent; + text.WidthResizePolicy = ResizePolicyType.FillToParent; + Window.Add(text); + return true; + } + + + public override void OnDestroy() + { + Tizen.Log.Error("MYLOG", "MyFrameComponent OnDestroy"); + text.Dispose(); + } + + public override void OnPause() + { + Tizen.Log.Error("MYLOG", "MyFrameComponent OnPause"); + } + + public override void OnResume() + { + Tizen.Log.Error("MYLOG", "MyFrameComponent OnResume"); + } + + public override void OnStart(AppControl appControl, bool restarted) + { + Tizen.Log.Error("MYLOG", "MyFrameComponent OnStart"); + } + + public override void OnStop() + { + Tizen.Log.Error("MYLOG", "MyFrameComponent OnStop"); + } + + public void ChangeSharedText(string strText) + { + text.Text = strText; + } + + static void Main(string[] args) + { + } + } +} diff --git a/test/Tizen.NUI.ComponentApplication/FrameComponentDll/FrameComponentDll.csproj b/test/Tizen.NUI.ComponentApplication/FrameComponentDll/FrameComponentDll.csproj new file mode 100755 index 0000000..9251a43 --- /dev/null +++ b/test/Tizen.NUI.ComponentApplication/FrameComponentDll/FrameComponentDll.csproj @@ -0,0 +1,24 @@ + + + + Exe + netcoreapp2.0 + + + + portable + + + None + + + + + + + + + + + + diff --git a/test/Tizen.NUI.ComponentApplication/FrameComponentDll/shared/res/FrameComponentDll.png b/test/Tizen.NUI.ComponentApplication/FrameComponentDll/shared/res/FrameComponentDll.png new file mode 100755 index 0000000..9f3cb98 Binary files /dev/null and b/test/Tizen.NUI.ComponentApplication/FrameComponentDll/shared/res/FrameComponentDll.png differ diff --git a/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/NUIComponentApplication.cs b/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/NUIComponentApplication.cs index cd5eb19..9bccab8 100755 --- a/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/NUIComponentApplication.cs +++ b/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/NUIComponentApplication.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.IO; +using System.Reflection; using Tizen.Applications; using Tizen.NUI; using Tizen.NUI.BaseComponents; @@ -136,13 +138,39 @@ namespace NUIComponentApplicationSample } } + static private Type LoadFrameComponentDll() + { + string path = @"/opt/usr/FrameComponentDll.dll"; + FileInfo fi = new FileInfo(path); + if (fi.Exists) + { + Assembly assembly = Assembly.LoadFile(path); + if (assembly != null) + { + Module[] modules = assembly.GetModules(); + Type frameComponent3 = modules[0].GetType("FrameComponentDll.MyFrameComponent3"); + return frameComponent3; + } + } + return null; + } + static void Main(string[] args) { + Dictionary dict = new Dictionary(); dict.Add(typeof(MyFrameComponent), "csharp_frame"); dict.Add(typeof(MyFrameComponent2), "csharp_frame2"); - var app = new Program(dict); + Type type = LoadFrameComponentDll(); + if (type != null) + { + Tizen.Log.Error("MYLOG", "Add type : " + type); + dict.Add(type, "csharp_frame3"); + } + + + var app = new Program(dict); app.Run(args); app.Dispose(); }