From 111154d4efd427501e6e7617763e2265495c8434 Mon Sep 17 00:00:00 2001 From: "xb.teng" Date: Thu, 1 Jun 2017 01:11:11 +0800 Subject: [PATCH] Add more things Fixed nui jira-376(http://suprem.sec.samsung.net/jira/browse/NUI-376): 1. Add initial value for AnimateVisual, 2. Add default parameter for AnimateVisual, 3. Use "Position" to replace "Offset" to do visual animation, 4. Merge as-is-support.zip, 5. Fix null stage handle issue of window. Change-Id: I24a37a3adf996b5c28bd0746ee916990ed0342fb --- .../NUISamples.TizenTV/NUISamples.TizenTV.csproj | 1 + .../NUISamples/NUISamples.TizenTV/examples/Main.cs | 3 +- .../examples/as-is-test-sample.cs | 224 +++++++++++++++++++++ .../examples/visual-animation-test.cs | 49 +++-- .../examples/visual-animation-test2.cs | 14 +- src/Tizen.NUI/src/internal/ViewRegistry.cs | 5 +- src/Tizen.NUI/src/public/BaseComponents/View.cs | 20 +- .../src/public/BaseComponents/VisualView.cs | 159 ++++++++------- src/Tizen.NUI/src/public/Layer.cs | 15 +- src/Tizen.NUI/src/public/Window.cs | 5 +- 10 files changed, 388 insertions(+), 107 deletions(-) create mode 100755 NUISamples/NUISamples/NUISamples.TizenTV/examples/as-is-test-sample.cs diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj b/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj index e0ac162..8c34bf8 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj +++ b/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj @@ -55,6 +55,7 @@ + diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs index 765ca0d..26c77d7 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs @@ -37,7 +37,8 @@ namespace NUISamples.TizenTV.examples //new VisualsUsingCustomView.VisualsExample().Run(args); //o //new FirstScreen.FirstScreenApp().Run(args); //o //new PositionUsesAnchorPointTest.Example().Run(args); - new TizenVDUIApplication19.Program().Run(args); + // new VisualsExampleTest.Example().Run(args); //o + new TizenSTVUIApplication15.Program().Run(args); } } } diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/as-is-test-sample.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/as-is-test-sample.cs new file mode 100755 index 0000000..3da0a43 --- /dev/null +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/as-is-test-sample.cs @@ -0,0 +1,224 @@ +using System; +using Tizen.NUI.BaseComponents; +using Tizen.NUI; + +namespace TizenSTVUIApplication15 +{ + class Program : NUIApplication + { + private Timer myTimer; + + private View myView; + private TextLabel myTextLabel; + + + //=========================== + Layer layer; + View vi1, vi2, vi3; + TextLabel tl1, tl2, tl3; + ToggleButton tb1, tb2, tb3; + + + protected override void OnCreate() + { + base.OnCreate(); + + myView = new View(); + myView.Size = new Size(100, 100, 0); + myView.Position = new Position(100, 100, 0); + myView.BackgroundColor = Color.Red; + myView.Name = "myView"; + + Window.Instance.GetDefaultLayer().Add(myView); + + myTextLabel = new TextLabel(); + myTextLabel.Position = new Position(100, 100, 0); + myTextLabel.Size = new Size(100, 100, 0); + myTextLabel.Name = "myTextLabel"; + + myView.Add(myTextLabel); + + //=========================== + LayerTest2(); + + myTimer = new Timer(500); + myTimer.Tick += Mytimer_Tick; + myTimer.Start(); + } + + private void ObjectDumpTrigger() + { + for (int i = 0; i < Window.GetLayerCount(); i++) + { + BFS(Window.GetLayer((uint)i), 1); + } + } + + + + private static void BFS(Animatable o, int depth) + { + if (o == null) + { + Tizen.Log.Fatal("NUI-APP", "##### o == null! return here!"); + return; + } + + Tizen.Log.Fatal("NUI-APP", "##### o.GetTypeName()=" + o.GetTypeName()); + + if (o is View) + { + View myView = o as View; + + if (o is TextLabel) + { + TextLabel myTextLabel = o as TextLabel; + + Tizen.Log.Fatal("NUI-APP", string.Format("it is TextLabel, {0}", myTextLabel.Text)); + + return; + } + else + { + Tizen.Log.Fatal("NUI-APP", string.Format("it is not TextLaebl")); + } + + for (int i = 0; i < myView.GetChildCount(); i++) + { + BFS(myView.GetChildAt((uint)i), depth + 1); + } + } + else if (o is Layer) + { + Layer myLayer = o as Layer; + + for (int i = 0; i < myLayer.GetChildCount(); i++) + { + BFS(myLayer.GetChildAt((uint)i), depth + 1); + } + } + else + { + return; + } + } + + private bool Mytimer_Tick(object source, Timer.TickEventArgs e) + { + //ObjectDumpTrigger(); + ObjectDumpTrigger2(); + + return true; + } + + + + //====================================================================== + void LayerTest2() + { + layer = new Layer(); + + vi1 = new View(); + vi2 = new View(); + vi3 = new View(); + + tl1 = new TextLabel(); + tl2 = new TextLabel(); + tl3 = new TextLabel(); + + tb1 = new ToggleButton(); + tb2 = new ToggleButton(); + tb3 = new ToggleButton(); + + vi1.Add(vi3); + vi1.Add(tl1); + vi1.Add(tl2); + + vi3.Add(tb1); + vi3.Add(tb2); + + vi2.Add(tl3); + + layer.Add(vi1); + layer.Add(vi2); + layer.Add(tb3); + + Window.Instance.AddLayer(layer); + } + + void ObjectDumpTrigger2() + { + uint layerCnt = Window.GetLayerCount(); + Tizen.Log.Fatal("NUI-APP", "layerCnt=" + layerCnt); + + for (uint i = 0; i < layerCnt; i++) + { + Tizen.Log.Fatal("NUI-APP", "T[" + DateTime.Now + "]__________ layer #" + i + " traverse"); + CheckViewsInLayer(Window.GetLayer(i)); + } + } + void CheckViewsInLayer(Animatable obj) + { + if (obj is Layer) + { + var layer = obj as Layer; + if (layer == null) + { + Tizen.Log.Fatal("NUI-APP", "### layer is null! just return!"); + return; + } + uint childCnt = layer.GetChildCount(); + if (childCnt > 0) + { + for (uint i = 0; i < childCnt; i++) + { + var temp = layer.GetChildAt(i) as View; + Tizen.Log.Fatal("NUI-APP", "depth[1] child in layer! type=" + temp?.GetTypeName()); + ViewCheckRecurse(temp, 1); + } + } + else + { + Tizen.Log.Fatal("NUI-APP", "### there is no child in this layer! just return!"); + } + } + else + { + Tizen.Log.Fatal("NUI-APP", "obj is NOT Layer! do nothing!"); + } + } + void ViewCheckRecurse(View view, int depth) + { + if (view) + { + uint childCnt = view.GetChildCount(); + if (childCnt > 0) + { + depth = depth + 1; + for (uint i = 0; i < childCnt; i++) + { + var temp = view.GetChildAt(i) as View; + Tizen.Log.Fatal("NUI-APP", "depth[" + depth + "] child in layer! type=" + temp.GetTypeName() + " AS-IS Test: IsView?=" + (temp is View) + " IsTextLabel?=" + (temp is TextLabel) ); + ViewCheckRecurse(temp, depth); + } + } + else + { + //Tizen.Log.Fatal("NUI-APP", "depth[" + depth + "] child in layer! type=" + view.GetTypeName()); + return; + } + } + else + { + //Tizen.Log.Fatal("NUI-APP", "### view is null! just return!"); + } + } + + private static void _Main(string[] args) + { + //Create an Application + Program myProgram = new Program(); + myProgram.Run(args); + } + } +} \ No newline at end of file diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs index 4edb9eb..c2f172b 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs @@ -32,7 +32,8 @@ namespace VisaulAnimationExample private bool _active = false; private const string _resPath = "/home/owner/apps_rw/NUISamples.TizenTV/res"; - private Animation _animation; + private Animation _animation1; + private Animation _animation2; private bool _transitionInProgress = false; private int cnt1, cnt2; @@ -227,35 +228,57 @@ namespace VisaulAnimationExample private void StartTransition(bool activate) { - if (_animation) + if (_animation1) { - _animation.Stop(); - _animation.Finished += OnTransitionFinished; + _animation1.Stop(); + _animation1.Finished += OnTransitionFinished1; + } + if (_animation2) + { + _animation2.Stop(); + _animation2.Finished += OnTransitionFinished2; } if (activate) { - _animation = _contentView.AnimateVisual(_icon, "Size", new Size2D(200, 200), 0, 1000, AlphaFunction.BuiltinFunctions.Linear); + _animation1 = _contentView.AnimateVisual(_icon, "Size", new Size2D(150, 150), 0, 1000, AlphaFunction.BuiltinFunctions.Linear); + _animation2 = _contentView.AnimateVisual(_icon, "Position", new Position2D(40, 40), 0, 1000); } else { - _animation = _contentView.AnimateVisual(_icon, "Size", new Position2D(50, 50), 0, 1000, AlphaFunction.BuiltinFunctions.Linear); + _animation1 = _contentView.AnimateVisual(_icon, "Size", new Position2D(50, 50), 0, 1000, AlphaFunction.BuiltinFunctions.Linear); + _animation2 = _contentView.AnimateVisual(_icon, "Position", new Position2D(5, 5), 0, 1000); } - if (_animation) + if (_animation1) + { + _animation1.Finished += OnTransitionFinished1; + _transitionInProgress = true; + _animation1.Play(); + } + if (_animation2) { - _animation.Finished += OnTransitionFinished; + _animation2.Finished += OnTransitionFinished2; _transitionInProgress = true; - _animation.Play(); + _animation2.Play(); + } + } + private void OnTransitionFinished1(object sender, EventArgs e) + { + _transitionInProgress = false; + if (_animation1) + { + _animation1.Finished += OnTransitionFinished1; + _animation1.Reset(); } } - private void OnTransitionFinished(object sender, EventArgs e) + private void OnTransitionFinished2(object sender, EventArgs e) { _transitionInProgress = false; - if (_animation) + if (_animation2) { - _animation.Finished += OnTransitionFinished; - _animation.Reset(); + _animation2.Finished += OnTransitionFinished2; + _animation2.Reset(); } } diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test2.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test2.cs index 266f975..a9f6298 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test2.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test2.cs @@ -122,7 +122,7 @@ namespace VisaulAnimationExample _shadowButton1.Clicked += (obj, ev) => { _active1 = !_active1; - StartTransition(_contentView1, _icon, "Offset", _active1); + StartTransition(_contentView1, _icon, "Position", _active1); return true; }; _shadowButton1.WidthResizePolicy = ResizePolicyType.FillToParent; @@ -216,9 +216,9 @@ namespace VisaulAnimationExample if (activate) { - if (property == "Offset") + if (property == "Position") { - _animation = view.AnimateVisual(target, property, new Position2D(20, 20), 0, 1000, AlphaFunction.BuiltinFunctions.Linear); + _animation = view.AnimateVisual(target, property, new Position2D(20, 20), 0, 1000, AlphaFunction.BuiltinFunctions.Linear, new Position2D(40, 40)); } else if (property == "Opacity") { @@ -231,17 +231,17 @@ namespace VisaulAnimationExample } else { - if (property == "Offset") + if (property == "Position") { - _animation = view.AnimateVisual(target, property, new Position2D(5, 5), 0, 1000, AlphaFunction.BuiltinFunctions.Linear); + _animation = view.AnimateVisual(target, property, new Position2D(5, 5), 0, 1000); } else if (property == "Opacity") { - _animation = view.AnimateVisual(target, property, 1.0f, 0, 1000, AlphaFunction.BuiltinFunctions.Linear); + _animation = view.AnimateVisual(target, property, 1.0f, 0, 1000); } else if (property == "MixColor") { - _animation = view.AnimateVisual(target, property, Color.Red, 0, 1000, AlphaFunction.BuiltinFunctions.Linear); + _animation = view.AnimateVisual(target, property, Color.Red, 0, 1000); } } diff --git a/src/Tizen.NUI/src/internal/ViewRegistry.cs b/src/Tizen.NUI/src/internal/ViewRegistry.cs index 507f903..9e7fa13 100755 --- a/src/Tizen.NUI/src/internal/ViewRegistry.cs +++ b/src/Tizen.NUI/src/internal/ViewRegistry.cs @@ -302,11 +302,12 @@ namespace Tizen.NUI } } - public static View GetViewFromActor(View view) + + internal static View GetViewFromBaseHandle(BaseHandle baseHandle) { // we store a dictionary of ref-obects (C++ land) to custom views (C# land) - RefObject refObj = view.GetObjectPtr(); + RefObject refObj = baseHandle.GetObjectPtr(); IntPtr refObjectPtr = (IntPtr)RefObject.getCPtr(refObj); WeakReference viewReference; diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index bb69124..9ea3d8f 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -905,7 +905,7 @@ namespace Tizen.NUI.BaseComponents /// A object which inherit View public static T DownCast(View view) where T : View { - View ret = ViewRegistry.GetViewFromActor(view); + View ret = ViewRegistry.GetViewFromBaseHandle(view); if (ret != null) { return (T)ret; @@ -1914,14 +1914,14 @@ namespace Tizen.NUI.BaseComponents SetVisible(false); } - public void Raise() + internal void Raise() { NDalicPINVOKE.Raise(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public void Lower() + internal void Lower() { NDalicPINVOKE.Lower(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) @@ -2094,10 +2094,18 @@ namespace Tizen.NUI.BaseComponents /// The view for the given index or empty handle if children not initialized public View GetChildAt(uint index) { - View ret = new View(NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index), true); + IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); + cPtr = NDalicPINVOKE.View_SWIGUpcast(cPtr); + cPtr = NDalicPINVOKE.Handle_SWIGUpcast(cPtr); + + BaseHandle ret = new BaseHandle(cPtr, false); + + View temp = ViewRegistry.GetViewFromBaseHandle(ret); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + + return temp ?? null; } /// @@ -2205,7 +2213,7 @@ namespace Tizen.NUI.BaseComponents return ret; } - public Vector3 GetNaturalSize() + internal Vector3 GetNaturalSize() { Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetNaturalSize(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) diff --git a/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs b/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs index 60fcc01..935e496 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs @@ -213,80 +213,83 @@ namespace Tizen.NUI.BaseComponents /// The end time of visual animation. /// The alpha function of visual animation /// Animation instance - public Animation AnimateVisual(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions alphaFunction) + public Animation AnimateVisual(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialValue = null) { - string _alphaFunction = ""; - switch (alphaFunction) + string _alphaFunction = null; + if (alphaFunction != null) { - case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear: + switch (alphaFunction) { - _alphaFunction = "LINEAR"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse: - { - _alphaFunction = "REVERSE"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare: - { - _alphaFunction = "EASE_IN_SQUARE"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare: - { - _alphaFunction = "EASE_OUT_SQUARE"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn: - { - _alphaFunction = "EASE_IN"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut: - { - _alphaFunction = "EASE_OUT"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut: - { - _alphaFunction = "EASE_IN_OUT"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine: - { - _alphaFunction = "EASE_IN_SINE"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine: - { - _alphaFunction = "EASE_OUT_SINE"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine: - { - _alphaFunction = "EASE_IN_OUT_SINE"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce: - { - _alphaFunction = "BOUNCE"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin: - { - _alphaFunction = "SIN"; - break; - } - case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack: - { - _alphaFunction = "EASE_OUT_BACK"; - break; - } - default: - { - _alphaFunction = "DEFAULT"; - break; + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear: + { + _alphaFunction = "LINEAR"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse: + { + _alphaFunction = "REVERSE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare: + { + _alphaFunction = "EASE_IN_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare: + { + _alphaFunction = "EASE_OUT_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn: + { + _alphaFunction = "EASE_IN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut: + { + _alphaFunction = "EASE_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut: + { + _alphaFunction = "EASE_IN_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine: + { + _alphaFunction = "EASE_IN_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine: + { + _alphaFunction = "EASE_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine: + { + _alphaFunction = "EASE_IN_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce: + { + _alphaFunction = "BOUNCE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin: + { + _alphaFunction = "SIN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack: + { + _alphaFunction = "EASE_OUT_BACK"; + break; + } + default: + { + _alphaFunction = "DEFAULT"; + break; + } } } @@ -295,7 +298,7 @@ namespace Tizen.NUI.BaseComponents if (item.Value.Name == target.Name) { PropertyMap _animator = new PropertyMap(); - _animator.Add("alphaFunction", new PropertyValue(_alphaFunction)); + if ( _alphaFunction != null) {_animator.Add("alphaFunction", new PropertyValue(_alphaFunction));} PropertyMap _timePeriod = new PropertyMap(); _timePeriod.Add("duration", new PropertyValue((endTime - startTime) / 1000.0f)); @@ -305,13 +308,19 @@ namespace Tizen.NUI.BaseComponents string _str1 = property.Substring(0, 1); string _str2 = property.Substring(1); string _str = _str1.ToLower() + _str2; + if (_str == "position") {_str = "offset";} - PropertyValue val = PropertyValue.CreateFromObject(destinationValue); + PropertyValue destVal = PropertyValue.CreateFromObject(destinationValue); PropertyMap _transition = new PropertyMap(); _transition.Add("target", new PropertyValue(target.Name)); _transition.Add("property", new PropertyValue(_str)); - _transition.Add("targetValue", val); + if (initialValue != null) + { + PropertyValue initVal = PropertyValue.CreateFromObject(initialValue); + _transition.Add("initialValue", new PropertyValue(initVal)); + } + _transition.Add("targetValue", destVal); _transition.Add("animator", new PropertyValue(_animator)); TransitionData _transitionData = new TransitionData(_transition); @@ -323,7 +332,7 @@ namespace Tizen.NUI.BaseComponents //temporary fix to pass TCT - public Animation VisualAnimate(VisualAnimator visualMap) + public Animation VisualAnimate(Tizen.NUI.VisualAnimator visualMap) { foreach (var item in _visualDictionary.ToList()) { diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index 26df66c..e7de055 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -26,7 +26,10 @@ namespace Tizen.NUI { + using System; + using System.Runtime.InteropServices; using Tizen.NUI.BaseComponents; + /// /// Layers provide a mechanism for overlaying groups of actors on top of each other. /// @@ -440,10 +443,18 @@ namespace Tizen.NUI /// The view for the given index or empty handle if children not initialized public View GetChildAt(uint index) { - View ret = new View(NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index), true); + IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); + cPtr = NDalicPINVOKE.View_SWIGUpcast(cPtr); + cPtr = NDalicPINVOKE.Handle_SWIGUpcast(cPtr); + + BaseHandle ret = new BaseHandle(cPtr, false); + + View temp = ViewRegistry.GetViewFromBaseHandle(ret); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + + return temp ?? null; } /// diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index 7da0d14..d9913a0 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -43,7 +43,10 @@ namespace Tizen.NUI internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent()); + if (NDalicPINVOKE.Stage_IsInstalled()) + { + stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent()); + } } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj) -- 2.7.4