年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.0 KiB

using KGIS.Framework.Utils;
using Kingo.PluginServiceInterface;
using System;
using System.Configuration;
using System.Reflection;
using System.Runtime.InteropServices;
using UIShell.OSGi;
namespace Kingo.Plugin.ProofManager
{
public class Activator : IBundleActivator
{
IElementInfo _ProofImg = null;
IElementInfo _ProofInfo = null;
public void Start(IBundleContext context)
{
#if DEBUG
_ProofImg = new View.UCImgView();
_ProofInfo = new View.UCProofInfo();
context.AddService<IElementInfo>(_ProofInfo);
context.AddService<IElementInfo>(_ProofImg);
#else
ValidityVerification(context);
#endif
}
public void Stop(IBundleContext context)
{
if (_ProofImg != null)
context.RemoveService<IElementInfo>(_ProofImg);
if (_ProofInfo != null)
context.RemoveService<IElementInfo>(_ProofInfo);
}
private void ValidityVerification(IBundleContext context)
{
try
{
Attribute guid_attr = Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(GuidAttribute));
string guid = ((GuidAttribute)guid_attr).Value;
var type = ConfigurationManager.AppSettings.Get("LicenseType");
//if (!RunIDService2.Instance.Models.Contains(guid))
//{
// Console.WriteLine(guid);
// throw new Exception(string.Format("【{0}】插件未授权,加载失败", context.Bundle.Name));
//}
_ProofImg = new View.UCImgView();
_ProofInfo = new View.UCProofInfo();
context.AddService<IElementInfo>(_ProofInfo);
context.AddService<IElementInfo>(_ProofImg);
}
catch (Exception ex)
{
LogAPI.Debug(ex);
throw ex;
}
}
}
}