コード例 #1
0
        public void Start(IBundleContext context)
        {
            Bundle = context.Bundle;
            BundleManagementServiceTracker = new ServiceTracker <IBundleManagementService>(context);
            BundleInstallerService         = context.GetFirstOrDefaultService <IBundleInstallerService>();
            Application firstOrDefaultService = context.GetFirstOrDefaultService <Application>();

            if (firstOrDefaultService != null)
            {
                try
                {
                    ResourceDictionary resourceDictionary = new ResourceDictionary();
                    resourceDictionary.MergedDictionaries.Add(new ResourceDictionary
                    {
                        Source = new Uri("/FirstFloor.ModernUI,Version=1.0.3.0;component/Assets/ModernUI.xaml", UriKind.RelativeOrAbsolute)
                    });
                    resourceDictionary.MergedDictionaries.Add(new ResourceDictionary
                    {
                        Source = new Uri("/FirstFloor.ModernUI,Version=1.0.3.0;component/Assets/ModernUI.Light.xaml", UriKind.RelativeOrAbsolute)
                    });
                    firstOrDefaultService.Resources = resourceDictionary;
                }
                catch
                {
                }
            }
        }
コード例 #2
0
        public void Start(IBundleContext context)
        {
            BundleContext                   = context;
            Bundle                          = context.Bundle;
            NavigationServiceTracker        = new ServiceTracker <INavigationService>(context);
            ConfigurationServiceTracker     = new ServiceTracker <IConfigurationService>(context);
            PermissionServiceTracker        = new ServiceTracker <IPermissionService>(context);
            NavigationServiceFactoryTracker = new ServiceTracker <INavigationServiceFactory>(context);
            MainWindowServiceTracker        = new ServiceTracker <IMainWindowService>(context);

            FirstFloor.ModernUI.Resources.Culture = new CultureInfo("zh-CN");

            var app = context.GetFirstOrDefaultService <Application>();

            if (app != null)
            {
                try
                {
                    // 注册ModernUI皮肤资源。
                    ResourceDictionary r = new ResourceDictionary();
                    r.MergedDictionaries.Add(new ResourceDictionary()
                    {
                        Source = new Uri("/FirstFloor.ModernUI,Version=1.0.6.0;component/Assets/ModernUI.xaml", UriKind.RelativeOrAbsolute)
                    });
                    r.MergedDictionaries.Add(new ResourceDictionary()
                    {
                        Source = new Uri("/FirstFloor.ModernUI,Version=1.0.6.0;component/Assets/ModernUI.Light.xaml", UriKind.RelativeOrAbsolute)
                    });
                    app.Resources = r;
                }
                catch
                {
                }
            }
        }
コード例 #3
0
ファイル: Activator.cs プロジェクト: zhangleigithub/osgi
        public void Start(IBundleContext context)
        {
            IWindow window = context.GetFirstOrDefaultService <IWindow>();

            MenuItem menuItem = new MenuItem();

            menuItem.Header = "cs";
            menuItem.Click += (sender, e) =>
            {
                WebBrowser browser = new WebBrowser();
                browser.Navigate("https://www.baidu.com/");
                //Frame frame = new Frame();
                //frame.Source = new Uri("https://www.baidu.com/");
                window.AddChildrenToLayoutRootPanel("BCD Reader", browser);
            };

            window.AddMenuItem(menuItem);

            window.AddChildrenToLeftSide("Text1", new TextBlock()
            {
                Text = "Text01"
            });
            window.AddChildrenToRightSide("Text1", new TextBlock()
            {
                Text = "Text02"
            });
        }
コード例 #4
0
 public ServiceTracker(IBundleContext context, bool throwsExceptionIfServiceNotFound)
 {
     AssertUtility.ArgumentNotNull(context, "BundleContext");
     BundleContext           = context;
     _defaultOrFirstService  = context.GetFirstOrDefaultService <TServiceInterface>();
     _serviceInstances       = context.GetService <TServiceInterface>();
     context.ServiceChanged += new EventHandler <ServiceEventArgs>(ServiceChanged);
 }
コード例 #5
0
 public void Start(IBundleContext context)
 {
     Context = context;
     ExtensionService = context.GetFirstOrDefaultService<IExtensionService>();
     WeChatProxyContainer = new WeChatProxyContainer();
     WeChatMenuContainer = new WeChatMenuContainer();
     WeChatProxyService = new WeChatProxyService();
     context.AddService<IWeChatProxyService>(WeChatProxyService);
 }
コード例 #6
0
 public void Start(IBundleContext context)
 {
     Context              = context;
     ExtensionService     = context.GetFirstOrDefaultService <IExtensionService>();
     WeChatProxyContainer = new WeChatProxyContainer();
     WeChatMenuContainer  = new WeChatMenuContainer();
     WeChatProxyService   = new WeChatProxyService();
     context.AddService <IWeChatProxyService>(WeChatProxyService);
 }
コード例 #7
0
        public void Start(IBundleContext context)
        {
            SetVisualApplicationSettings();
            context.AddService <Form>(mainForm);
            context.AddService <IWorkspace>(mainForm);

            var extensionManager = context.GetFirstOrDefaultService <IExtensionManager>();

            extensionManager.ExtensionChanged += extensionManager_ExtensionChanged;
        }
