次の方法で共有


FlavoredProjectFactoryBase Class

Definition

Base class for flavored project factories.

public ref class FlavoredProjectFactoryBase abstract : Microsoft::VisualStudio::Shell::Flavor::IVsAggregatableProjectFactoryCorrected, Microsoft::VisualStudio::Shell::Interop::IVsProjectFactory
[Windows::Foundation::Metadata::WebHostHidden]
class FlavoredProjectFactoryBase abstract : Microsoft::VisualStudio::Shell::Flavor::IVsAggregatableProjectFactoryCorrected, Microsoft::VisualStudio::Shell::Interop::IVsProjectFactory
public abstract class FlavoredProjectFactoryBase : Microsoft.VisualStudio.Shell.Flavor.IVsAggregatableProjectFactoryCorrected, Microsoft.VisualStudio.Shell.Interop.IVsProjectFactory
type FlavoredProjectFactoryBase = class
    interface IVsAggregatableProjectFactoryCorrected
    interface IVsProjectFactory
Public MustInherit Class FlavoredProjectFactoryBase
Implements IVsAggregatableProjectFactoryCorrected, IVsProjectFactory
Inheritance
FlavoredProjectFactoryBase
Implements

Examples

namespace Microsoft.Samples.VisualStudio.IronPythonProject.WPFProviders  
{  
    [ComVisible(true)]  
    [ClassInterface(ClassInterfaceType.None)]  
    [Guid("FEBF49B8-D18C-4745-ADE0-35BF632E0533")]  
    public class PythonWPFFlavor : FlavoredProjectBase  
    {  
        public PythonWPFFlavor(IServiceProvider site)  
        {  
            this.serviceProvider = site;  
        }  

        protected override Guid GetGuidProperty(uint itemId, int propId)  
        {  
            if (propId ==   
                (int)__VSHPROPID2.VSHPROPID_AddItemTemplatesGuid)  
            {  
                return typeof(PythonWPFProjectFactory).GUID;  
            }  
            return base.GetGuidProperty(itemId, propId);  
        }  

        protected override int GetProperty(uint itemId, int propId, out object property)  
        {  
            return base.GetProperty(itemId, propId, out property);  
        }  
    }  
    [Guid(PythonWPFProjectFactory.PythonWPFProjectFactoryGuid)]  
    public class PythonWPFProjectFactory : FlavoredProjectFactoryBase  
    {  
        public const string PythonWPFProjectFactoryGuid = "229B3E77-97E9-4f6d-9151-E6D103EA4D4A";  

        private IServiceProvider site;  
        public PythonWPFProjectFactory(IServiceProvider site) : base()  
        {  
            this.site = site;  
        }  

        protected override object PreCreateForOuter(IntPtr outerProjectIUnknown)  
        {  
            return new PythonWPFFlavor(site);  
        }  
    }  
}  

Remarks

An implementation of a flavored project factory is defined by FlavoredProjectFactory. Override the PreCreateForOuter method to return a new FlavoredProjectBase derived class. The derived class GetGuidProperty method can redirect the templates search to find new project templates for this flavor.

Constructors

FlavoredProjectFactoryBase()

Initializes a new instance of FlavoredProjectFactoryBase.

Properties

serviceProvider

Gets the project's service provider.

Methods

CanCreateProject(String, UInt32)

Determines whether or not the project can be created with the supplied parameters.

CreateProject(String, String, String, UInt32, Guid, IntPtr, Int32)

Creates a project.

Dispose(Boolean)

Disposes the service provider.

Initialize()

Initializes the project factory.

PreCreateForOuter(IntPtr)

Creates an instance of the project.

ProjectTypeGuids(String)

Gets the set of project type GUIDs from the project file.

Explicit Interface Implementations

IVsAggregatableProjectFactoryCorrected.GetAggregateProjectType(String, String)
IVsAggregatableProjectFactoryCorrected.PreCreateForOuter(IntPtr, IntPtr)
IVsProjectFactory.CanCreateProject(String, UInt32, Int32)
IVsProjectFactory.Close()
IVsProjectFactory.CreateProject(String, String, String, UInt32, Guid, IntPtr, Int32)
IVsProjectFactory.SetSite(IServiceProvider)

Applies to