[NUI] Add Component Application (#1148)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Fri, 29 Nov 2019 05:25:42 +0000 (14:25 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 29 Nov 2019 05:25:42 +0000 (14:25 +0900)
* Add component

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* Change Bug

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI]Modify Last

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* Add to mange frame component

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* Change Sln file

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* Change mod

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* Change sln

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] fix comment

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.Applications.ComponentBased/AssemblyAttr.cs [new file with mode: 0755]
src/Tizen.NUI/Tizen.NUI.csproj
src/Tizen.NUI/Tizen.NUI.sln
src/Tizen.NUI/src/internal/ComponentApplication.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.ComponentApplication.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.Window.cs
src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/NUIWindowInfo.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/NUIComponentApplication.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/NUIFrameComponent.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/Window.cs

diff --git a/src/Tizen.Applications.ComponentBased/AssemblyAttr.cs b/src/Tizen.Applications.ComponentBased/AssemblyAttr.cs
new file mode 100755 (executable)
index 0000000..4134475
--- /dev/null
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using System.Runtime.CompilerServices;
+
+[assembly: InternalsVisibleTo("Tizen.NUI, " + PublicKey.Value)]
+
+internal static class PublicKey
+{
+    internal const string Value =
+        "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" +
+        "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" +
+        "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" +
+        "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2";
+}
\ No newline at end of file
index 18c7bc6..7df2266 100755 (executable)
@@ -14,6 +14,7 @@
 
   <ItemGroup>
     <ProjectReference Include="..\Tizen.Applications.Common\Tizen.Applications.Common.csproj" />
+    <ProjectReference Include="..\Tizen.Applications.ComponentBased\Tizen.Applications.ComponentBased.csproj" />
     <ProjectReference Include="..\Tizen.System.SystemSettings\Tizen.System.SystemSettings.csproj" />
   </ItemGroup>
 