コード例 #8
0
ファイル: Activator.cs プロジェクト: rveluthattil/osgi
        public void Start(IBundleContext context)
        {
            _context = context;
            context.AddService <ICommandBusService>(
                new CommandBusService(context.GetFirstOrDefaultService <IMessageBusService>()));

            var factory = new AdapterFactoryCatalog <IEditHandler>();

            factory.RegisterFactory(new TextBoxAdapterFactory());
            context.AddService <IAdapterFactoryCatalog <IEditHandler> >(factory);
            context.AddService <IEditManager>(new EditManager(factory));
            context.AddService <IDocumentManager>(new DocumentManager());
            var layoutView = context.GetFirstOrDefaultService <IShellLayoutView>();

            _extensionManager = context.GetFirstOrDefaultService <IExtensionManager>();
            _extensionHooker  = new ExtensionHooker(_extensionManager);

            var extensionChangeHandler = new ExtensionChangeHandler(new ToolStripBuilder(),
                                                                    toolStrip =>
                                                                    layoutView.AddToolStrip((ToolStrip)toolStrip),
                                                                    toolStrip =>
                                                                    layoutView.RemoveToolStrip((ToolStrip)toolStrip));

            _extensionHooker.HookExtension(ExtensionPointNames.ToolStrip, extensionChangeHandler);

            extensionChangeHandler = new ExtensionChangeHandler(new MainMenuBuilder(),
                                                                toolStripItem => layoutView.AddMenuItem((ToolStripItem)toolStripItem),
                                                                toolStripItem => layoutView.RemoveMenuItem((ToolStripItem)toolStripItem));
            _extensionHooker.HookExtension(ExtensionPointNames.MainMenu, extensionChangeHandler);

            var docManager = _context.GetFirstOrDefaultService <IDocumentManager>();

            extensionChangeHandler = new ExtensionChangeHandler(new FileFilterBuilder(),
                                                                documentFactory => docManager.Register((IDocumentFactory)documentFactory),
                                                                documentFactory => docManager.UnRegister((IDocumentFactory)documentFactory));
            _extensionHooker.HookExtension(ExtensionPointNames.FileFilters, extensionChangeHandler);
            StartActiveControlMonitor();
        }
コード例 #9
0
ファイル: Activator.cs プロジェクト: zhangleigithub/osgi
        public void Start(IBundleContext context)
        {
            IWindow window = context.GetFirstOrDefaultService <IWindow>();

            MenuItem menuItem = new MenuItem();

            menuItem.Header = "Coverage";
            menuItem.Click += (sender, e) =>
            {
                window.AddChildrenToLayoutRootPanel("Coverage Reader", new CustomControl());
            };

            window.AddMenuItem(menuItem);
        }
コード例 #10
0
 //监控服务的变化
 void CustomerContext_ServiceChanged(object sender, ServiceEventArgs e)
 {
     if (CustomerContext != null && e.ServiceType == "SystemService.IAccountService.ILoginCache")
     {
         if (e.ServiceEventType == ServiceEventType.Add)
         {
             LoginCache = CustomerContext.GetFirstOrDefaultService <SystemService.IAccountService.ILoginCache>();
         }
         if (e.ServiceEventType == ServiceEventType.Remove)
         {
             LoginCache = null;
         }
     }
 }
コード例 #11
0
ファイル: Activator.cs プロジェクト: zhangleigithub/osgi
        public void Start(IBundleContext context)
        {
            IWindow window = context.GetFirstOrDefaultService <IWindow>();

            MenuItem menuItem = new MenuItem();

            menuItem.Header = "MDI";
            menuItem.Click += (sender, e) =>
            {
                MainWindow main = new MainWindow();
                main.Show();
            };

            window.AddMenuItem(menuItem);
        }
コード例 #12
0
        public void Start(IBundleContext context)
        {
            //加载账号服务
            if (context != null)
            {
                //第一步:保存插件上下文
                CustomerContext = context;

                //第二步:获取账号服务(检查当前模块是否在合法菜单内)
                LoginCache = CustomerContext.GetFirstOrDefaultService <SystemService.IAccountService.ILoginCache>();

                //第三步:监听系统账号服务
                CustomerContext.ServiceChanged += CustomerContext_ServiceChanged;
            }

            //加载字典
            //Application firstOrDefaultService = context.GetFirstOrDefaultService<Application>();
            //if (firstOrDefaultService != null)
            //{
            //    try
            //    {
            //        firstOrDefaultService.Resources = new ResourceDictionary
            //        {
            //            MergedDictionaries =
            //            {
            //                new ResourceDictionary
            //                {
            //                    Source = new Uri("/FirstFloor.ModernUI,Version=1.0.9.0;component/Assets/ModernUI.xaml", UriKind.RelativeOrAbsolute)
            //                },
            //                new ResourceDictionary
            //                {
            //                    Source = new Uri("/FirstFloor.ModernUI,Version=1.0.9.0;component/Assets/ModernUI.Light.xaml", UriKind.RelativeOrAbsolute)
            //                }
            //            }
            //        };
            //    }
            //    catch
            //    {
            //    }
            //}
        }
コード例 #13
0
        public void Start(IBundleContext context)
        {
            var builder = context.GetFirstOrDefaultService <ContainerBuilder>();

            builder.RegisterType <MovieManager>().AsImplementedInterfaces();
        }