当前位置: 首页>>代码示例>>C#>>正文


C# IServiceContainer.AddService方法代码示例

本文整理汇总了C#中IServiceContainer.AddService方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceContainer.AddService方法的具体用法?C# IServiceContainer.AddService怎么用?C# IServiceContainer.AddService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IServiceContainer的用法示例。


在下文中一共展示了IServiceContainer.AddService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

 public void Setup()
 {
     mr = new MockRepository();
     sc = new ServiceContainer();
     eventListener = new FakeDecompilerEventListener();
     cfgSvc = mr.Stub<IConfigurationService>();
     signatureFiles = new List<SignatureFile>();
     sc.AddService<DecompilerEventListener>(eventListener);
     sc.AddService<IConfigurationService>(cfgSvc);
     cfgSvc.Stub(d => d.GetSignatureFiles()).Return(signatureFiles);
 }
开发者ID:relaxar,项目名称:reko,代码行数:11,代码来源:LoaderTests.cs

示例2: Engine

        public Engine(GraphicsDeviceManager Graphics)
        {
            services = new ServiceContainer();
            services.AddService(typeof(IGraphicsDeviceService), Graphics);
            services.AddService(typeof(IGraphicsDeviceManager), Graphics);

            this.graphicsDevice = Graphics.GraphicsDevice;
            content = new IEContentManager(Services);
            spriteBatch = new SpriteBatch(GraphicsDevice);
            this.graphicsDevice = GraphicsDevice;
        }
开发者ID:blazes816,项目名称:Xanx,代码行数:11,代码来源:Engine.cs

示例3: Setup

        public void Setup()
        {
            repository = new MockRepository();
            interactor = repository.Stub<DisassemblyViewInteractor>();
            sc = new ServiceContainer();
            uiSvc = repository.DynamicMock<IDecompilerShellUiService>();
            dcSvc = repository.Stub<IDecompilerService>();
            dlgFactory = repository.DynamicMock<IDialogFactory>();
            sc.AddService<IDecompilerShellUiService>(uiSvc);

            sc.AddService<IDecompilerService>(dcSvc);
            sc.AddService<IDialogFactory>(dlgFactory);
        }
开发者ID:killbug2004,项目名称:reko,代码行数:13,代码来源:DisassemblyViewInteractorTests.cs

示例4: AddComponentsTo

        public static void AddComponentsTo(IServiceContainer container)
        {
            AddGenericRepositoriesTo(container);
            AddCustomRepositoriesTo(container);
            AddApplicationServicesTo(container);

            container.AddService(typeof(IValidator), typeof(Validator), LinFu.IoC.Configuration.LifecycleType.OncePerRequest);
        }
开发者ID:sztupy,项目名称:CodeChirp,代码行数:8,代码来源:ComponentRegistrar.cs

