using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
+using System.Reflection;
using System.Runtime.InteropServices;
using Tizen.Applications;
internal string ResourceClassName { get; set; }
+ internal Assembly Assembly { get; set; }
+
internal static NUIGadgetInfo CreateNUIGadgetInfo(string packageId)
{
Interop.PackageManagerInfo.ErrorCode errorCode = Interop.PackageManagerInfo.PackageInfoGet(packageId, out IntPtr handle);
throw new ArgumentException("Failed to find NUIGadgetInfo. resource type: " + resourceType);
}
- Assembly assembly = null;
try
{
- Log.Warn("NUIGadgetAssembly.Load(): " + info.ResourcePath + info.ExecutableFile + " ++");
- assembly = Assembly.Load(File.ReadAllBytes(info.ResourcePath + info.ExecutableFile));
- Log.Warn("NUIGadgetAssembly.Load(): " + info.ResourcePath + info.ExecutableFile + " --");
+ if (info.Assembly == null)
+ {
+ Log.Warn("NUIGadgetAssembly.Load(): " + info.ResourcePath + info.ExecutableFile + " ++");
+ info.Assembly = Assembly.Load(File.ReadAllBytes(info.ResourcePath + info.ExecutableFile));
+ Log.Warn("NUIGadgetAssembly.Load(): " + info.ResourcePath + info.ExecutableFile + " --");
+ }
}
catch (FileLoadException e)
{
throw new InvalidOperationException(e.Message);
}
- NUIGadget gadget = assembly.CreateInstance(className, true) as NUIGadget;
+ NUIGadget gadget = info.Assembly.CreateInstance(className, true) as NUIGadget;
if (gadget == null)
{
throw new InvalidOperationException("Failed to create instance. className: " + className);