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


C# ServiceCreatorCallback类代码示例

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


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


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