From: hjhun <36876573+hjhun@users.noreply.github.com> Date: Fri, 27 Sep 2024 07:22:10 +0000 (+0900) Subject: [NUI.Gadget] Export NUIGadgetAssembly class for inhouse developers (#6379) X-Git-Tag: submit/tizen/20240927.150859~1^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2487cd7911cc79a65cfa308022102c82e8ed9c9b;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI.Gadget] Export NUIGadgetAssembly class for inhouse developers (#6379) The developers want to check whether the assembly is alive or not. This patch provides the NUIGadgetAssembly for inhouse developers. Signed-off-by: Hwankyu Jhun --- diff --git a/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetAssembly.cs b/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetAssembly.cs index 9946fe8ca..206bf788b 100644 --- a/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetAssembly.cs +++ b/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetAssembly.cs @@ -15,6 +15,7 @@ */ using System; +using System.ComponentModel; using System.IO; using System.Reflection; using System.Runtime.Loader; @@ -35,16 +36,21 @@ namespace Tizen.NUI } } - internal class NUIGadgetAssembly + /// + /// Represents a class that provides access to the methods and properties of the NUIGadgetAssembly. + /// + /// 10 + [EditorBrowsable(EditorBrowsableState.Never)] + public class NUIGadgetAssembly { private static readonly object _assemblyLock = new object(); private readonly string _assemblyPath; private WeakReference _assemblyRef; private Assembly _assembly = null; - public NUIGadgetAssembly(string assemblyPath) { _assemblyPath = assemblyPath; } + internal NUIGadgetAssembly(string assemblyPath) { _assemblyPath = assemblyPath; } - public void Load() + internal void Load() { lock (_assemblyLock) { @@ -65,9 +71,9 @@ namespace Tizen.NUI } } - public bool IsLoaded { get { return _assembly != null; } } + internal bool IsLoaded { get { return _assembly != null; } } - public NUIGadget CreateInstance(string className) + internal NUIGadget CreateInstance(string className) { lock (_assemblyLock) { @@ -75,7 +81,13 @@ namespace Tizen.NUI } } - public void Unload() + /// + /// Property indicating whether the weak reference to the gadget assembly is still alive. + /// + /// 12 + public bool IsAlive { get { return _assemblyRef.IsAlive; } } + + internal void Unload() { lock (_assemblyLock) { diff --git a/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetInfo.cs b/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetInfo.cs index d25f52007..dcd551f43 100755 --- a/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetInfo.cs +++ b/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetInfo.cs @@ -87,7 +87,11 @@ namespace Tizen.NUI internal Assembly Assembly { get; set; } - internal NUIGadgetAssembly NUIGadgetAssembly { get; set; } + /// + /// Gets the assembly of the gadget. + /// + /// 12 + public NUIGadgetAssembly NUIGadgetAssembly { get; set; } internal static NUIGadgetInfo CreateNUIGadgetInfo(string packageId) { diff --git a/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetManager.cs b/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetManager.cs index 05aa17466..c0289ea0b 100755 --- a/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetManager.cs +++ b/src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetManager.cs @@ -193,7 +193,6 @@ namespace Tizen.NUI if (info.NUIGadgetAssembly != null && info.NUIGadgetAssembly.IsLoaded) { info.NUIGadgetAssembly.Unload(); - info.NUIGadgetAssembly = null; } } } @@ -221,7 +220,7 @@ namespace Tizen.NUI } else { - if (info.NUIGadgetAssembly == null) + if (info.NUIGadgetAssembly == null || !info.NUIGadgetAssembly.IsLoaded) { Log.Warn("NUIGadgetAssembly.Load(): " + info.ResourcePath + info.ExecutableFile + " ++"); info.NUIGadgetAssembly = new NUIGadgetAssembly(info.ResourcePath + info.ExecutableFile);