Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        public void Start(IBundleContext context)
        {
            context.ServiceChanged += ContextOnServiceChanged;
            var serviceReference = context.GetServiceReference <IHelloWord>();
            var service          = context.GetService <IHelloWord>(serviceReference);

            log.Info(service.SayHi("BundleDemoB" + ReferenceClass.GetName()));

            var serviceRef1 = context.GetServiceReferences <IMutilImplement>(new Dictionary <string, object>()
            {
                { "id", "1" }
            }).FirstOrDefault();
            var service1 = context.GetService <IMutilImplement>(serviceRef1);

            log.Info(service1.TestMethod());

            var serviceRef2 = context.GetServiceReferences <IMutilImplement>(new Dictionary <string, object>()
            {
                { "id", "2" }
            }).FirstOrDefault();
            var service2 = context.GetService <IMutilImplement>(serviceRef2);

            log.Info(service2.TestMethod());


            var serviceRef3 = context.GetServiceReferences <IMutilImplement>(new Dictionary <string, object>()
            {
                { "id", "3" }
            }).FirstOrDefault();
            var service3 = context.GetService <IMutilImplement>(serviceRef3);

            log.Info(service3.TestMethod());
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        public void Start(IBundleContext context)
        {
            var serviceRef = context.GetServiceReference <IAttachContent>();
            var service    = context.GetService <IAttachContent>(serviceRef);

            service.AttachUcContent(new UserControl1());
        }
Exemplo n.º 3
0
        private void ItemOnClick(object sender, EventArgs eventArgs)
        {
            var serviceRef = BundleContext.GetServiceReference <IMenuItemEvent>();
            var servcie    = BundleContext.GetService <IMenuItemEvent>(serviceRef);

            servcie.FireEvent(((NavBarItem)sender).Content.ToString());
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        public void Start(IBundleContext context)
        {
            var serviceRef = context.GetServiceReference <IAttachContent>();

            AttachContentService = context.GetService <IAttachContent>(serviceRef);

            serviceRegistration = context.RegisterService <IMenuItemEvent>(new MenuItemEvent());
        }
Exemplo n.º 5
0
        public void Start(IBundleContext context)
        {
            var serviceReference = context.GetServiceReference <ILogService>();

            logService = context.GetService <ILogService>(serviceReference);
            logger     = logService.GetLogger();
            logger.Debug("CachePlugin Started!");
        }
Exemplo n.º 6
0
        public void Start(IBundleContext context)
        {
            var eventServiceReference = context.GetServiceReference <IEventService>();

            eventService = context.GetService <IEventService>(eventServiceReference);

            var dbServiceReference = context.GetServiceReference <IDBServices>();

            dBServices = context.GetService <IDBServices>(dbServiceReference);

            var logServiceReference = context.GetServiceReference <ILogService>();

            logService = context.GetService <ILogService>(logServiceReference);
            logger     = logService.GetLogger();
            ListenerTest listener = new ListenerTest(eventService, logService, dBServices);

            logger.Debug("TestPlugin Started!");
        }
Exemplo n.º 7
0
        public void Start(IBundleContext context)
        {
            // 获取服务
            var logServiceReference = context.GetServiceReference <ILogService>();

            logService = context.GetService <ILogService>(logServiceReference);

            var eventServiceReference = context.GetServiceReference <IEventService>();

            eventService = context.GetService <IEventService>(eventServiceReference);

            logger = logService.GetLogger();

            // 注册服务
            serviceRegistration = context.RegisterService <IDBServices>(new DBServices(logService, eventService));

            logger.Debug("DBPlugin Started!");
        }
Exemplo n.º 8
0
        /// <summary>
        /// 启动列表中所有的插件
        /// </summary>
        /// <param name="bundles"></param>
        private void StartBundles(IBundle[] bundles)
        {
            IServiceReference reference    = context.GetServiceReference(typeof(IStartLevel).FullName);
            IStartLevel       startService = null;

            if (reference != null)
            {
                startService = context.GetService <IStartLevel>(reference);
            }
            try
            {
                foreach (AbstractBundle bundle in bundles)
                {
                    if (bundle == null)
                    {
                        break;
                    }
                    if (bundle.BundleData.Policy == ActivatorPolicy.Lazy)
                    {
                        StartBundle(bundle, BundleOptions.Transient);
                    }
                    else
                    {
                        // always set the startlevel incase it has changed (bug 111549)
                        // this is a no-op if the level is the same as previous launch.
                        if (bundle.StartLevel == 0 && startService != null)
                        {
                            startService.SetBundleStartLevel(bundle, GetStartLevel());
                        }
                        StartBundle(bundle, BundleOptions.General);
                    }
                }
            }
            finally
            {
                if (reference != null)
                {
                    context.UngetService(reference);
                }
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// 启动Word应程序管理器
 /// </summary>
 public void Start()
 {
     if (!_isActive)
     {
         string type = "Microsoft.Office.Tools.CustomTaskPaneCollection";
         _customTaskPaneReference = _context.GetServiceReference(type);
         if (_customTaskPaneReference != null)
         {
             _isActive = true;
         }
     }
 }
Exemplo n.º 10
0
        public void Start(IBundleContext context)
        {
            string fullName            = typeof(ILogService).Assembly.FullName;
            var    logServiceReference = context.GetServiceReference <ILogService>();

            logService = context.GetService <ILogService>(logServiceReference);

            logger = logService.GetLogger();

            // 注册服务
            serviceRegistration = context.RegisterService <IEventService>(new EventService());

            logger.Info("EventHandlePlugin Started!");
        }
Exemplo n.º 11
0
 /// <summary>
 /// 启动Word应程序管理器
 /// </summary>
 public void Start()
 {
     if (!isActive)
     {
         string type = "Microsoft.Office.Interop.Word.Application";
         wordApplicationReference = context.GetServiceReference(type);
         if (wordApplicationReference != null)
         {
             OfficeWord.Application app = this.GetApp();
             if (app != null)
             {
                 app.DocumentOpen          += OnDocumentOpen;
                 app.DocumentChange        += OnDocumentChange;
                 app.DocumentBeforeSave    += OnDocumentBeforeSave;
                 app.DocumentBeforeClose   += OnDocumentBeforeClose;
                 app.WindowActivate        += OnWindowActivate;
                 app.WindowSelectionChange += OnSelectionChange;
             }
             isActive = true;
         }
     }
 }