示例#1
0
 /// <summary>
 /// 创建系统插件实体对象
 /// </summary>
 private void CreateSystemBundle()
 {
     try
     {
         systemBundle = new SystemBundle(this);
         systemBundle.BundleData.SetBundle(systemBundle);
     }
     catch (BundleException e)
     {
         throw new Exception(e.Message, e);
     }
 }
        /// <summary>
        /// 停止操作
        /// </summary>
        /// <param name="context"></param>
        public void Stop(IBundleContext context)
        {
            if (packageAdmin != null)
            {
                packageAdmin.Unregister();
            }
            if (startLevel != null)
            {
                startLevel.Unregister();
            }

            framework    = null;
            bundle       = null;
            this.context = null;
        }
        /// <summary>
        /// 启动操作
        /// </summary>
        /// <param name="context"></param>
        public void Start(IBundleContext context)
        {
            this.context = context as BundleContextImpl;
            bundle       = (SystemBundle)context.Bundle;
            framework    = bundle.Framework;

            if (framework.packageAdmin != null)
            {
                packageAdmin = Register(new String[] { ConfigConstant.BUNDLE_PACKAGEADMIN_NAME }, framework.packageAdmin, null);
            }
            if (framework.startLevelManager != null)
            {
                startLevel = Register(new String[] { ConfigConstant.BUNDLE_STARTLEVEL_NAME }, framework.startLevelManager, null);
            }
        }