[NUI] Modify Instance bug of Application (#1369)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Thu, 6 Feb 2020 07:14:24 +0000 (16:14 +0900)
committerGitHub <noreply@github.com>
Thu, 6 Feb 2020 07:14:24 +0000 (16:14 +0900)
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/internal/Application.cs
src/Tizen.NUI/src/internal/ComponentApplication.cs
src/Tizen.NUI/src/internal/WatchApplication.cs
src/Tizen.NUI/src/internal/WidgetApplication.cs
src/Tizen.NUI/src/public/NUIFrameComponent.cs
src/Tizen.NUI/src/public/Widget.cs
src/Tizen.NUI/src/public/Window.cs

index 215171f8e35eaf5ae03110a9222d081f47ae1d6b..f1ec21429459be993a82fb23eae4597d87b890d0 100755 (executable)
@@ -1139,7 +1139,7 @@ namespace Tizen.NUI
             }
         }
 
-        private static Application _instance; // singleton
+        protected static Application _instance; // singleton
 
         public static Application Instance
         {
index ed07bcb0cf5769ccc85d5de66496c798f9f1c2eb..6c186aba2b21304b74d14fd59be2a27170b6b2dd 100755 (executable)
@@ -9,7 +9,6 @@ namespace Tizen.NUI
     {
         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)
         {
@@ -44,14 +43,6 @@ namespace Tizen.NUI
             base.Dispose(type);
         }
 
-        public new static ComponentApplication Instance
-        {
-            get
-            {
-                return _instance;
-            }
-        }
-
         public static ComponentApplication NewComponentApplication(string[] args, string stylesheet)
         {
             ComponentApplication ret = New(args, stylesheet);
index 601911748463ae2682df1e5c337f86cd3ace740f..6d88ce59f9b91f849e2a7334a03aaa9852e20959 100755 (executable)
@@ -75,14 +75,6 @@ namespace Tizen.NUI
             }
         }
 
-        public new static WatchApplication Instance
-        {
-            get
-            {
-                return _instance;
-            }
-        }
-
         public static WatchApplication NewWatchApplication()
         {
             WatchApplication ret = New();
@@ -364,7 +356,5 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
-
-        private static WatchApplication _instance; //singleton
     }
 }
index 3cc69b1df750888ebecb1dd34b9acb632cced1be..72266957e222d417f369ee41a401d2fcdd114975 100755 (executable)
@@ -22,7 +22,6 @@ namespace Tizen.NUI
     internal class WidgetApplication : Application
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
-        private static WidgetApplication _instance; //singleton
         private Dictionary<System.Type, string> _widgetInfo;
         private List<Widget> _widgetList = new List<Widget>();
         private delegate System.IntPtr CreateWidgetFunctionDelegate(ref string widgetName);
@@ -60,14 +59,6 @@ namespace Tizen.NUI
             base.Dispose(type);
         }
 
-        public new static WidgetApplication Instance
-        {
-            get
-            {
-                return _instance;
-            }
-        }
-
         public static WidgetApplication NewWidgetApplication(string[] args, string stylesheet)
         {
             WidgetApplication ret = New(args, stylesheet);
@@ -137,7 +128,7 @@ namespace Tizen.NUI
 
         public static System.IntPtr WidgetCreateFunction(ref string widgetName)
         {
-            Dictionary<System.Type, string> widgetInfo = Instance.WidgetInfo;
+            Dictionary<System.Type, string> widgetInfo = (Instance as WidgetApplication).WidgetInfo;
 
             foreach (System.Type widgetType in widgetInfo.Keys)
             {
index 2be71aeeb3fe0fe5ae7616f4519035b53ff268c5..c6746bf1c832ccef0d6c5d2c267ff76001e877be 100755 (executable)
@@ -35,16 +35,19 @@ namespace Tizen.NUI
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override IWindowInfo CreateWindowInfo()
         {
-            ComponentApplication.Instance.RegisterFrameComponent(this);
-            if(ComponentApplication.Instance.GetFrameComponentCount() == 1)
+            ComponentApplication instance = ComponentApplication.Instance as ComponentApplication;
+            if(instance)
             {
-                Window = ComponentApplication.Instance.GetWindow();
+                instance.RegisterFrameComponent(this);
+                if(instance.GetFrameComponentCount() == 1)
+                {
+                    Window = instance.GetWindow();
+                }
+                else
+                {
+                    Window = new Window();
+                }
             }
-            else
-            {
-                Window = new Window();
-            }
-
             NUIWindowInfo = new NUIWindowInfo(Window);
             return NUIWindowInfo;
         }
index 2043943f80265f5051bf9c9be992e566f1a49787..9a040c7e2a4b6415527c3cd80e6ec9a823b4b734 100755 (executable)
@@ -47,7 +47,7 @@ namespace Tizen.NUI
             widgetImpl.WidgetInstanceResized += OnWidgetInstanceResized;
             widgetImpl.WidgetInstanceUpdated += OnWidgetInstanceUpdated;
 
-            WidgetApplication.Instance?.AddWidgetInstance(this);
+            (WidgetApplication.Instance as WidgetApplication)?.AddWidgetInstance(this);
         }
 
         internal Widget(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Widget.Widget_SWIGUpcast(cPtr), cMemoryOwn)
index 37794f4a10e2784dd896d8688a19f585f9be24ec..98865e8a76af94f7b76abaf9c349a090667522f4 100755 (executable)
@@ -1014,13 +1014,6 @@ namespace Tizen.NUI
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
         }
 
-        internal static Window GetCurrent()
-        {
-            Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         internal static bool IsInstalled()
         {
             bool ret = Interop.Stage.Stage_IsInstalled();