示例5: DesignerHost

        public DesignerHost(IServiceContainer parent)
        {
            // Keep the parent reference around for re-use
            this.parent = parent;

            // Initialise container helpers
            components = new Hashtable(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
            designers = new Hashtable();

            // Initialise transaction stack
            transactions = new Stack();

            // Add our own services
            parent.AddService(typeof(IDesignerHost), this);
            parent.AddService(typeof(IContainer), this);
            parent.AddService(typeof(IComponentChangeService), this);
            parent.AddService(typeof(ITypeDescriptorFilterService), this);

            // Add extender services
            extenderProviders = new ArrayList();
            parent.AddService(typeof(IExtenderListService), this);
            parent.AddService(typeof(IExtenderProviderService), this);
            AddExtenderProvider(this);

            // Add selection service
            parent.AddService(typeof(ISelectionService), new SelectionService(this));
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:27,代码来源:DesignerHost.cs

示例6: SourceControlProvider

        internal SourceControlProvider(IServiceProvider serviceLocator, IServiceContainer serviceContainer)
        {
            // Register the provider with the source control manager
            // If the package is to become active, this will also callback on OnActiveStateChange and the menu commands will be enabled
            var rscp = serviceLocator.GetService<IVsRegisterScciProvider>();
            rscp.RegisterSourceControlProvider(Constants.guidSccProvider);

            serviceContainer.AddService(GetType(), this, true);
        }
开发者ID:resnikb,项目名称:GitWorkflows,代码行数:9,代码来源:SourceControlProvider.cs

示例7: Get

 public static MenuCreationServiceContainer Get(IServiceContainer serviceContainer)
 {
     var current = serviceContainer.GetService<IMenuCreationService>();
     var r = current as MenuCreationServiceContainer;
     if (r == null)
     {
         r = new MenuCreationServiceContainer();
         if (current != null)
         {
             r.Add(current);
             serviceContainer.RemoveService(typeof(IMenuCreationService));
         }
         serviceContainer.AddService(typeof(IMenuCreationService), r);
     }
     return r;
 }
开发者ID:gitter-badger,项目名称:DevExpressMods,代码行数:16,代码来源:MenuCreationServiceContainer.cs

示例8: AlpaLanguageService

        //private readonly object _suppressEnvironmentsLock = new object();
        //private int _suppressEnvironmentsChanged;
        //private bool _environmentsChangedWasSuppressed;
        //private static readonly Dictionary<string, OptionInfo> _allFormattingOptions = new Dictionary<string, OptionInfo>();
        internal AlpaLanguageService(IServiceContainer container)
        {
            _container = container;

            var langService = new AlpaLanguageInfo(container);
            _container.AddService(langService.GetType(), langService, true);

            //    IVsTextManager textMgr = (IVsTextManager)container.GetService(typeof(SVsTextManager));
            //    if (textMgr != null)
            //    {
            //        var langPrefs = new LANGPREFERENCES[1];
            //        langPrefs[0].guidLang = typeof(PythonLanguageInfo).GUID;
            //        ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null));
            //        _langPrefs = new LanguagePreferences(this, langPrefs[0]);

            //        Guid guid = typeof(IVsTextManagerEvents2).GUID;
            //        IConnectionPoint connectionPoint;
            //        ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref guid, out connectionPoint);
            //        connectionPoint.Advise(_langPrefs, out _langPrefsTextManagerCookie);
            //    }

            //    _optionsService = (IPythonToolsOptionsService)container.GetService(typeof(IPythonToolsOptionsService));
            //    var compModel = (IComponentModel)container.GetService(typeof(SComponentModel));
            //    _interpreterOptionsService = compModel.GetService<IInterpreterOptionsService>();
            //    if (_interpreterOptionsService != null)
            //    {   // not available in some test cases...
            //        _interpreterOptionsService.InterpretersChanged += InterpretersChanged;
            //        _interpreterOptionsService.DefaultInterpreterChanged += UpdateDefaultAnalyzer;
            //        LoadInterpreterOptions();
            //    }

            //    _idleManager = new IdleManager(container);
            //    _advancedOptions = new AdvancedEditorOptions(this);
            //    _debuggerOptions = new DebuggerOptions(this);
            //    _generalOptions = new GeneralOptions(this);
            //    _surveyNews = new SurveyNewsService(container);
            //    _globalInterpreterOptions = new GlobalInterpreterOptions(this, _interpreterOptionsService);
            //    _globalInterpreterOptions.Load();
            //    _debugInteractiveOptions = new PythonInteractiveCommonOptions(this, "Debug Interactive Window", "");

            //    _logger = new PythonToolsLogger(ComponentModel.GetExtensions<IPythonToolsLogger>().ToArray());
            //    InitializeLogging();
        }
开发者ID:wiinuk,项目名称:AlpaVsix,代码行数:47,代码来源:AlpaLanguageService.cs

示例9: DesignerHostImpl

 public DesignerHostImpl(IServiceProvider parentProvider)
 {
     // append to the parentProvider...
     serviceContainer = new ServiceContainer(parentProvider);
     // site name to ISite mapping
     sites = new Hashtable();
     // component to designer mapping
     designers = new Hashtable();
     // list of extender providers
     extenderProviders = new ArrayList();
     // create transaction stack
     transactions = new Stack();
     // services
     serviceContainer.AddService(typeof(IDesignerHost), this);
     serviceContainer.AddService(typeof(IContainer), this);
     serviceContainer.AddService(typeof(IComponentChangeService), this);
     serviceContainer.AddService(typeof(IExtenderProviderService), this);
     serviceContainer.AddService(typeof(IDesignerEventService), this);
     serviceContainer.AddService(typeof(INameCreationService), new NameCreationServiceImpl(this));
     serviceContainer.AddService(typeof(ISelectionService), new SelectionServiceImpl(this));
     serviceContainer.AddService(typeof(IMenuCommandService), new MenuCommandServiceImpl(this));
 }
开发者ID:puentepr,项目名称:thuctapvietinsoft,代码行数:22,代码来源:DesignerHostImpl.cs

示例10: Register

        private void Register(bool register)
        {
            if (_registered == register)
                return;

            if (register)
            {
                if (_container == null && Context == null)
                    return;

                _container = Context.GetService<IServiceContainer>();

                if (_container == null)
                    return;

                if (null == _container.GetService(PageType))
                {
                    _registered = true;
                    _container.AddService(PageType, this);
                }
            }
            else if (_container != null)
            {
                _registered = false;
                _container.RemoveService(PageType);
                _container = null;
            }
        }
开发者ID:necora,项目名称:ank_git,代码行数:28,代码来源:PendingChangesPage.cs

示例11: Initialize

 public void Initialize(IServiceContainer source)
 {
     var typeName = GetType().Name;
     source.AddService<ITargetHolder>(typeName, this);
 }
开发者ID:sdether,项目名称:LinFu,代码行数:5,代码来源:SampleAroundInvokeInterceptorClass.cs

示例12: SampleDesignerHost

        // We take a service provider in our constructor so that our main form can give us
		// services (like the property grid and toolbox).
        public SampleDesignerHost(IServiceProvider parentProvider) {
            this.serviceContainer = new ServiceContainer(parentProvider);
            designerTable = new Hashtable();
            sites = new Hashtable(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
            loadingDesigner = false;
            transactionCount = 0;
            reloading = false;
        
            // Services that we already have implemented on our object
            serviceContainer.AddService(typeof(IDesignerHost), this);
            serviceContainer.AddService(typeof(IContainer), this);
            serviceContainer.AddService(typeof(IComponentChangeService), this);
            serviceContainer.AddService(typeof(IExtenderProviderService), this);
			serviceContainer.AddService(typeof(IDesignerEventService), this);

			// And services that we demand create.
			ServiceCreatorCallback callback = new ServiceCreatorCallback(this.OnCreateService);

			serviceContainer.AddService(typeof(IToolboxService), callback);      
            serviceContainer.AddService(typeof(ISelectionService), callback);
			serviceContainer.AddService(typeof(ITypeDescriptorFilterService), callback);
			serviceContainer.AddService(typeof(IMenuCommandService), callback);
//          serviceContainer.AddService(typeof(IMenuEditorService), callback); - UNIMPLEMENTED
//          serviceContainer.AddService(typeof(IHelpService), callback); - UNIMPLEMENTED
//          serviceContainer.AddService(typeof(IReferenceService), callback); - UNIMPLEMENTED
//          serviceContainer.AddService(typeof(IPropertyValueUIService), callback); - UNIMPLEMENTED

            // Configure extender providers.
            ((IExtenderProviderService)this).AddExtenderProvider(new SampleNameExtenderProvider(this));
            ((IExtenderProviderService)this).AddExtenderProvider(new SampleInheritedNameExtenderProvider(this));
            //defaultMenuCommands = new DefaultMenuCommands(this);
            //defaultMenuCommands.AddTo(menuCommandService);
            // +Add Serialization Service  
            serviceContainer.AddService(typeof(IDesignerSerializationService), callback);
            // -Add Serialization Service  
            currentComponentsCombo = new NETXP.Controls.ComboBoxEx();
            currentComponentsCombo.Visible = false;
            VisualPascalABC.Form1.Form1_object.PropertiesWindow.GetComponentsComboPanel().Controls.Add(currentComponentsCombo);
            currentComponentsCombo.EnableMRU = false;
            currentComponentsCombo.Dock = DockStyle.Fill;
            NETXP.Controls.ComboBoxEx baseCombo = VisualPascalABC.Form1.Form1_object.PropertiesWindow.GetComponentsCombo();
            currentComponentsCombo.ItemHeight = baseCombo.ItemHeight;
            currentComponentsCombo.Font = baseCombo.Font;
            currentComponentsCombo.DrawMode = baseCombo.DrawMode;
            currentComponentsCombo.DropDownStyle = baseCombo.DropDownStyle;
            currentComponentsCombo.Flags = baseCombo.Flags;
            currentComponentsCombo.SelectedIndexChanged += new EventHandler(currentComponentsCombo_SelectedIndexChanged);
            currentComponentsCombo.Visible = true;
            currentComponentsCombo.ImageList = controlImages;
        }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:52,代码来源:SampleDesignerHost.cs

示例13: CreateServices

        private void CreateServices(IServiceFactory svcFactory, IServiceContainer sc, DecompilerMenus dm)
        {
            sc.AddService<DecompilerHost>(this);

            config = svcFactory.CreateDecompilerConfiguration();
            sc.AddService(typeof(IConfigurationService), config);

            var cmdFactory = new Commands.CommandFactory(sc);
            sc.AddService<ICommandFactory>(cmdFactory);

            sc.AddService(typeof(IStatusBarService), (IStatusBarService)this);

            diagnosticsSvc = svcFactory.CreateDiagnosticsService(form.DiagnosticsList);
            sc.AddService(typeof(IDiagnosticsService), diagnosticsSvc);

            decompilerSvc = svcFactory.CreateDecompilerService();
            sc.AddService(typeof(IDecompilerService), decompilerSvc);

            uiSvc = svcFactory.CreateShellUiService(form, dm);
            subWindowCommandTarget = uiSvc;
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerUIService), uiSvc);

            var codeViewSvc = new CodeViewerServiceImpl(sc);
            sc.AddService(typeof(ICodeViewerService), codeViewSvc);
            var segmentViewSvc = new ImageSegmentServiceImpl(sc);
            sc.AddService(typeof(ImageSegmentService), segmentViewSvc);

            var del = svcFactory.CreateDecompilerEventListener();
            workerDlgSvc = (IWorkerDialogService)del;
            sc.AddService(typeof(IWorkerDialogService), workerDlgSvc);
            sc.AddService(typeof(DecompilerEventListener), del);

            loader = svcFactory.CreateLoader();
            sc.AddService(typeof(ILoader), loader);

            var abSvc = svcFactory.CreateArchiveBrowserService();
            sc.AddService(typeof(IArchiveBrowserService), abSvc);

            sc.AddService(typeof(ILowLevelViewService), svcFactory.CreateMemoryViewService());
            sc.AddService(typeof(IDisassemblyViewService), svcFactory.CreateDisassemblyViewService());

            var tlSvc = svcFactory.CreateTypeLibraryLoaderService();
            sc.AddService(typeof(ITypeLibraryLoaderService), tlSvc);

            this.projectBrowserSvc = svcFactory.CreateProjectBrowserService(form.ProjectBrowser);
            sc.AddService<IProjectBrowserService>(projectBrowserSvc);

            var upSvc = svcFactory.CreateUiPreferencesService();
            sc.AddService<IUiPreferencesService>(upSvc);

            var fsSvc = svcFactory.CreateFileSystemService();
            sc.AddService<IFileSystemService>(fsSvc);

            this.searchResultsTabControl = svcFactory.CreateTabControlHost(form.TabControl);
            sc.AddService<ITabControlHostService>(this.searchResultsTabControl);

            srSvc = svcFactory.CreateSearchResultService(form.FindResultsList);
            sc.AddService<ISearchResultService>(srSvc);
            searchResultsTabControl.Attach((IWindowPane) srSvc, form.FindResultsPage);
            searchResultsTabControl.Attach((IWindowPane) diagnosticsSvc, form.DiagnosticsPage);

            var resEditService = svcFactory.CreateResourceEditorService();
            sc.AddService<IResourceEditorService>(resEditService);
        }
开发者ID:nemerle,项目名称:reko,代码行数:65,代码来源:MainFormInteractor.cs

示例14: InitializeWorkspaceServiceContainer

 private void InitializeWorkspaceServiceContainer(IServiceContainer container)
 {
     container.AddService (typeof (ITypeResolutionService), new TypeResolutionService (this.References));
 }
开发者ID:himdel,项目名称:mwf-designer,代码行数:4,代码来源:Workspace.cs

示例15: Register

 internal static void Register(IServiceContainer serviceContainer)
 {
     serviceContainer.AddService(typeof(TemplateLocator), CreateService, true);
 }
开发者ID:icool123,项目名称:T4Toolbox,代码行数:4,代码来源:TemplateLocator.cs


注:本文中的IServiceContainer.AddService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。