|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using Kingo.Plugin.NYYP.View;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using UIShell.OSGi;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.NYYP
|
|
|
|
|
{
|
|
|
|
|
public class Activator : IBundleActivator
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 内业预判信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
IElementInfo _NYYPInfo = null;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 内业预判信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
IElementInfo _NYYPInfo2 = null;
|
|
|
|
|
|
|
|
|
|
IElementInfo _WYInfo = null;
|
|
|
|
|
IElementInfo _TBBG = null;
|
|
|
|
|
IElementInfo _UCWYSketch = null;
|
|
|
|
|
public void Start(IBundleContext context)
|
|
|
|
|
{
|
|
|
|
|
#if DEBUG
|
|
|
|
|
_WYInfo = new UCWYInfo();
|
|
|
|
|
context.AddService(_WYInfo);
|
|
|
|
|
|
|
|
|
|
_TBBG = new UCTBBG();
|
|
|
|
|
context.AddService(_TBBG);
|
|
|
|
|
|
|
|
|
|
_NYYPInfo = new UCNYYPInfo();
|
|
|
|
|
context.AddService<IElementInfo>(_NYYPInfo);
|
|
|
|
|
|
|
|
|
|
_NYYPInfo2 = new UCNYYP();
|
|
|
|
|
context.AddService<IElementInfo>(_NYYPInfo2);
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
ValidityVerification(context);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Stop(IBundleContext context)
|
|
|
|
|
{
|
|
|
|
|
if (_NYYPInfo != null)
|
|
|
|
|
context.RemoveService<IElementInfo>(_NYYPInfo);
|
|
|
|
|
}
|
|
|
|
|
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))
|
|
|
|
|
//{
|
|
|
|
|
// throw new Exception(string.Format("【{0}】插件未授权,加载失败", context.Bundle.Name));
|
|
|
|
|
//}
|
|
|
|
|
_WYInfo = new UCWYInfo();
|
|
|
|
|
context.AddService(_WYInfo);
|
|
|
|
|
|
|
|
|
|
_TBBG = new UCTBBG();
|
|
|
|
|
context.AddService(_TBBG);
|
|
|
|
|
|
|
|
|
|
_NYYPInfo = new UCNYYPInfo();
|
|
|
|
|
context.AddService<IElementInfo>(_NYYPInfo);
|
|
|
|
|
|
|
|
|
|
_NYYPInfo2 = new UCNYYP();
|
|
|
|
|
context.AddService<IElementInfo>(_NYYPInfo2);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|