Exemplo n.º 1
0
        public void Start(IBundleContext context)
        {
            try
            {
                context.AddFrameworkListener(this);
                context.AddBundleListener(this);

                this.OpenSplashScreen();

                var dto = context.Framework.Adapt <FrameworkDto>();
                foreach (var key in dto.Properties.Keys)
                {
                    Workbench.Context.Add(key, dto.Properties[key]);
                }

                this.InitProductProperty(context);

                this.InitializeComponentMetaData();

                this.UpdateOptimizeInterval(context);


                // 更新产品属性
                UpdateProductProperty();
            }
            catch (Exception ex)
            {
                HandleAppStartError(ex);
            }
        }
Exemplo n.º 2
0
        public void LoadBundle()
        {
            IFrameworkFactory factory = new CFrameworkFactory();
            IFramework        fwk     = factory.NewFramework(null);

            fwk.Init();

            Expect.Once.On(bundle_listener)
            .Method("BundleChanged");

            IBundleContext ctx = fwk.getBundleContext();

            ctx.AddBundleListener(bundle_listener);

            IBundle test_bundle = ctx.InstallBundle(TEST_BUNDLE_LOCATION);

            Assert.IsNotNull(test_bundle);
            Assert.AreEqual(test_bundle.getState(), BundleState.INSTALLED);

            Assert.AreEqual(test_bundle, ctx.getBundle(test_bundle.getBundleId()));
            Assert.AreEqual(test_bundle, ctx.InstallBundle(TEST_BUNDLE_LOCATION));

            mockery.VerifyAllExpectationsHaveBeenMet();
        }