• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ServiceCreatorCallback类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ServiceCreatorCallback的典型用法代码示例。如果您正苦于以下问题:C# ServiceCreatorCallback类的具体用法?C# ServiceCreatorCallback怎么用?C# ServiceCreatorCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ServiceCreatorCallback类属于命名空间,在下文中一共展示了ServiceCreatorCallback类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SampleDesignerHost

 public SampleDesignerHost(IServiceProvider parentProvider)
 {
     this.serviceContainer = new ServiceContainer(parentProvider);
     this.designerTable = new Hashtable();
     this.sites = new Hashtable(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
     this.loadingDesigner = false;
     this.transactionCount = 0;
     this.reloading = false;
     this.serviceContainer.AddService(typeof(IDesignerHost), this);
     this.serviceContainer.AddService(typeof(IContainer), this);
     this.serviceContainer.AddService(typeof(IComponentChangeService), this);
     this.serviceContainer.AddService(typeof(IExtenderProviderService), this);
     this.serviceContainer.AddService(typeof(IDesignerEventService), this);
     CodeDomComponentSerializationService codeDomComponentSerializationService = new CodeDomComponentSerializationService(this.serviceContainer);
     if (codeDomComponentSerializationService != null)
     {
         this.serviceContainer.RemoveService(typeof(ComponentSerializationService), false);
         this.serviceContainer.AddService(typeof(ComponentSerializationService), codeDomComponentSerializationService);
     }
     ServiceCreatorCallback callback = new ServiceCreatorCallback(this.OnCreateService);
     this.serviceContainer.AddService(typeof(IToolboxService), callback);
     this.serviceContainer.AddService(typeof(ISelectionService), callback);
     this.serviceContainer.AddService(typeof(ITypeDescriptorFilterService), callback);
     this.serviceContainer.AddService(typeof(IMenuCommandService), callback);
     this.serviceContainer.AddService(typeof(IDesignerSerializationService), callback);
     ((IExtenderProviderService) this).AddExtenderProvider(new SampleNameExtenderProvider(this));
     ((IExtenderProviderService) this).AddExtenderProvider(new SampleInheritedNameExtenderProvider(this));
 }
开发者ID:MuffPotter,项目名称:XamarinDesigner,代码行数:28,代码来源:SampleDesignerHost.cs


示例2: AddService

        /// <summary>
        /// Adds the specified service to the service container.
        /// </summary>
        /// <param name="serviceType">The type of service to add.</param>
        /// <param name="callback">A callback object that is used to create the service. This allows a service to be declared as available, but delays the creation of the object until the service is requested.</param>
        public void AddService(Type serviceType, ServiceCreatorCallback callback)
        {
            Guard.NotNull(() => serviceType, serviceType);
            Guard.NotNull(() => callback, callback);

            this.services.Add(serviceType, callback);
        }
开发者ID:StevenVanDijk,项目名称:NuPattern,代码行数:12,代码来源:ProxyServiceProvider.cs


示例3: CommonPackage

 internal CommonPackage()
 {
     IServiceContainer container = this as IServiceContainer;
     ServiceCreatorCallback callback = new ServiceCreatorCallback(CreateService);
     //container.AddService(GetLanguageServiceType(), callback, true);
     container.AddService(GetLibraryManagerType(), callback, true);
 }
开发者ID:borota,项目名称:JTVS,代码行数:7,代码来源:CommonPackage.cs


示例4: ArgumentNullException

	public void AddService
				(Type serviceType, ServiceCreatorCallback callback,
				 bool promote)
			{
				// Validate the parameters.
				if(serviceType == null)
				{
					throw new ArgumentNullException("serviceType");
				}
				if(callback == null)
				{
					throw new ArgumentNullException("callback");
				}

				// Promote the service to the parent if necessary.
				if(promote && parentProvider != null)
				{
					IServiceContainer parent;
					parent = (IServiceContainer)(parentProvider.GetService
						(typeof(IServiceContainer)));
					if(parent != null)
					{
						parent.AddService(serviceType, callback, promote);
						return;
					}
				}

				// Add the service to this container.
				table[serviceType] = callback;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:30,代码来源:ServiceContainer.cs


示例5: PlotterServicePackage

        /// <summary>
        /// Default constructor of the package.
        /// The package is not yet sited inside Visual Studio, so this is the place
        /// for any setup that doesn't need the VS environment.
        /// Here we register our service, so that it will be available to any other
        /// packages by the time their Initialize is called.
        /// </summary>
        public PlotterServicePackage()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));

            var serviceContainer = this as IServiceContainer;
            var serviceCreator = new ServiceCreatorCallback(CreatePlotterService);
            serviceContainer.AddService(typeof(SPlotter2DService), serviceCreator, true);            
        }
