[NUI] Modify Instance bug of Application (#1370)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Thu, 6 Feb 2020 07:14:13 +0000 (16:14 +0900)
committerGitHub <noreply@github.com>
Thu, 6 Feb 2020 07:14:13 +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 ef09ff4..accce45 100755 (executable)
@@ -1131,7 +1131,7 @@ namespace Tizen.NUI
             }
         }
 
-        private static Application _instance; // singleton
+        protected static Application _instance; // singleton
 
         public static Application Instance
         {
index ed07bcb..6c186ab 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 ac9eb16..30a0e4a 100755 (executable)
@@ -53,14 +53,6 @@ namespace Tizen.NUI
             }
         }
 
-        public new static WatchApplication Instance
-        {
-            get
-            {
-                return _instance;
-            }
-        }
-
         public static WatchApplication NewWatchApplication()
         {
             WatchApplication ret = New();
@@ -342,7 +334,5 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
-
-        private static WatchApplication _instance; //singleton
     }
 }
index e40f705..aca566a 100755 (executable)
@@ -21,7 +21,6 @@ namespace Tizen.NUI
 {
     internal class WidgetApplication : Application
     {
-        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);
@@ -41,14 +40,6 @@ namespace Tizen.NUI
             Interop.WidgetApplication.delete_WidgetApplication(swigCPtr);
         }
 
-        public new static WidgetApplication Instance
-        {
-            get
-            {
-                return _instance;
-            }
-        }
-
         public static WidgetApplication NewWidgetApplication(string[] args, string stylesheet)
         {
             WidgetApplication ret = New(args, stylesheet);
@@ -118,7 +109,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 2be71ae..c6746bf 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 511c91b..eb8be23 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 248bef3..e27c7aa 100755 (executable)
@@ -1004,13 +1004,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();