[NUI] Add dotnet pre-initiailze (#1521)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Fri, 17 Apr 2020 00:51:15 +0000 (09:51 +0900)
committerGitHub <noreply@github.com>
Fri, 17 Apr 2020 00:51:15 +0000 (09:51 +0900)
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/internal/Application.cs
src/Tizen.NUI/src/internal/Interop/Interop.Application.cs
src/Tizen.NUI/src/public/Layouting/LayoutItem.cs
src/Tizen.NUI/src/public/NUIApplication.cs

index 9f70268..204692c 100755 (executable)
@@ -1169,6 +1169,10 @@ namespace Tizen.NUI
         {
             // register all Views with the type registry, so that can be created / styled via JSON
             //ViewRegistryHelper.Initialize(); //moved to Application side.
+            if(_instance)
+            {
+                return _instance;
+            }
 
             Application ret = New(1, stylesheet, windowMode);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
@@ -1180,6 +1184,10 @@ namespace Tizen.NUI
 
         public static Application NewApplication(string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
         {
+            if (_instance)
+            {
+                return _instance;
+            }
             Application ret = New(1, stylesheet, windowMode, positionSize);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
@@ -1190,6 +1198,10 @@ namespace Tizen.NUI
 
         public static Application NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode)
         {
+            if (_instance)
+            {
+                return _instance;
+            }
             Application ret = New(args, stylesheet, (Application.WindowMode)windowMode);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
@@ -1200,6 +1212,10 @@ namespace Tizen.NUI
 
         public static Application NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
         {
+            if (_instance)
+            {
+                return _instance;
+            }
             Application ret = New(args, stylesheet, (Application.WindowMode)windowMode, positionSize);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
index cbf5d5f..7e203b3 100755 (executable)
@@ -11,6 +11,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MakeCallback")]
             public static extern global::System.IntPtr MakeCallback(global::System.Runtime.InteropServices.HandleRef jarg1);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_PreInitialize")]
+            public static extern void Application_PreInitialize();
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_New__SWIG_0")]
             public static extern global::System.IntPtr Application_New__SWIG_0();
 
@@ -76,4 +79,4 @@ namespace Tizen.NUI
             public static extern global::System.IntPtr Application_New__SWIG_4(int jarg1, string jarg3, int jarg4, global::System.Runtime.InteropServices.HandleRef jarg5);
         }
     }
-}
\ No newline at end of file
+}
index 7d3bb53..487447f 100755 (executable)
@@ -306,7 +306,15 @@ namespace Tizen.NUI
         public void RequestLayout()
         {
             Flags = Flags | LayoutFlags.ForceLayout;
-            Window.Instance.LayoutController.RequestLayout(this);
+            if (Parent != null)
+            {
+                 LayoutGroup layoutGroup =  Parent as LayoutGroup;
+                 if(! layoutGroup.LayoutRequested)
+                 {
+                    layoutGroup.RequestLayout();
+                 }
+            }
+                       
         }
 
         /// <summary>
index d3e8365..3ca83a7 100755 (executable)
@@ -374,6 +374,17 @@ namespace Tizen.NUI
         {
             base.OnCreate();
         }
+
+        /// <summary>
+        /// This is used to improve application launch performance.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        static public void PreLoad()
+        {
+            Interop.Application.Application_PreInitialize();
+            Application.NewApplication("", Application.WindowMode.Opaque);
+            NUIApplication.GetDefaultWindow();
+        }
     }
 
     /// <summary>