index b086733..bcf6ac3 100755 (executable)
@@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\T
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.ComponentBased", "..\Tizen.Applications.ComponentBased\Tizen.Applications.ComponentBased.csproj", "{A9B4744E-EECC-44B6-8357-843DD20617EC}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
diff --git a/src/Tizen.NUI/src/internal/ComponentApplication.cs b/src/Tizen.NUI/src/internal/ComponentApplication.cs
new file mode 100755 (executable)
index 0000000..ed07bcb
--- /dev/null
@@ -0,0 +1,193 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace Tizen.NUI
+{
+    class ComponentApplication : Application
+    {
+        private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+        private List<NUIFrameComponent> _frameComponentList;
+        private static ComponentApplication _instance; //singleton
+
+        internal ComponentApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        {
+            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+            _frameComponentList = new List<NUIFrameComponent>();
+        }
+
+        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ComponentApplication obj)
+        {
+            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            //Release your own unmanaged resources here.
+            //You should not access any managed member here except static instance.
+            //because the execution order of Finalizes is non-deterministic.
+            if (swigCPtr.Handle != global::System.IntPtr.Zero)
+            {
+                if (swigCMemOwn)
+                {
+                    swigCMemOwn = false;
+                    Interop.ComponentApplication.delete_ComponentApplication(swigCPtr);
+                }
+                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            base.Dispose(type);
+        }
+
+        public new static ComponentApplication Instance
+        {
+            get
+            {
+                return _instance;
+            }
+        }
+
+        public static ComponentApplication NewComponentApplication(string[] args, string stylesheet)
+        {
+            ComponentApplication ret = New(args, stylesheet);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            _instance = ret;
+            return ret;
+        }
+
+        public static ComponentApplication New(string[] args, string stylesheet)
+        {
+            int argc = args.Length;
+            string argvStr = string.Join(" ", args);
+
+            IntPtr widgetIntPtr = Interop.ComponentApplication.ComponentApplication_New(argc, argvStr, stylesheet);
+
+            ComponentApplication ret = new ComponentApplication(widgetIntPtr, false);
+
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+            return ret;
+        }
+
+        internal ComponentApplication(ComponentApplication componentApplication) : this(Interop.ComponentApplication.new_ComponentApplication__SWIG_1(ComponentApplication.getCPtr(componentApplication)), true)
+        {
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        internal ComponentApplication Assign(ComponentApplication componentApplication)
+        {
+            ComponentApplication ret = new ComponentApplication(Interop.ComponentApplication.ComponentApplication_Assign(swigCPtr, ComponentApplication.getCPtr(componentApplication)), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+               
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        private delegate IntPtr NUIComponentApplicationCreatenativeEventCallbackDelegate(IntPtr data);
+
+               public delegate IntPtr CreateNativeEventHandler(IntPtr data);
+               private CreateNativeEventHandler _applicationCreateNativeEventHandler;
+        private NUIComponentApplicationCreatenativeEventCallbackDelegate _applicationCreateNativeEventCallbackDelegate;
+               
+
+        /**
+          * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
+          *  provided by the user. Initialized signal is emitted when application is initialised
+          */
+        public event CreateNativeEventHandler CreateNative
+        {
+            add
+            {
+                lock (this)
+                {
+                    // Restricted to only one listener
+                    if (_applicationCreateNativeEventHandler == null)
+                    {
+                        _applicationCreateNativeEventHandler += value;
+
+                        _applicationCreateNativeEventCallbackDelegate = new NUIComponentApplicationCreatenativeEventCallbackDelegate(OnApplicationCreateNative);
+                        Connect(_applicationCreateNativeEventCallbackDelegate);
+                    }
+                }
+            }
+
+            remove
+            {
+                lock (this)
+                {
+                    if (_applicationCreateNativeEventHandler != null)
+                    {
+                        Disconnect(_applicationCreateNativeEventCallbackDelegate);
+                    }
+
+                    _applicationCreateNativeEventHandler -= value;
+                }
+            }
+        }
+
+
+        public void Connect(System.Delegate func)
+        {
+            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
+            {
+                Interop.ComponentApplication.ComponentApplication_CreateNativeSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                {
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+            }
+        }
+
+        public void Disconnect(System.Delegate func)
+        {
+            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
+            {
+                Interop.ComponentApplication.ComponentApplication_CreateNativeSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                {
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+            }
+        }
+
+        internal ApplicationSignal CreateNativeSignal()
+        {
+            ApplicationSignal ret = new ApplicationSignal(Interop.ComponentApplication.ComponentApplication_CreateNativeSignal(swigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+               
+
+               
+               // Callback for Application InitSignal
+               private IntPtr OnApplicationCreateNative(IntPtr data)
+        {
+            IntPtr ptr = IntPtr.Zero;
+               
+                       if (_applicationCreateNativeEventHandler != null)
+                       {
+                               ptr = _applicationCreateNativeEventHandler.Invoke(data);
+                       }
+                   return ptr;
+               }
+
+        internal void RegisterFrameComponent(NUIFrameComponent nuiFrameComponent)
+        {
+            _frameComponentList.Add(nuiFrameComponent);
+        }
+
+        internal int GetFrameComponentCount()
+        {
+            return _frameComponentList.Count;
+        }
+
+
+    }
+
+
+}
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.ComponentApplication.cs b/src/Tizen.NUI/src/internal/Interop/Interop.ComponentApplication.cs
new file mode 100755 (executable)
index 0000000..dab1716
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tizen.NUI
+{
+    internal static partial class Interop
+    {
+        internal static partial class ComponentApplication
+        {
+               
+               [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_ComponentApplication")]
+               public static extern global::System.IntPtr ComponentApplication_New(int argc, string argv, string styleSheet);
+               
+               [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_ComponentApplication_SWIG1")]
+               public static extern global::System.IntPtr new_ComponentApplication__SWIG_1(global::System.Runtime.InteropServices.HandleRef swigCPtr);
+                       
+               [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_assign_ComponentApplication")]
+               public static extern global::System.IntPtr ComponentApplication_Assign(global::System.Runtime.InteropServices.HandleRef swigCPtr, global::System.Runtime.InteropServices.HandleRef swigCPtr2);
+               
+               [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_ComponentApplication")]
+               public static extern global::System.IntPtr delete_ComponentApplication(global::System.Runtime.InteropServices.HandleRef swigCPtr);
+
+               [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ComponentApplication_CreateNativeSignal")]
+               public static extern global::System.IntPtr ComponentApplication_CreateNativeSignal(global::System.Runtime.InteropServices.HandleRef swigCPtr);
+
+               [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ComponentApplication_CreateNativeSignal_Connect")]
+               public static extern global::System.IntPtr ComponentApplication_CreateNativeSignal_Connect(global::System.Runtime.InteropServices.HandleRef swigCPtr, global::System.Runtime.InteropServices.HandleRef func);
+
+               [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ComponentApplication_CreateNativeSignal_Disconnect")]
+               public static extern global::System.IntPtr ComponentApplication_CreateNativeSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef swigCPtr, global::System.Runtime.InteropServices.HandleRef func);                                
+        }
+    }
+}
index bf1bef6..bd225aa 100755 (executable)
@@ -112,6 +112,9 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GetType")]
             public static extern int GetType(global::System.Runtime.InteropServices.HandleRef jarg1);
+                       
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GetResourceID")]
+            public static extern int GetResouceID(global::System.Runtime.InteropServices.HandleRef jarg1);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_SetNotificationLevel")]
             public static extern bool SetNotificationLevel(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
diff --git a/src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs b/src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs
new file mode 100755 (executable)
index 0000000..c7c13d9
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using Tizen.Applications.CoreBackend;
+using Tizen.Applications;
+using Tizen.Applications.ComponentBased.Common;
+
+namespace Tizen.NUI
+{
+    class NUIComponentCoreBackend : ICoreBackend
+    {
+        private Dictionary<Type, ComponentStateManger> _componentFactories;
+        public Dictionary<Type, ComponentStateManger>  ComponentFactories
+        {
+            set
+            {
+                _componentFactories = value;
+            }
+            get
+            {
+                return _componentFactories;
+            }
+        }
+
+        /// <summary>
+        /// Application instance to connect event.
+        /// </summary>
+        protected ComponentApplication _application;
+        private string _stylesheet = "";
+
+        /// <summary>
+        /// Dictionary to contain each type of event callback.
+        /// </summary>
+        protected IDictionary<EventType, object> Handlers = new Dictionary<EventType, object>();
+
+        /// <summary>
+        /// Adds NUIApplication event to Application.
+        /// Puts each type of event callback in Dictionary.
+        /// </summary>
+        /// <param name="evType">The type of event.</param>
+        /// <param name="handler">The event callback.</param>
+        public void AddEventHandler(EventType evType, Action handler)
+        {
+            Handlers.Add(evType, handler);
+        }
+
+        /// <summary>
+        /// Adds NUIApplication event to Application.
+        /// Puts each type of event callback in Dictionary.
+        /// </summary>
+        /// <typeparam name="TEventArgs">The argument type for the event.</typeparam>
+        /// <param name="evType">The type of event.</param>
+        /// <param name="handler">The event callback.</param>
+        public void AddEventHandler<TEventArgs>(EventType evType, Action<TEventArgs> handler) where TEventArgs : EventArgs
+        {
+            Handlers.Add(evType, handler);
+        }
+
+        /// <summary>
+        /// The default Constructor.
+        /// </summary>
+        public NUIComponentCoreBackend()
+        {
+        }
+
+        /// <summary>
+        /// The constructor with stylesheet.
+        /// </summary>
+        public NUIComponentCoreBackend(string stylesheet)
+        {
+            _stylesheet = stylesheet;
+        }
+
+        /// <summary>
+        /// Dispose function.
+        /// </summary>
+        public void Dispose()
+        {
+            if (_application != null)
+            {
+                _application.Dispose();
+            }
+        }
+
+        /// <summary>
+        /// Exit Application.
+        /// </summary>
+        public void Exit()
+        {
+            if (_application != null)
+            {
+                _application.Quit();
+            }
+        }
+
+        /// <summary>
+        /// Run Application.
+        /// </summary>
+        /// <param name="args">Arguments from commandline.</param>
+        public void Run(string[] args)
+        {
+            TizenSynchronizationContext.Initialize();
+
+            args[0] = Tizen.Applications.Application.Current.ApplicationInfo.ExecutablePath;
+            _application = ComponentApplication.NewComponentApplication(args, _stylesheet);
+            
+            _application.Initialized += OnInitialized;
+            _application.CreateNative += OnCreateNative;
+            _application.Terminating += OnTerminated;
+
+            _application.MainLoop();
+        }
+
+
+        /// <summary>
+        /// Callback for Component Application CreateSignal
+        /// </summary>
+        /// <param name="data">user data</param>
+        private IntPtr OnCreateNative(IntPtr data)
+        {
+            IntPtr nativeComponentFactoryMap = IntPtr.Zero;
+            int n = 0;
+            foreach (KeyValuePair<Type, ComponentStateManger> entry in _componentFactories)
+            {
+                nativeComponentFactoryMap = entry.Value.Bind(nativeComponentFactoryMap);
+                n++;
+            }
+
+            return nativeComponentFactoryMap;
+        }
+
+        /// <summary>
+        /// The Initialized event callback function.
+        /// </summary>
+        /// <param name="source">The application instance.</param>
+        /// <param name="e">The event argument for Initialized.</param>
+        private void OnInitialized(object source, NUIApplicationInitEventArgs e)
+        {
+            var createHandler = Handlers[EventType.Created] as Action;
+            createHandler?.Invoke();
+        }
+
+        /// <summary>
+        /// The Terminated event callback function.
+        /// </summary>
+        /// <param name="source">The application instance.</param>
+        /// <param name="e">The event argument for Terminated.</param>
+        private void OnTerminated(object source, NUIApplicationTerminatingEventArgs e)
+        {
+            var handler = Handlers[EventType.Terminated] as Action;
+            handler?.Invoke();
+        }
+               
+    }
+}
+
diff --git a/src/Tizen.NUI/src/internal/NUIWindowInfo.cs b/src/Tizen.NUI/src/internal/NUIWindowInfo.cs
new file mode 100755 (executable)
index 0000000..9d71e20
--- /dev/null
@@ -0,0 +1,76 @@
+using System;
+using Tizen.NUI;
+using Tizen.Applications.ComponentBased.Common;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// Window information class for ComponentApplication
+    /// </summary>
+    internal class NUIWindowInfo : IWindowInfo
+    {
+        private const string LogTag = "Tizen.NUI";
+        private Window _win;
+        private int _resId;
+        private bool _disposed = false;
+
+        /// <summary>
+        /// Initializes the NUI Window class.
+        /// </summary>
+        /// <param name="win">The window object of component.</param>
+        /// <since_tizen> 6 </since_tizen>
+        internal NUIWindowInfo(Window win)
+        {
+            _win = win;
+        }
+
+        /// <summary>
+        /// Gets the resource ID of window
+        /// </summary>
+        /// <returns>The native handle of window</returns>
+        public int ResourceId
+        {
+            get
+            {
+                if (_resId == 0)
+                {
+                    _resId = _win.ResourceID;
+                    if (_resId != 0)
+                        Log.Info(LogTag, "Fail to get resource ID");
+                }
+
+                return _resId;
+            }
+        }
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
+        protected virtual void Dispose(bool disposing)
+        {
+            if (_disposed)
+                return;
+
+            if (disposing)
+            {
+                _win.Dispose();
+                _win = null;
+            }
+            _disposed = true;
+        }
+
+        /// <summary>
+        /// Dispose the window resources
+        /// </summary>
+        /// <returns></returns>
+        /// <since_tizen> 6 </since_tizen>
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+    }
+
+}
+
diff --git a/src/Tizen.NUI/src/public/NUIComponentApplication.cs b/src/Tizen.NUI/src/public/NUIComponentApplication.cs
new file mode 100755 (executable)
index 0000000..602bb54
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.Applications;
+using Tizen.Applications.ComponentBased;
+using Tizen.Applications.ComponentBased.Common;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI
+{
+
+    /// <summary>
+    /// The class for supporting multi-components application model.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class NUIComponentApplication : CoreApplication
+    {
+        private Dictionary<Type, ComponentStateManger> _componentFactories = new Dictionary<Type, ComponentStateManger>();
+
+        /// <summary>
+        /// Initializes the ComponentApplication class.
+        /// </summary>
+        /// <param name="typeInfo">The component type information.
+        /// The key should be a class type of FrameComponent or SubComponent subclass.
+        /// The value should be a component id which is declared in tizen-manifest.xml.
+        /// </param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public NUIComponentApplication(IDictionary<Type, string> typeInfo) : base(new NUIComponentCoreBackend())
+        {
+            foreach (var component in typeInfo)
+            {
+                RegisterComponent(component.Key, component.Value);
+            }
+            (Backend as NUIComponentCoreBackend).ComponentFactories = _componentFactories;
+        }
+
+        /// <summary>
+        /// Registers a component.
+        /// </summary>
+        /// <param name="compType">Class type</param>
+        /// <param name="compId">Component ID</param>
+        /// <exception cref="ArgumentException">Thrown when component type is already added or not sub-class of FrameComponent or ServiceComponent</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void RegisterComponent(Type compType, string compId)
+        {
+            if (_componentFactories.ContainsKey(compType))
+            {
+                throw new ArgumentException("Already exist type");
+            }
+
+            if (typeof(FrameComponent).IsAssignableFrom(compType))
+            {
+                _componentFactories.Add(compType, new FrameComponentStateManager(compType, compId, null));
+            }
+            else if (typeof(ServiceComponent).IsAssignableFrom(compType))
+            {
+                _componentFactories.Add(compType, new ServiceComponentStateManager(compType, compId, null));
+            }
+            else
+            {
+                throw new ArgumentException("compType must be sub type of FrameComponent or ServiceComponent", "compType");
+            }
+        }
+
+
+        /// <summary>
+        /// Runs the application's main loop.
+        /// </summary>
+        /// <param name="args">Arguments from commandline.</param>
+        /// <exception cref="InvalidOperationException">Thrown when component type is already added to the component.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void Run(string[] args)
+        {
+            //Register Callback.
+            base.Run(args);
+        }
+
+        /// <summary>
+        /// Exits the main loop of the application.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void Exit()
+        {
+            base.Exit();
+        }
+
+        /// <summary>
+        /// This method will be called before running main-loop
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void OnCreate()
+        {
+            base.OnCreate();
+        }
+
+        /// <summary>
+        /// This method will be called after exiting main-loop
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void OnTerminate()
+        {
+            base.OnTerminate();
+        }
+    }
+}
+
diff --git a/src/Tizen.NUI/src/public/NUIFrameComponent.cs b/src/Tizen.NUI/src/public/NUIFrameComponent.cs
new file mode 100755 (executable)
index 0000000..2be71ae
--- /dev/null
@@ -0,0 +1,110 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Text;
+using Tizen.Applications;
+using Tizen.Applications.ComponentBased.Common;
+using Tizen.NUI;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// The class for showing UI module
+    /// </summary>
+    /// <since_tizen> 6 </since_tizen>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class NUIFrameComponent : FrameComponent
+    {
+        internal NUIWindowInfo NUIWindowInfo
+        {
+            get;
+            set;
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Window Window
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        /// Overrides this method to create window. It will be called before OnCreate method.
+        /// </summary>
+        /// <returns>Window object to use</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override IWindowInfo CreateWindowInfo()
+        {
+            ComponentApplication.Instance.RegisterFrameComponent(this);
+            if(ComponentApplication.Instance.GetFrameComponentCount() == 1)
+            {
+                Window = ComponentApplication.Instance.GetWindow();
+            }
+            else
+            {
+                Window = new Window();
+            }
+
+            NUIWindowInfo = new NUIWindowInfo(Window);
+            return NUIWindowInfo;
+        }
+
+        /// <summary>
+        /// Overrides this method to handle behavior when the component is launched.
+        /// </summary>
+        /// <returns>True if a service component is successfully created</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override bool OnCreate()
+        {
+            return true;
+        }
+
+        /// <summary>
+        /// Overrides this method if want to handle behavior when the component receives the appcontrol message.
+        /// </summary>
+        /// <param name="appControl">appcontrol object</param>
+        /// <param name="restarted">True if it was restarted</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnStart(AppControl appControl, bool restarted)
+        {
+            base.OnStart(appControl, restarted);
+        }
+
+        /// <summary>
+        /// Overrides this method if you want to handle the behavior when the component is resumed.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnResume()
+        {
+            base.OnResume();
+        }
+
+        /// <summary>
+        /// Overrides this method if you want to handle the behavior when the component is paused.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnPause()
+        {
+            base.OnPause();
+        }
+
+        /// <summary>
+        /// Overrides this method if you want to handle the behavior when the component is stopped.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnStop()
+        {
+            base.OnStop();
+        }
+
+        /// <summary>
+        /// Overrides this method if want to handle behavior when the component is destroyed.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override void OnDestroy()
+        {
+            base.OnDestroy();
+        }
+    }
+}
+
index b1749fe..a103a1e 100755 (executable)
@@ -207,6 +207,19 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Get Resource ID of window
+        /// </summary>
+        internal int ResourceID
+        {
+            get
+            {
+                int ret = Interop.Window.GetResouceID(swigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
+            }
+        }
+
+        /// <summary>
         /// Gets or sets a window type.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>