开发者ID:ChaosCabbage,项目名称:plotter-service-for-visual-studio,代码行数:15,代码来源:PlotterServicePackage.cs


示例6: VsExtAutoShelvePackage

        /// <summary>
        /// Default constructor of the package.
        /// Inside this method you can place any initialization code that does not require 
        /// any Visual Studio service because at this point the package object is created but 
        /// not sited yet inside Visual Studio environment. The place to do all the other 
        /// initialization is the Initialize method.
        /// </summary>
        public VsExtAutoShelvePackage()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this));

            IServiceContainer serviceContainer = this as IServiceContainer;
            ServiceCreatorCallback callback = new ServiceCreatorCallback(CreateService);
            serviceContainer.AddService(typeof(SAutoShelveService), callback, true);
            //serviceContainer.AddService(typeof(SMyLocalService), callback); 
        }
开发者ID:modulexcite,项目名称:tfsautoshelve,代码行数:16,代码来源:VsExtAutoShelvePackage.cs


示例7: AddService

        public void AddService(Type serviceType, ServiceCreatorCallback callback, bool shouldDisposeServiceInstance)
        {
            // Create the description of this service. Note that we don't do any validation
            // of the parameter here because the constructor of ServiceData will do it for us.
            ServiceData service = new ServiceData(serviceType, null, callback, shouldDisposeServiceInstance);

            // Now add the service desctription to the dictionary.
            AddService(service);
        }
开发者ID:TerabyteX,项目名称:main,代码行数:9,代码来源:OleServiceProvider.cs


示例8: PythonConsolePackage

 /// <summary>
 /// Default constructor of the package.
 /// Inside this method you can place any initialization code that does not require 
 /// any Visual Studio service, because at this point the package object is created but 
 /// not sited yet inside the Visual Studio environment. The place to do all the other 
 /// initialization is the Initialize method.
 /// </summary>
 public PythonConsolePackage()
 {
     // This package has to proffer the IronPython engine provider as a Visual Studio
     // service. Note that for performance reasons we don't actually create any object here,
     // but instead we register a callback function that will create the object the first
     // time this package will receive a request for the service.
     IServiceContainer container = this as IServiceContainer;
     ServiceCreatorCallback callback = new ServiceCreatorCallback(CreateService);
     container.AddService(typeof(IPythonEngineProvider), callback, true);
 }
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:17,代码来源:PythonConsolePackage.cs


示例9: ServiceCreatorCallback

 void IPackage.Initialize(IServiceProvider serviceProvider)
 {
     this._serviceProvider = serviceProvider;
     IServiceContainer service = (IServiceContainer) this._serviceProvider.GetService(typeof(IServiceContainer));
     if (service != null)
     {
         ServiceCreatorCallback callback = new ServiceCreatorCallback(this.OnCreateService);
         service.AddService(typeof(IClassViewService), callback);
     }
 }
开发者ID:ikvm,项目名称:webmatrix,代码行数:10,代码来源:ClassViewPackage.cs


示例10: PythonConsolePackage

 /// <summary>
 /// Default constructor of the package.
 /// Inside this method you can place any initialization code that does not require 
 /// any Visual Studio service, because at this point the package object is created but 
 /// not sited yet inside the Visual Studio environment. The place to do all the other 
 /// initialization is the Initialize method.
 /// </summary>
 public PythonConsolePackage()
 {
     Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
     // This package has to proffer the IronPython engine provider as a Visual Studio
     // service. Note that for performance reasons we don't actually create any object here,
     // but instead we register a callback function that will create the object the first
     // time this package will receive a request for the service.
     IServiceContainer container = this as IServiceContainer;
     ServiceCreatorCallback callback = new ServiceCreatorCallback(CreateService);
     container.AddService(typeof(IPythonEngineProvider), callback, true);
 }
开发者ID:smartmobili,项目名称:parsing,代码行数:18,代码来源:PythonConsolePackage.cs


示例11: ServiceData

            public ServiceData(Type serviceType, object instance, ServiceCreatorCallback callback, bool shouldDispose) {
                Utilities.ArgumentNotNull("serviceType", serviceType);

                if ((null == instance) && (null == callback)) {
                    throw new ArgumentNullException("instance");
                }

                this.serviceType = serviceType;
                this.instance = instance;
                this.creator = callback;
                this.shouldDispose = shouldDispose;
            }
开发者ID:Boddlnagg,项目名称:VisualRust,代码行数:12,代码来源:OleServiceProvider.cs


示例12: SharpOnlyPkgPackage

        /// <summary>
        /// Default constructor of the package.
        /// Inside this method you can place any initialization code that does not require 
        /// any Visual Studio service because at this point the package object is created but 
        /// not sited yet inside Visual Studio environment. The place to do all the other 
        /// initialization is the Initialize method.
        /// </summary>
        public SharpOnlyPkgPackage()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));

            // Init service...
            IServiceContainer serviceContainer = this as IServiceContainer;
            ServiceCreatorCallback callback =
               new ServiceCreatorCallback(CreateService);

            serviceContainer.AddService(typeof(MSBuildTaskService), callback, true);
            serviceContainer.AddService(typeof(SharpBuildService), callback, true);
            serviceContainer.AddService(typeof(SharpBuildDeployService), callback, true);
        }
