Ejemplo n.º 1
0
        public void start(int options)
        {
            if (this.state == Bundle_Const.INSTALLED)
            {
                try
                {
                    resolve();
                    this.state = Bundle_Const.RESOLVED;
                }
                catch
                {
                    this.state = Bundle_Const.INSTALLED;
                    throw;
                }
            }
            if (this.state == Bundle_Const.RESOLVED && this.activatorClassName != null)
            {
                this.state = Bundle_Const.STARTING;

                try
                {
                    framework.fireBundleEvent(new BundleEvent(BundleEvent.STARTING, this));
                    bundleActivator = Activator.CreateInstance(bundleAssembly.GetType(activatorClassName)) as BundleActivator;
                    bundleActivator.start(bundleContext);
                    this.state = Bundle_Const.ACTIVE;
                    framework.fireBundleEvent(new BundleEvent(BundleEvent.STARTED, this));
                }
                catch
                {
                    this.state = Bundle_Const.RESOLVED;
                    throw;
                }
            }
        }
Ejemplo n.º 2
0
        public void start(int options)
        {
            if (this.state == Bundle_Const.INSTALLED)
            {
                try
                {
                    resolve();
                    this.state = Bundle_Const.RESOLVED;
                }
                catch (Exception ex)
                {
                    this.state = Bundle_Const.INSTALLED;
                    throw ex;
                }
            }
            if (this.state == Bundle_Const.RESOLVED && this.activatorClassName != null)
            {
                this.state = Bundle_Const.STARTING;

                try
                {
                    framework.fireBundleEvent(new BundleEvent(BundleEvent.STARTING, this));
                    if (framework.IsUseAppDomain())
                    {
                        bundleActivator = bundleAppDomain.CreateInstanceAndUnwrap(bundleAssemblyFullName, activatorClassName) as BundleActivator;
                    }
                    else
                    {
                        bundleActivator = Activator.CreateInstance(bundleAssembly.GetType(activatorClassName)) as BundleActivator;
                    }
                    bundleActivator.start(bundleContext);
                    this.state = Bundle_Const.ACTIVE;
                    framework.fireBundleEvent(new BundleEvent(BundleEvent.STARTED, this));
                }
                catch (Exception ex)
                {
                    this.state = Bundle_Const.RESOLVED;
                    throw ex;
                }
            }
        }