[NUI] Add Component Application sample (#2097)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Tue, 13 Oct 2020 08:42:23 +0000 (17:42 +0900)
committerGitHub <noreply@github.com>
Tue, 13 Oct 2020 08:42:23 +0000 (17:42 +0900)
app_launcher -s org.tizen.example.NUIComponentApplication __AUL_COMPONENT_ID__ csharp_frame

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
test/Tizen.NUI.ComponentApplication/NUIComponentApplication/NUIComponentApplication.cs [new file with mode: 0755]
test/Tizen.NUI.ComponentApplication/NUIComponentApplication/NUIComponentApplication.csproj [new file with mode: 0755]
test/Tizen.NUI.ComponentApplication/NUIComponentApplication/shared/res/NUIComponentApplication.png [new file with mode: 0755]
test/Tizen.NUI.ComponentApplication/NUIComponentApplication/tizen-manifest.xml [new file with mode: 0755]

diff --git a/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/NUIComponentApplication.cs b/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/NUIComponentApplication.cs
new file mode 100755 (executable)
index 0000000..cd5eb19
--- /dev/null
@@ -0,0 +1,150 @@
+using System;
+using System.Collections.Generic;
+using Tizen.Applications;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+namespace NUIComponentApplicationSample
+{
+    public class Program : NUIComponentApplication
+    {
+        public static MyFrameComponent myFrame1 = null;
+        public static MyFrameComponent2 myFrame2 = null;
+
+        public Program(IDictionary<Type, string> typeInfo) : base(typeInfo)
+        {
+        }
+
+        public class MyFrameComponent : NUIFrameComponent
+        {
+            private TextLabel text;
+            private Animation animation;
+
+            public override bool OnCreate()
+            {
+                myFrame1 = this;
+                Tizen.Log.Error("MYLOG", "MyFrameComponent OnCreate");
+
+                Window.BackgroundColor = Color.White;
+                text = new TextLabel("First Frame");
+                text.HorizontalAlignment = HorizontalAlignment.Center;
+                text.VerticalAlignment = VerticalAlignment.Bottom;
+                text.TextColor = Color.Blue;
+                text.PointSize = 12.0f;
+                text.HeightResizePolicy = ResizePolicyType.FillToParent;
+                text.WidthResizePolicy = ResizePolicyType.FillToParent;
+                Window.Add(text);
+
+                animation = new Animation(2000);
+                animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500);
+                animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000);
+                animation.Looping = true;
+                animation.Play();
+                return true;
+            }
+
+            
+            public override void OnDestroy()
+            {
+                Tizen.Log.Error("MYLOG", "MyFrameComponent OnDestroy");
+                text.Dispose();
+                animation.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;
+            }
+
+        }
+        public class MyFrameComponent2 : NUIFrameComponent
+        {
+            private TextLabel text;
+            private Animation animation;
+
+            public override bool OnCreate()
+            {
+                myFrame2 = this;
+                Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnCreate");
+                Window.BackgroundColor = Color.Red;
+                Window.WindowSize = new Size(360, 180);
+                Window.Instance.TouchEvent += Instance_TouchEvent;
+                text = new TextLabel("Second Frame");
+                text.HorizontalAlignment = HorizontalAlignment.Center;
+                text.VerticalAlignment = VerticalAlignment.Center;
+                text.TextColor = Color.Blue;
+                text.PointSize = 12.0f;
+                text.HeightResizePolicy = ResizePolicyType.FillToParent;
+                text.WidthResizePolicy = ResizePolicyType.FillToParent;
+                Window.Add(text);
+                return true;
+            }
+
+            private void Instance_TouchEvent(object sender, Window.TouchEventArgs e)
+            {
+                if(e.Touch.GetState(0) == PointStateType.Up)
+                {
+                    myFrame1?.ChangeSharedText("Change - text");
+                }
+            }
+
+            public override void OnDestroy()
+            {
+                Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnDestroy");
+                text.Dispose();
+                animation.Dispose();
+            }
+
+            public override void OnPause()
+            {
+                Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnPause");
+            }
+
+            public override void OnResume()
+            {
+                Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnResume");
+            }
+
+            public override void OnStart(AppControl appControl, bool restarted)
+            {
+                Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnStart");
+            }
+
+            public override void OnStop()
+            {
+                Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnStop");
+            }
+        }
+
+        static void Main(string[] args)
+        {
+            Dictionary<Type, string> dict = new Dictionary<Type, string>();
+            dict.Add(typeof(MyFrameComponent), "csharp_frame");
+            dict.Add(typeof(MyFrameComponent2), "csharp_frame2");
+            var app = new Program(dict);
+
+            app.Run(args);
+            app.Dispose();
+        }
+    }
+}
diff --git a/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/NUIComponentApplication.csproj b/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/NUIComponentApplication.csproj
new file mode 100755 (executable)
index 0000000..91a27f7
--- /dev/null
@@ -0,0 +1,26 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp2.0</TargetFramework>
+  </PropertyGroup>
+
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugType>portable</DebugType>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>None</DebugType>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Folder Include="lib\" />
+    <Folder Include="res\" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\src\Tizen.NUI\Tizen.NUI.csproj" />
+    <PackageReference Include="Tizen.NET.Sdk" Version="1.0.0" />
+  </ItemGroup>
+
+</Project>
+
diff --git a/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/shared/res/NUIComponentApplication.png b/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/shared/res/NUIComponentApplication.png
new file mode 100755 (executable)
index 0000000..9f3cb98
Binary files /dev/null and b/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/shared/res/NUIComponentApplication.png differ
diff --git a/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/tizen-manifest.xml b/test/Tizen.NUI.ComponentApplication/NUIComponentApplication/tizen-manifest.xml
new file mode 100755 (executable)
index 0000000..4630a02
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="5" package="org.tizen.example.NUIComponentApplication" version="1.0.0">
+  <profile name="common" />
+  <component-based-application  appid="org.tizen.example.NUIComponentApplication"
+                                       exec="NUIComponentApplication.dll"
+                                       type="dotnet"
+                                       multiple="false"
+                                       taskmanage="true"
+                                       nodisplay="false"
+                                       launch_mode="single">
+    <label>NUIComponentApplication</label>
+    <icon>NUIComponentApplication.png</icon>
+    <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
+    
+    <frame-component id="csharp_frame" launch_mode="caller" main="true" icon-display="false" taskmanage="true">
+      <icon>org.tizen.sample.png</icon>
+      <label>FrameComponent</label>
+      <label xml:lang="en-us">FrameComponent</label>
+      <label xml:lang="ko-kr">FrameComponent[KOR]</label>
+    </frame-component>
+   <frame-component id="csharp_frame2" launch_mode="caller" main="false" icon-display="false" taskmanage="true">
+      <icon>org.tizen.sample.png</icon>
+      <label>FrameComponent2</label>
+      <label xml:lang="en-us">FrameComponent2</label>
+      <label xml:lang="ko-kr">FrameComponent2[KOR]</label>
+    </frame-component>
+   <frame-component id="csharp_frame3" launch_mode="caller" main="false" icon-display="false" taskmanage="true">
+      <icon>org.tizen.sample.png</icon>
+      <label>FrameComponent3</label>
+      <label xml:lang="en-us">FrameComponent3</label>
+      <label xml:lang="ko-kr">FrameComponent3[KOR]</label>
+    </frame-component>
+  </component-based-application >
+</manifest>