开发者ID:boyd4y,项目名称:sharpbuild,代码行数:20,代码来源:SharpOnlyPkgPackage.cs


示例13: AddService

		/// <summary>
		/// Adds the specified service to the service container.
		/// </summary>
		/// <param name="serviceType">The type of service to add.</param>
		/// <param name="callback">A callback object that is used to create the service. This allows a service to be declared as available, but delays the creation of the object until the service is requested.</param>
		public void AddService(Type serviceType, ServiceCreatorCallback callback)
		{
			if (serviceType == null)
				throw new ArgumentNullException("serviceType");
 
			if (callback == null)
				throw new ArgumentNullException("callback");
 
			if (_services.Contains(serviceType))
				throw new ArgumentException("Service already exists.", "serviceType");

			_services[serviceType] = callback;
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:18,代码来源:ServiceContainer.cs


示例14: DesignSurface

 public DesignSurface(IServiceProvider parentProvider)
 {
     this._parentProvider = parentProvider;
     this._serviceContainer = new DesignSurfaceServiceContainer(this._parentProvider);
     ServiceCreatorCallback callback = new ServiceCreatorCallback(this.OnCreateService);
     this.ServiceContainer.AddService(typeof(ISelectionService), callback);
     this.ServiceContainer.AddService(typeof(IExtenderProviderService), callback);
     this.ServiceContainer.AddService(typeof(IExtenderListService), callback);
     this.ServiceContainer.AddService(typeof(ITypeDescriptorFilterService), callback);
     this.ServiceContainer.AddService(typeof(IReferenceService), callback);
     this.ServiceContainer.AddService(typeof(DesignSurface), this);
     this._host = new DesignerHost(this);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:DesignSurface.cs


示例15: AddService

        public void AddService(string serviceName, ServiceCreatorCallback creatorCallback, bool promote)
        {
            Require.NotNullOrEmptyString("serviceName", serviceName); // $NON-NLS-1

            if (this.servicesByName.ContainsKey(serviceName))
                throw RuntimeFailure.ServiceAlreadyExists("serviceName", serviceName);

            this.servicesByName.Add(serviceName, creatorCallback);

            if (promote) {
                IServiceContainerExtension ice = this.ParentContainer as IServiceContainerExtension;
                if (ice != null)
                    ice.AddService(serviceName, creatorCallback, true);
            }
        }
开发者ID:Carbonfrost,项目名称:ff-foundations-runtime,代码行数:15,代码来源:FrameworkServiceContainer.Impl.cs


示例16: AddService1

		public void AddService1 ()
		{
			object service;
			ServiceContainer parent;
			ServiceContainer sc;

			object serviceInstance1 = new ArrayList ();
			object serviceInstance2 = new Hashtable ();
			object callback1 = new ServiceCreatorCallback (
				Svc.ServiceCreator);

			sc = new ServiceContainer ();
			sc.AddService (typeof (ICollection), serviceInstance1);
			sc.AddService (typeof (IEnumerable), serviceInstance2);
			sc.AddService (typeof (Svc), callback1);

			service = sc.GetService (typeof (ICollection));
			Assert.IsNotNull (service, "#A1");
			Assert.AreSame (serviceInstance1, service, "#A2");

			service = sc.GetService (typeof (IEnumerable));
			Assert.IsNotNull (service, "#B1");
			Assert.AreSame (serviceInstance2, service, "#B2");

			service = sc.GetService (typeof (ArrayList));
			Assert.IsNull (service, "#C1");

			service = sc.GetService (typeof (ICloneable));
			Assert.IsNull (service, "#D1");

			Assert.AreEqual (0, Svc.TotalObjectsCreatedByCallback, "#E1");
			service = sc.GetService (typeof (Svc));
			Assert.IsNotNull (service, "#E2");
			Assert.IsTrue (service is Svc, "#E3");
			Assert.AreEqual (1, Svc.TotalObjectsCreatedByCallback, "#E4");
			Assert.AreSame (service, sc.GetService (typeof (Svc)), "#E5");
			Assert.AreEqual (1, Svc.TotalObjectsCreatedByCallback, "#E6");

			parent = new ServiceContainer ();
			sc = new ServiceContainer (parent);

			sc.AddService (typeof (ICollection), serviceInstance1);

			Assert.AreSame (serviceInstance1, sc.GetService (typeof (ICollection)), "#F1");
			Assert.IsNull (parent.GetService (typeof (ICollection)), "#F2");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:46,代码来源:ServiceContainerTest.cs


示例17: AddService

            public void AddService( Type serviceType, ServiceCreatorCallback callback, bool promote )
            {
                if ( promote && parentContainer != null )
                {
                    parentContainer.AddService( serviceType, callback, promote );
                    return;
                }

                lock ( syncRoot )
                {
                    if ( services.ContainsKey( serviceType ) )
                    {
                        var message = DataAnnotationsResources.ServiceAlreadyExists.FormatDefault( serviceType );
                        throw new ArgumentException( message, "serviceType" );
                    }

                    services.Add( serviceType, callback );
                }
            }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:19,代码来源:ValidationContext.cs


示例18: Initialize

        protected override void Initialize()
        {
            base.Initialize();

            //PLEASE NOTE THE FOLLOWING CODE IS ADDED TO MAKE THE SPECIFIC DESIGNER TYPE INTERNAL
            //This is a work around for invoke workflow so that the ActivityHostDesignerType does not become public
            //Please refer to file WorkflowInlining.cs
            Type invokeWorkflowType = Type.GetType(InvokeWorkflowDesigner.InvokeWorkflowRef);
            if (invokeWorkflowType != null)
                TypeDescriptor.AddAttributes(invokeWorkflowType, new DesignerAttribute(typeof(InvokeWorkflowDesigner), typeof(IDesigner)));

            //Add all the services, it is important to make sure that if user pushes the services then we honor
            //those services
            LoaderHost.AddService(typeof(WorkflowDesignerLoader), this);

            ServiceCreatorCallback callback = new ServiceCreatorCallback(OnCreateService);
            if (LoaderHost.GetService(typeof(IWorkflowCompilerOptionsService)) == null)
                LoaderHost.AddService(typeof(IWorkflowCompilerOptionsService), callback);

            if (LoaderHost.GetService(typeof(IIdentifierCreationService)) == null)
                LoaderHost.AddService(typeof(IIdentifierCreationService), callback);

            if (LoaderHost.GetService(typeof(ComponentSerializationService)) == null)
                LoaderHost.AddService(typeof(ComponentSerializationService), callback);

            LoaderHost.RemoveService(typeof(IReferenceService));
            if (LoaderHost.GetService(typeof(IReferenceService)) == null)
                LoaderHost.AddService(typeof(IReferenceService), callback);

            if (LoaderHost.GetService(typeof(IDesignerVerbProviderService)) == null)
                LoaderHost.AddService(typeof(IDesignerVerbProviderService), callback);

            //Add all the extenders, the extenders are responsible to add the extended properties which are not
            //actual properties on activity
            IExtenderProviderService extenderProviderService = GetService(typeof(IExtenderProviderService)) as IExtenderProviderService;
            if (extenderProviderService != null)
            {
                foreach (IExtenderProvider extender in ComponentDispenser.Extenders)
                    extenderProviderService.AddExtenderProvider(extender);
            }

            this.customActivityDesignerAdapter = new CustomActivityDesignerAdapter(LoaderHost);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:43,代码来源:XomlDesignerLoader.cs


示例19: BabelPackage

        protected BabelPackage()
        {
            ServiceCreatorCallback callback = new ServiceCreatorCallback(
                delegate(IServiceContainer container, Type serviceType)
                {
                    if (typeof(BlenXLanguageService) == serviceType)
                    {
                        BlenXLanguageService language = new BlenXLanguageService(this);
                        language.SetSite(this);

                        // register for idle time callbacks
                        IOleComponentManager mgr = GetService(typeof(SOleComponentManager)) as IOleComponentManager;
                        if (componentID == 0 && mgr != null)
                        {
                            OLECRINFO[] crinfo = new OLECRINFO[1];
                            crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                            crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime |
                                                          (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
                            crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal |
                                                          (uint)_OLECADVF.olecadvfRedrawOff |
                                                          (uint)_OLECADVF.olecadvfWarningsOff;
                            crinfo[0].uIdleTimeInterval = 1000;
                            int hr = mgr.FRegisterComponent(this, crinfo, out componentID);
                        }

                        return language;
                    }
                    else
                    {
                        return null;
                    }
                });

            // proffer the LanguageService
            (this as IServiceContainer).AddService(typeof(BlenXLanguageService), callback, true);
        }
开发者ID:ldematte,项目名称:BlenXVSP,代码行数:36,代码来源:BlenXPackage.cs


示例20: AddService

			public void AddService (Type serviceType, ServiceCreatorCallback callback)
			{
				AddService (serviceType, callback, false);
			}
开发者ID:carrie901,项目名称:mono,代码行数:4,代码来源:ValidationContext.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ServiceEndpoint类代码示例发布时间:2022-05-24
下一篇:
C# ServiceControllerStatus类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap