From: dongsug.song Date: Tue, 14 Nov 2023 13:14:33 +0000 (+0900) Subject: [NUI] Add AliveCount property to get currently alived View number X-Git-Tag: submit/tizen/20231115.090609~1^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3d97cb44c4a465b847832bf82ba4a05dedd9b7f;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add AliveCount property to get currently alived View number --- diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 601d55387..947edadd0 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -85,6 +85,8 @@ namespace Tizen.NUI.BaseComponents private Vector4 internalCurrentWorldColor = null; private Vector2 internalCurrentScreenPosition = null; + private static int aliveCount = 0; + static View() { RegisterPropertyGroup(PositionProperty, positionPropertyGroup); @@ -208,6 +210,8 @@ namespace Tizen.NUI.BaseComponents { SetVisible(false); } + + aliveCount++; } internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true) @@ -3496,5 +3500,11 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public Vector3 CurrentScale => GetCurrentScale(); + /// + /// Gets the number of currently alived View object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static int AliveCount => aliveCount; + } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs index eabb6661f..bb0449c82 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs @@ -403,6 +403,7 @@ namespace Tizen.NUI.BaseComponents { // at this case, implicit nor explicit dispose is not required. No native object is made. disposed = true; + aliveCount--; return; } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index 9e68a7710..47b4dec25 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -1468,6 +1468,8 @@ namespace Tizen.NUI.BaseComponents NUILog.Debug($"============================="); base.Dispose(type); + + aliveCount--; } /// This will not be public opened.